JBoss 서버에서 호스팅되는 테스트 환경에서 실행중인 기존 레거시 웹 서비스에 바인딩하려고하지만 Spring에서 Bean을 만들 수 없습니다. 때문에 아래 예외 :webservice에 바인딩 할 수 없습니다. java.lang.StackTraceElement에 인수가없는 기본 생성자가 없습니다.
Caused by: javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:83)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:244)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:687)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:675)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
at javax.xml.ws.Service.getPort(Service.java:92)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.getPortStub(JaxWsPortClientInterceptor.java:413)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:337)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.afterPropertiesSet(JaxWsPortClientInterceptor.java:316)
at org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean.afterPropertiesSet(JaxWsPortProxyFactoryBean.java:42)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 38 more
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
at java.lang.StackTraceElement
at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
at java.lang.Throwable
at java.lang.Exception
at uk.co.example.UserException
at public javax.xml.bind.JAXBElement uk.co.example.ObjectFactory.createUserException(uk.co.example.UserException)
at uk.co.example.ObjectFactory
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:140)
나는 봄 XML을 통해 웹 서비스 바인딩 해요 :
<bean id="auth1" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="uk.co.example.Authentication" />
<property name="wsdlDocumentUrl" value="http://testdomain.co.uk:30001/services/authentication?wsdl" />
<property name="namespaceUri" value="http://example.co.uk/" />
<property name="serviceName" value="AuthenticationWebServiceService" />
<property name="portName" value="AuthenticationPort" />
<property name="maintainSession" value="true" />
</bean>
내 왜냐하면 userexecption 단지의 java.lang.Exception 확장 :
public class UserException extends Exception
{
}
그래서 내 webservice에는 UserException이 throw되는 메서드가 있습니다. UserException은 인수가없는 생성자가없는 StackTraceElement에 대한 참조를 포함하는 java.lang.Exception을 확장합니다. 따라서 JAXB 예외입니다. 이 문제에 관해 나는 다른 게시물에서 그만큼 많이 생각해 냈다.
내가 이해할 수없는 것은 : 왜이 특정 웹 서비스와이 예외 클래스입니까? 그리고 물론, 이걸 어떻게 수정합니까?
내 webservice는 다른 예외를 많이 던졌습니다 (대부분 java.lang.Exception을 확장 한 것처럼 보입니다). 동일한 JBoss 서버에서 실행되는 또 다른 웹 서비스 (UserException은 던지지 않지만 다른 맞춤 예외 클래스를 던집니다)는 정상적으로 작동합니다. 웹 서비스의 2 가지 다른 세트에는 다른 클라이언트 항아리가 있습니다.
나는 봄 테스트와 웹 jar (v3.1.0), junit, log4j로 작성된 Eclipse Maven 프로젝트를 만들었다. 레거시 빌드의 일부로 이미 존재하는 2 개의 클라이언트 jar도 classpath에 있습니다. 프록시 인터페이스를 인증 인터페이스로 autowires하고 authenticateUser() 메소드를 호출하는 Junit을 만들었습니다.
기존 코드이므로 실행중인 webservice 또는 생성 된 클라이언트 jars에서 아무 것도 변경할 수 없습니다.
제안 사항?
웹 서비스 및 초보자 용 코드가 어떻게 구축되고 배포되는지에 관해서는 약간의 초보자 였기 때문에 너무 분명한 것으로 생각하는 것을 두려워하지 마십시오!
왜 클라이언트 병을 변경할 수 없습니까? –
JAXWS 인터페이스 및 METRO 2.0 구현이 실수로 IDE (NetBeans)에서 war 파일에 포함 된 경우 JDK 1.7에서 동일한 문제가 발생했습니다. 프로젝트를 정리 한 후에 오류가 사라졌습니다. –