[jboss-user] [EJB 3.0] - Re: EJB with SSL does not work with JBoss AS 4.2.2

dbmac45 do-not-reply at jboss.com
Fri Apr 25 16:10:18 EDT 2008


jaikiran,

I am pretty much experiencing the same results that TJ is seeing and with an almost identical setup.  I followed the steps in "Chapter 9 - Transports" in the JBoss EJB 3.0 Reference Documentation.

I am running JBoss AS 4.2.2, Java 1.5.0_11 and Windows XP.

I added the following code to the "jboss-service.xml" file in the "server/default/deploy/ejb3.deployer/META-INF" file as specified in the JBoss EJB 3.0 Reference doc.


  |    <mbean code="org.jboss.remoting.transport.Connector"
  |       name="jboss.remoting:type=Connector,transport=socket3843,handler=ejb3">
  |       <depends>jboss.aop:service=AspectDeployer</depends>
  |       <attribute name="InvokerLocator">sslsocket://${jboss.bind.address}:3843</attribute>
  |       <attribute name="Configuration">
  |          <handlers>
  |             <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
  |          </handlers>
  |       </attribute>
  |    </mbean>
  | 

My EJB code looks like the following:


  | @RemoteBindings({
  | 	@RemoteBinding(clientBindUrl="sslsocket://0.0.0.0:3843", jndiBinding="TitanServicesSSL"),
  | 	@RemoteBinding(jndiBinding="TitanServices")
  |  })
  | @Stateless
  | public class TravelAgentBean implements TravelAgentRemote {
  | ...
  | }
  | 

My test client looks like the following:


  | 	public static void main(String[] args) {
  | 		try {
  | 			// Get initial context.
  | 			Context jndiContext = getInitialContext();
  | 			
  | 			// Get a reference to a travel agent session bean.
  | 			TravelAgentRemote travelAgentRemote = (TravelAgentRemote) jndiContext.lookup("TitanServicesSSL");
  | //			TravelAgentRemote travelAgentRemote = (TravelAgentRemote) jndiContext.lookup("TitanServices");
  | 			
  | 			// Create a new cabin.
  | 			CabinDTO cabin1 = new CabinDTO(1, "Master Suite", 1, 1, 3);
  | 			
  | 			travelAgentRemote.createCabin(cabin1);
  | 			
  | 			// Retrieve the newly created cabin.  If it was found then
  | 			// display it on the console and then delete it.
  | 			CabinDTO cabin2 = travelAgentRemote.findCabin(cabin1.getId());
  | 			
  | 			if (cabin2 != null) {
  | 				System.out.println(cabin2.toString());
  | 				
  | 				travelAgentRemote.deleteCabin(cabin1.getId());
  | 			}
  | 			
  | 		} catch (NamingException ne) {
  | 			ne.printStackTrace();
  | 		}
  | 
  | 	}
  | 
  | 	private static Context getInitialContext() throws NamingException {
  | 		return new InitialContext();
  | 	}
  | 
  | 

If I do a "lookup" on "TitanServices" then everything works fine.  If I do a "lookup" on "TitanServicesSSL" then it fails (the lookup actually succeeds but the createCabin() method fails).  I have created the appropriate keystore, self-signed certificate, etc., according to the JBoss EJB 3.0 Reference doc and have added the appropriate JVM args for the client and JBoss that point to the keystore, etc.  JBoss starts successfully and without any errors.

The following is the server-side exception that is thrown when I attempt to run my program using the "TitanServicesSSL" lookup.


  | 15:44:44,505 ERROR [ServerThread] Worker thread initialization failure
  | java.lang.reflect.InvocationTargetException
  | 	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 org.jboss.remoting.transport.socket.ServerThread.createServerSocketWrapper(ServerThread.java:720)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:368)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  | Caused by: java.net.SocketException: Socket Closed
  | 	at java.net.PlainSocketImpl.setOption(PlainSocketImpl.java:201)
  | 	at java.net.Socket.setSoTimeout(Socket.java:991)
  | 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setSoTimeout(SSLSocketImpl.java:1971)
  | 	at org.jboss.remoting.transport.socket.SocketWrapper.setTimeout(SocketWrapper.java:85)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:168)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:66)
  | 	at org.jboss.remoting.transport.socket.ServerSocketWrapper.<init>(ServerSocketWrapper.java:46)
  | 	... 7 more
  | 
  | 


The following is the client-side exception that is thrown:


  | Exception in thread "main" org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:3843/]
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:532)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	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.createCabin(Unknown Source)
  | 	at com.titan.client.TitanClient.main(TitanClient.java:27)
  | Caused by: java.lang.reflect.InvocationTargetException
  | 	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 org.jboss.remoting.transport.socket.SocketClientInvoker.createClientSocket(SocketClientInvoker.java:152)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:856)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	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.createCabin(Unknown Source)
  | 	at com.titan.client.TitanClient.main(TitanClient.java:27)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
  | 	... 10 more
  | Caused by: java.net.SocketException: Socket Closed
  | 	at java.net.PlainSocketImpl.setOption(PlainSocketImpl.java:201)
  | 	at java.net.Socket.setSoTimeout(Socket.java:991)
  | 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setSoTimeout(SSLSocketImpl.java:1971)
  | 	at org.jboss.remoting.transport.socket.SocketWrapper.setTimeout(SocketWrapper.java:85)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:168)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:66)
  | 	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 org.jboss.remoting.transport.socket.SocketClientInvoker.createClientSocket(SocketClientInvoker.java:152)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:856)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	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)
  | 	... 10 more
  | 
  | 

Like TJ, the following are true:

Yes, I can telnet into the SSL port (3843). 
Yes, the key store and passoword have been generated.
Yes, the JVM arguments have been modified to point to the keystore. 
Yes, the client gets a references to the EJB but fails when trying to call the createCabin() method. 
Yes, all firewalls have been disabled. 
Yes, I am using the jbossall-client.jar from version 4.2.2 when running the client. 
The JRE version is 1.5.

Thanks in advance for any help,

Dave M.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146930#4146930

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146930



More information about the jboss-user mailing list