gpt4 book ai didi

java - ejb中的Web服务问题

转载 作者:行者123 更新时间:2023-12-01 16:40:04 26 4
gpt4 key购买 nike

我的网络服务方法中有一个我无法理解的错误。

首先,方法如下:

package com.ubb.damate.webservice;

import java.util.Date;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebParam;
import javax.jws.WebService;

import com.ubb.damate.model.UserEvent;
import com.ubb.damate.model.UserEventPK;
import com.ubb.damate.service.UserEventServiceLocal;
import com.ubb.damate.util.DateUtils;

/** Session Bean implementation class UserEventWebService */
@Stateless
@WebService
public class UserEventWebService {
@EJB(beanName = "UserEventService")
private UserEventServiceLocal userEventService;

public String createOrUpdate(@WebParam(name = "Eventvalue") String eventvalue, @WebParam(name = "Username") String username, @WebParam(name = "Eventname") String eventname) {
Date date = DateUtils.createDate(-1, 1, 1);

UserEventPK userPk = new UserEventPK();
userPk.setEventname(eventname);
userPk.setUsername(username);
userPk.setEventdate(date);

UserEvent userEvent = new UserEvent();
userEvent.setId(userPk);

String a = userEvent.getEventvalue();

userEvent = userEventService.find(userEvent);

String b = userEvent.getEventvalue();

//userEvent.setEventvalue(eventvalue);

userEventService.createOrUpdate(userEvent);

return "\"" + a + "\" - \"" + b + "\"";
}
}

现在这是错误消息:

INFO: Glassfish-specific (Non-portable) JNDI names for EJB ProjectService : [com.ubb.damate.service.ProjectServiceRemote, com.ubb.damate.service.ProjectServiceRemote#com.ubb.damate.service.ProjectServiceRemote]
INFO: com.ubb.damate.model.Event actually got transformed
INFO: Portable JNDI names for EJB EventService : [java:global/damate-ear-1.0.0-SNAPSHOT/damate-core-1.0.0-SNAPSHOT/EventService!com.ubb.damate.service.EventServiceRemote, java:global/damate-ear-1.0.0-SNAPSHOT/damate-core-1.0.0-SNAPSHOT/EventService!com.ubb.damate.service.EventServiceLocal]
INFO: Glassfish-specific (Non-portable) JNDI names for EJB EventService : [com.ubb.damate.service.EventServiceRemote#com.ubb.damate.service.EventServiceRemote, com.ubb.damate.service.EventServiceRemote]
INFO: WSTX-COMMON-2007: Map CMT EJB web method 'com.ubb.damate.webservice.UserEventWebService'.'createOrUpdate' with effective transaction attribute of 'REQUIRED' to wsdl bounded operation '{http://webservice.damate.ubb.com/}UserEventWebServicePort':'createOrUpdate' with WS-AT policy assertion(s) 'UserEventWebServicePortBinding_createOrUpdate_WSAT_Policy'
SEVERE: Cannot initialize endpoint : error is :
javax.xml.ws.WebServiceException: class com.ubb.damate.webservice.jaxws.CreateOrUpdate do not have a property of the name Eventvalue
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:531)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.createArgumentsBuilder(EndpointMethodHandler.java:133)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.<init>(EndpointMethodHandler.java:106)
at com.sun.xml.ws.server.sei.SEIInvokerTube.<init>(SEIInvokerTube.java:82)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:219)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:278)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.initRuntimeInfo(EjbRuntimeEndpointInfo.java:358)
at org.glassfish.webservices.WebServiceEjbEndpointRegistry.registerEndpoint(WebServiceEjbEndpointRegistry.java:128)
at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1160)
at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:197)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:161)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:207)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:197)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:63)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:216)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:362)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:185)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:680)
Caused by: javax.xml.bind.JAXBException: Eventvalue is not a valid property on class com.ubb.damate.webservice.jaxws.CreateOrUpdate
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:971)
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:520)
... 44 more

INFO: WSTX-COMMON-2007: Map CMT EJB web method 'com.ubb.damate.webservice.UserWebService'.'createOrUpdate' with effective transaction attribute of 'REQUIRED' to wsdl bounded operation '{http://webservice.damate.ubb.com/}UserWebServicePort':'createOrUpdate' with WS-AT policy assertion(s) 'UserWebServicePortBinding_createOrUpdate_WSAT_Policy'
SEVERE: Cannot initialize endpoint : error is :
javax.xml.ws.WebServiceException: class com.ubb.damate.webservice.jaxws.CreateOrUpdate do not have a property of the name userName
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:531)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.createArgumentsBuilder(EndpointMethodHandler.java:133)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.<init>(EndpointMethodHandler.java:106)
at com.sun.xml.ws.server.sei.SEIInvokerTube.<init>(SEIInvokerTube.java:82)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:219)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:278)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.initRuntimeInfo(EjbRuntimeEndpointInfo.java:358)
at org.glassfish.webservices.WebServiceEjbEndpointRegistry.registerEndpoint(WebServiceEjbEndpointRegistry.java:128)
at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1160)
at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:197)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:161)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:207)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:197)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:63)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:216)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:362)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:185)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:680)
Caused by: javax.xml.bind.JAXBException: userName is not a valid property on class com.ubb.damate.webservice.jaxws.CreateOrUpdate
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:971)
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:520)
... 44 more

INFO: WSTX-COMMON-2007: Map CMT EJB web method 'com.ubb.damate.webservice.WorkspaceWebService'.'createOrUpdate' with effective transaction attribute of 'REQUIRED' to wsdl bounded operation '{http://webservice.damate.ubb.com/}WorkspaceWebServicePort':'createOrUpdate' with WS-AT policy assertion(s) 'WorkspaceWebServicePortBinding_createOrUpdate_WSAT_Policy'
SEVERE: Cannot initialize endpoint : error is :
javax.xml.ws.WebServiceException: class com.ubb.damate.webservice.jaxws.CreateOrUpdate do not have a property of the name Path
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:531)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.createArgumentsBuilder(EndpointMethodHandler.java:133)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.<init>(EndpointMethodHandler.java:106)
at com.sun.xml.ws.server.sei.SEIInvokerTube.<init>(SEIInvokerTube.java:82)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:219)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:505)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:278)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.initRuntimeInfo(EjbRuntimeEndpointInfo.java:358)
at org.glassfish.webservices.WebServiceEjbEndpointRegistry.registerEndpoint(WebServiceEjbEndpointRegistry.java:128)
at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1160)
at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:197)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:161)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:207)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:197)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:63)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:216)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:362)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:185)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:236)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:128)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:457)
at com.sun.enterprise.module.bootstrap.Main.launch(Main.java:401)
at org.jvnet.hk2.osgiadapter.HK2Main.start(HK2Main.java:125)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:915)
at org.jvnet.hk2.osgimain.Main.start(Main.java:140)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:680)
Caused by: javax.xml.bind.JAXBException: Path is not a valid property on class com.ubb.damate.webservice.jaxws.CreateOrUpdate
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:971)
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:520)
... 44 more
<小时/>

编辑:
添加了整个 Webservice 类。

最佳答案

我找到了答案。一个包中的 2 个 webmethods 不能具有相似的名称。

关于java - ejb中的Web服务问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4747192/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com