栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

java.lang.IllegalArgumentException: An operation with name [{X}count] already exists in this service

java.lang.IllegalArgumentException: An operation with name [{X}count] already exists in this service

尝试编写webservice的服务端时遇到报错:

Exception in thread “main” java.lang.IllegalArgumentException: An operation with name [{http://service.demo.example.com/}count] already exists in this service
完整报错如下:

Exception in thread "main" java.lang.IllegalArgumentException: An operation with name [{http://service.demo.example.com/}count] already exists in this service
	at org.apache.cxf.service.model.InterfaceInfo.addOperation(InterfaceInfo.java:78)
	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.createOperation(ReflectionServiceFactoryBean.java:1008)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createOperation(JaxWsServiceFactoryBean.java:633)
	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.createInterface(ReflectionServiceFactoryBean.java:1000)
	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:461)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:695)
	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:530)
	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263)
	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
	at org.apache.cxf.frontend.AbstractWSDLbasedEndpointFactory.createEndpoint(AbstractWSDLbasedEndpointFactory.java:103)
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168)
	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
	at com.example.demo.controller.WebService.main(WebService.java:22)

检查半天后发现似乎是mybatisplus与webservice起冲突了

报错代码:
package com.example.demo.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.demo.domain.UserDO;
import javax.jws.WebService;

@WebService
public interface UserService extends IService {
    String test(String name);
}

package com.example.demo.service.serviceimpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.dao.UserDao;
import com.example.demo.domain.UserDO;
import com.example.demo.service.UserService;

public class UserServiceimpl extends ServiceImpl  implements UserService {

    @Override
    public String test(String name){
        return name+",你好";
    }
}

去除mybatisplus后不再报错的代码
package com.example.demo.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.demo.domain.UserDO;
import javax.jws.WebService;

@WebService
//public interface UserService extends IService {
public interface UserService{
    String test(String name);
}

package com.example.demo.service.serviceimpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.dao.UserDao;
import com.example.demo.domain.UserDO;
import com.example.demo.service.UserService;

//public class UserServiceimpl extends ServiceImpl  implements UserService {
public class UserServiceimpl implements UserService {

    @Override
    public String test(String name){
        return name+",你好";
    }
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/773946.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号