[JBossWS] - How to specify the truststore location for a web service cli
by ds-crcpress
Hello,
I have the following scenario:
I am trying to call a Webservice that communicates via a secure socket (in other words, its located at https://hostname/path/to/service?wsdl). When I call the Stateless Session Bean that has the proxy injected via @WebServiceRef, I get an odd UndeclaredThrowable exception. It turns out it is because it cannot communicate with the webservice and is throwing an IOException which was not declared in the remote interface (thus trickling up and causing the UndeclaredThrowable rmi layer exception).
I created a unit test to try calling the web service outside of the EJB container, and got it working. I had to specify the truststore location with a system property javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword property (which keeps the IOException from being thrown).
Now comes the tricky part: how do I specify these properties for the JBoss application server? I tried using the SystemProperties service, but it does not work--I still get the same exception.
Any other idea?
Thanks,
David
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139982#4139982
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139982
16 years, 9 months
[JBossWS] - Re: help completely stuck trying to access an EJB3 WS - plea
by wiggy
one more thing i saw some references to jsdk 1.6 (which i was using) vs 1.5.
i rest all my code and the server to 1.5 and redid the call - i still get the error (client side log trace - the server side shows no activity). This is my client doing the ejb lookup call
| public static void main(String[] args) throws Exception
| {
|
| InitialContext ctx;
| // TODO Auto-generated method stub
|
| TestHelloServiceRemote test;
|
| //HelloService s = new HelloService();
| //HelloServiceWS ws = s.getHelloServiceWSPort();
|
|
| ctx = getInitialContext();
|
| test = (TestHelloServiceRemote) ctx.lookup ("TestHelloBean/remote");
|
| //String res = ws.sayHello();
| String res = test.sayHello();
| ...
|
which throws the error
|
| Exception in thread "main" javax.ejb.EJBException: javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
| Caused by: javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:317)
| at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:255)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
| at $Proxy144.sayHello(Unknown Source)
| at test.TestHelloBean.sayHello(TestHelloBean.java:18)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
| at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
| at org.jboss.remoting.Client.invoke(Client.java:1634)
| at org.jboss.remoting.Client.invoke(Client.java:548)
| at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
| at $Proxy0.sayHello(Unknown Source)
| at test.Test.main(Test.java:30)
| at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
| at $Proxy0.sayHello(Unknown Source)
| at test.Test.main(Test.java:30)
| Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
| at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:67)
| at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:161)
| at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:59)
| at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:156)
| at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:289)
| at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
| at $Proxy144.sayHello(Unknown Source)
| at test.TestHelloBean.sayHello(TestHelloBean.java:18)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
|
|
if i change the code - just to call from the client (no ejb lookup) as follows
|
| public static void main(String[] args) throws Exception
| {
|
| InitialContext ctx;
| // TODO Auto-generated method stub
|
| TestHelloServiceRemote test;
|
| HelloService s = new HelloService();
| HelloServiceWS ws = s.getHelloServiceWSPort();
|
|
| ctx = getInitialContext();
|
| test = (TestHelloServiceRemote) ctx.lookup ("TestHelloBean/remote");
|
| String res = ws.sayHello(); //String res = test.sayHello();
|
| ...
|
|
i now get the following error
| Exception in thread "main" javax.xml.ws.WebServiceException: Unable to load Provider: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl
| at javax.xml.ws.spi.Provider.provider(Provider.java:98)
| at javax.xml.ws.Service.<init>(Service.java:83)
| at org.domain.wstest2.webservices.HelloService.<init>(HelloService.java:40)
| at test.Test.main(Test.java:21)
| Caused by: java.lang.IllegalStateException: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl
| at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:96)
| at javax.xml.ws.spi.Provider.provider(Provider.java:90)
| ... 3 more
| Caused by: java.lang.ExceptionInInitializerError
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
| at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
| at java.lang.Class.newInstance0(Class.java:350)
| at java.lang.Class.newInstance(Class.java:303)
| at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:91)
| ... 4 more
| Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference.
| at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:188)
| at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:65)
| ... 11 more
| Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
| Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.
| this problem is related to the following location:
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
| at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| this problem is related to the following location:
| at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
| at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
| at javax.xml.ws.wsaddressing.W3CEndpointReference
| Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.
| this problem is related to the following location:
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
| at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| this problem is related to the following location:
| at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
| at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
| at javax.xml.ws.wsaddressing.W3CEndpointReference
|
| at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
| at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
| at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
| at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
| at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
| at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
| at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
| at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
| at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:186)
| ... 12 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139971#4139971
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139971
16 years, 9 months
[JBossWS, EJB 3.0] How to specify the truststore location for a web service client called from EJB slsb
by David Siefert
Hello,
I have the following scenario:
I am trying to call a Webservice that communicates via a secure socket (in
other words, its located at https://hostname/path/to/service?wsdl). When I
call the Stateless Session Bean that uses the service proxy, I get an odd
UndeclaredThrowable exception. It turns out it is because it cannot
communicate with the webservice and is throwing an IOException which was not
declared in the remote interface thus causing the UndeclaredThrowable rmi
exception.
I created a unit test to try calling the web service outside of the EJB
container, and got it working. I had to specify the truststore location
with a system property javax.net.ssl.trustStore and
javax.net.ssl.trustStorePassword property (which keeps the IOException from
being thrown). Now how do I specify these properties for the JBoss
application server? I tried using the SystemProperties service, but it does
not work.
Any other idea?
Thanks,
David
16 years, 9 months