编辑:好吧,它肯定与User类有关。它只是一个典型的java类。我应该做些特别的事吗?我正在使用我在" User"的构建路径中引用的另一个Java项目。类
编辑2:嗯,我解决了旧问题,但现在我有了一个很奇怪的新问题。主持我的服务的TomcatEE似乎不喜欢用户类' setter方法。这是服务界面:
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.jws.WebMethod;
import javax.jws.WebService;
import BioFlip.User;
import BioFlip.User.Permission;
@WebService(targetNamespace = "http://bioflip.org/wsdl")
public interface IUserService
{
@WebMethod
public List<User> getUserList();
@WebMethod
public int getRegisteredUserCount();
@WebMethod
public List<User> getGuestList();
@WebMethod
public boolean isEnrolled(User user);
@WebMethod
public boolean enrollUser(User user);
@WebMethod
public boolean enrollUser(String firstname, String lastname, Permission permission, String phoneNumber,
String fingerImage, String faceImage, Date accessFrom, Date accessTo, Date lastLogin, UUID id);
@WebMethod
public boolean removeUser(User user);
@WebMethod
public User getEnrolledUser(UUID id);
}
奇怪的是,User类中的getter / setter方法似乎搞乱了Tomcat。
以下方法可行,Tomcat运行服务器(setters注释掉):
/* Returns the user's last name */
public String getLastName() {
return lastname;
}
/* Sets the user's last name */
// public void setLastName(String newLastName) {
// lastname = newLastName;
// }
//
/* Returns the user's first name */
public String getFirstName() {
return firstname;
}
/* Sets the user's first name */
// public void setFirstName(String newfirstname) {
// firstname = firstname;
// }
以下原因导致Tomcat崩溃:
/* Sets the user's last name */
// public void setLastName(String newLastName) {
// lastname = newLastName;
// }
//
/* Returns the user's first name */
public String getFirstName() {
return firstname;
}
/* Sets the user's first name */
public void setFirstName(String newfirstname) {
firstname = firstname;
}
/* Returns the user's permission level */
public Permission getPermission() {
return permission;
}
这是错误:
Aug 18, 2014 5:17:49 PM org.apache.openejb.server.webservices.WsService deployApp
SEVERE: Error deploying JAX-WS Web Service for EJB Calculator
java.lang.NullPointerException
at org.apache.cxf.jaxb.Utils.getMethodXJTA(Utils.java:294)
at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:375)
at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:329)
at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:232)
at org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:222)
at org.apache.cxf.jaxb.JAXBContextInitializer.walkReferences(JAXBContextInitializer.java:365)
at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.java:329)
at org.apache.cxf.jaxb.JAXBContextInitializer.begin(JAXBContextInitializer.java:183)
at org.apache.cxf.service.ServiceModelVisitor.visitOperation(ServiceModelVisitor.java:97)
at org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:74)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:325)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:697)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:550)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:214)
at org.apache.openejb.server.cxf.CxfEndpoint.doServiceCreate(CxfEndpoint.java:101)
at org.apache.openejb.server.cxf.ejb.EjbEndpoint.<init>(EjbEndpoint.java:64)
at org.apache.openejb.server.cxf.ejb.EjbWsContainer.createEndpoint(EjbWsContainer.java:55)
at org.apache.openejb.server.cxf.ejb.EjbWsContainer.createEndpoint(EjbWsContainer.java:44)
at org.apache.openejb.server.cxf.CxfWsContainer.start(CxfWsContainer.java:50)
at org.apache.openejb.server.cxf.CxfService.createEjbWsContainer(CxfService.java:83)
at org.apache.openejb.server.webservices.WsService.deployApp(WsService.java:281)
at org.apache.openejb.server.webservices.WsService.deploy(WsService.java:227)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.openejb.observer.ObserverManager$MethodInvocation.invoke(ObserverManager.java:399)
at org.apache.openejb.observer.ObserverManager$InvocationList.invoke(ObserverManager.java:514)
at org.apache.openejb.observer.ObserverManager$BeforeAndAfterInvocationSet.invoke(ObserverManager.java:494)
at org.apache.openejb.observer.ObserverManager.doFire(ObserverManager.java:110)
at org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:99)
at org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:134)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:884)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:623)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1248)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1087)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5378)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)