[jboss-user] [Security & JAAS/JBoss] - EJB3 SSL remote connection from swing client application
fsommavilla
do-not-reply at jboss.com
Wed Dec 5 21:26:27 EST 2007
I'm trying to connect to remote EJB from swing client, using SSL.
I add following configuration to jboss-service.xml at ejb3.deployer:
| <mbean code="org.jboss.remoting.transport.Connector"
| xmbean-dd="org/jboss/remoting/transport/Connector.xml"
| 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>
|
I also generated localhost.truststore and put it to $JBOSS_HOME/server/default/conf. I added "-Djavax.net.ssl.keyStore=$JBOSS_HOME/server/default/conf/localhost.keystore -Djavax.net.ssl.keyStorePassword=test" to jboss launch script (where $JBOSS_HOME is expanded to my local server path and opensource is keystore password). This line is added to client launch script too.
To my EJB I added:
| @RemoteBindings({
| @RemoteBinding(clientBindUrl="sslsocket://0.0.0.0:3843", jndiBinding="TestDAOActionSSL"),
| @RemoteBinding(jndiBinding="TestDAOAction")
| })
| @Remote(TestDAO.class)
| @Local(TestDAO.class)
|
I have a StartClient class in a jar to connect remotly :
| public class StartClient {
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| // TODO Auto-generated method stub
| System.out.println("Test client");
|
| try {
|
| StartClient st = new StartClient();
| st.getInitialContext().lookup("TestDAOActionSSL");
|
| } catch (Exception e) {
| e.printStackTrace();
| } catch (Throwable e) {
| e.printStackTrace();
| }
| }
|
|
| public static Context getInitialContext()
| throws javax.naming.NamingException {
| Properties env = new Properties();
| env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
| env.put(Context.PROVIDER_URL, "jnp://localhost:3843");
| env.put(Context.SECURITY_PRINCIPAL, "test");
| env.put(Context.SECURITY_CREDENTIALS, "test");
| env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| return new InitialContext(env);
|
| }
| }
|
After deployment EJB is visible in JNDI. When I perform lookup remotly at test client I got following exception:
| 03:20:03,192 ERROR [SSLSocketServerInvoker] Failed to accept socket connection
| 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.createServerSocket(ServerThread.java:184)
| at org.jboss.remoting.transport.socket.ServerThread.<init>(ServerThread.java:86)
| at org.jboss.remoting.transport.socket.SocketServerInvoker.processInvocation(SocketServerInvoker.java:426)
| at org.jboss.remoting.transport.socket.SocketServerInvoker.run(SocketServerInvoker.java:388)
| at java.lang.Thread.run(Thread.java:613)
| Caused by: java.net.SocketTimeoutException: Read timed out
| at java.net.SocketInputStream.socketRead0(Native Method)
| at java.net.SocketInputStream.read(SocketInputStream.java:129)
| at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
| at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
| at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
| at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2213)
| at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2226)
| at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2694)
| at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761)
| at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
| at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.<init>(ObjectInputStreamWithClassLoader.java:73)
| at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.createInput(JavaSerializationManager.java:52)
| at org.jboss.remoting.transport.socket.ServerSocketWrapper.createInputStream(ServerSocketWrapper.java:56)
| at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:76)
| at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:54)
| at org.jboss.remoting.transport.socket.ServerSocketWrapper.<init>(ServerSocketWrapper.java:50)
|
Am I missing something?
regards
Fabrice
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110714#4110714
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110714
More information about the jboss-user
mailing list