[EJB 3.0] - EJB with SSL does not work with JBoss AS 4.2.2
by jthinaka
Hello,
I am trying to connect to my EJB via SSL and I have tried all the different approaches including the ones in the 4.2.2 administration guide as well as the JBoss Remoting guide and nothing seems to work. I would really appreciate any and all help in resolving this.
First, let me describe the error:
On the Client
anonymous wrote :
| 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.echo(Unknown Source)
| at SSLEJBClient.main(SSLEJBClient.java:22)
| Caused by: java.lang.reflect.InvocationTargetException
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
| at java.lang.reflect.Constructor.newInstance(Unknown Source)
| 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.echo(Unknown Source)
| at SSLEJBClient.main(SSLEJBClient.java:22)
| at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
| ... 10 more
| Caused by: java.net.SocketException: Socket Closed
| at java.net.PlainSocketImpl.setOption(Unknown Source)
| at java.net.Socket.setSoTimeout(Unknown Source)
| at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setSoTimeout(Unknown Source)
| 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.(ClientSocketWrapper.java:66)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
| at java.lang.reflect.Constructor.newInstance(Unknown Source)
| 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
|
>From the Server Side
| 12:25:31,367 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:513)
| 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:997)
| at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setSoTimeout(SSLSocketImpl.java:2047)
| 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)
|
My server side configuration looks like the following:
SSL-Service-xml
| <?xml version="1.0" encoding="UTF-8"?>
| <server>
| <mbean code="org.jboss.remoting.transport.Connector"
| name="jboss.remoting:service=Connector,transport=sslsocket"
| display-name="SSL Socket transport Connector">
| <attribute name="Configuration">
| <config>
| <invoker transport="sslsocket">
| <attribute name="dataType" isParam="true">invocation</attribute>
| <attribute name="marshaller" isParam="true">org.jboss.invocation.unified.marshall.InvocationMarshaller</attribute>
| <attribute name="unmarshaller" isParam="true">org.jboss.invocation.unified.marshall.InvocationUnMarshaller</attribute>
| <attribute name="numAcceptThreads">100</attribute>
| <attribute name="maxPoolSize">303</attribute>
| <attribute name="clientMaxPoolSize" isParam="true">304</attribute>
| <attribute name="socketTimeout" isParam="true">600000</attribute>
| <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
| <attribute name="serverBindPort">3843</attribute>
| <attribute name="clientConnectPort">7777</attribute>
| <attribute name="enableTcpNoDelay" isParam="true">true</attribute>
| </invoker>
| <handlers>
| <handler subsystem="invoker">jboss:service=invoker,type=unified</handler>
| </handlers>
| </config>
| </attribute>
| <depends>jboss.remoting:service=NetworkRegistry</depends>
| </mbean>
| <mbean code="org.jboss.remoting.security.SSLSocketBuilder"
| name="jboss.remoting:service=SocketBuilder,type=SSL"
| display-name="SSL Server Socket Factory Builder">
| <attribute name="UseSSLServerSocketFactory">true</attribute>
| <attribute name="KeyStoreURL">c:/java/jboss-4.2.2.GA/server/default/conf/example.keystore</attribute>
| <attribute name="KeyStorePassword">SomePassword</attribute>
| <attribute name="SecureSocketProtocol">TLS</attribute>
| <attribute name="KeyStoreType">JKS</attribute>
| </mbean>
| <mbean code="org.jboss.remoting.security.SSLServerSocketFactoryService"
| name="jboss.remoting:service=ServerSocketFactory,type=SSL"
| display-name="SSL Server Socket Factory">
| <depends optional-attribute-name="SSLSocketBuilder"
| proxy-type="attribute">jboss.remoting:service=SocketBuilder,type=SSL</depends>
| </mbean>
| </server>
|
My EJB is very simple, it has one method called echo (taken from the Jboss test suites). However, instead of using annotations, I used the jboss.xml configuration route as shown below:
| <?xml version="1.0" encoding="UTF-8"?>
| <jboss>
| <enterprise-beans>
| <session>
| <ejb-name>CallFireStatelessBean</ejb-name>
| <remote-binding>
| <jndi-name>CallFireStatelessBeanSSL</jndi-name>
| <client-bind-url>sslsocket://0.0.0.0:3843</client-bind-url>
| </remote-binding>
| </session>
| </enterprise-beans>
| </jboss>
|
My Client Code Looks like this:
| Properties props = System.getProperties();
| props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| props.setProperty("java.naming.provider.url", "localhost:1099");
| Context ctx = new InitialContext();
| Object obj = ctx.lookup("java:/CallFireStatelessBeanSSL");
| CallFireBusinessInterface cf = (CallFireBusinessInterface) obj;
| cf.echo("This works!");
|
To answer some possible questions:
| Yes, I can telnet into that port.
| 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 echo 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.6.
|
|
| As stated earlier, any and all help will be greatly appreciated.
| Regards,
| TJ
|
| -------------------------------
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133508#4133508
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133508
16 years, 10 months
[JBoss jBPM] - Creating new node
by mimiru
Hello all
I read the documentation at http://docs.jboss.com/jbpm/v3.2/userguide/html/. It mentions that nodetype node can have customized behavior when it comes to creating new execution paths in the form of a token, also this behavior must be programmed in an action handler.
The node behavior I want to create is when a token arrives, a new token is created and passed on to a leaving transition, the arrived token is passed over the default leaving transition (eventually i will be expanding this to allow for any number of new tokens and any number of leaving transitions).
token token
-----> [Split] -----> ...
| new token
\-----------> ... -> [end-state]
I implemented this in the execute method like this:
Token newToken = new Token(executionContext.getToken(), "split");
ExecutionContext newContext = new ExecutionContext(newToken);
executionContext.leaveNode();
newContext.leaveNode("split");
When I run the process I can see that the new tokens are produced and indeed arrive in the end state all seems to be in order as far as I can tell.
Except that calling JbpmContext.getGraphSession().deleteProcessInstance(theInstanceContainingSplitId) (this I use to remove the process from the database while testing) throws a database constraint exception on the foreign key for the token table. Is this because I am doing something wrong while producing the new tokens or is this some bug?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133506#4133506
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133506
16 years, 10 months
[JBoss Messaging] - having problems getting started with JMS in JBoss 5 Beta 4
by rexer
Hi,
I'm a newbie trying to get messaging to work in the jboss 5 beta 4. Having some problems which I tried to google-up and getting nowhere. Any hints from you folks are much appreciated.
I modified destinations-service.xml to include my test queue definition.
| <mbean code="org.jboss.jms.server.destination.QueueService"
| name="jboss.messaging.destination:service=Queue,name=testQueue"
| xmbean-dd="xmdesc/Queue-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">
| jboss.messaging:service=ServerPeer
| </depends>
| <depends>jboss.messaging:service=PostOffice</depends>
| <attribute name="SecurityConfig">
| <security>
| <role name="guest" read="true" write="true"/>
| <role name="publisher" read="true" write="true" create="false"/>
| <role name="noacc" read="false" write="false" create="false"/>
| </security>
| </attribute>
| </mbean>
|
When I start jboss I see correctly that the queue is created:
| 13:59:48,548 INFO [QueueService] Queue[/queue/testQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
|
I used NetBeans 6.0.1 to create EJB app. I added an MDB using the wizard and connected to to queue 'queue/testQueue'.
My jboss.xml is:
| <jboss>
| <enterprise-beans>
| <message-driven>
| <ejb-name>NewMessageBean</ejb-name>
| <jndi-name>NewMessageBean</jndi-name>
| <destination-jndi-name>queue/testQueue</destination-jndi-name>
| </message-driven>
| </enterprise-beans>
| </jboss>
|
the ejb-jar.xml is:
| <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
| <enterprise-beans>
| <message-driven>
| <display-name>NewMessageMDB</display-name>
| <ejb-name>NewMessageBean</ejb-name>
| <ejb-class>org.rex.NewMessageBean</ejb-class>
| <transaction-type>Container</transaction-type>
| <message-destination-type>javax.jms.Queue</message-destination-type>
| <message-destination-link>testQueue</message-destination-link>
| <activation-config>
| <activation-config-property>
| <activation-config-property-name>acknowledgeMode</activation-config-property-name>
| <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>destinationType</activation-config-property-name>
| <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
| </activation-config-property>
| </activation-config>
| </message-driven>
| </enterprise-beans>
| <assembly-descriptor>
| <container-transaction>
| <method>
| <ejb-name>NewMessageBean</ejb-name>
| <method-name>*</method-name>
| </method>
| <trans-attribute>Required</trans-attribute>
| </container-transaction>
| <message-destination>
| <display-name>Destination for NewMessageMDB</display-name>
| <message-destination-name>testQueue</message-destination-name>
| </message-destination>
| </assembly-descriptor>
| </ejb-jar>
|
Looks like NetBeans is not yet compatible with jboss 5: you can't register servers (domain drop-down ends up being empty) and so you can't do deployments from NetBeans. So here is what I did to manually deploy my test app: I build the .jar and put it under server/default/deploy and I see the server starting the deployment. I see the exception shown below and that's where I am getting stuck:
exception: jndi-name not found as a child of message-driven
details:
| 15:19:51,173 ERROR [AbstractKernelController] Error installing to Parse: name=vfsfile:/usr/local/jboss-5.0.0.Beta4/server/default/deploy/Test1-ejb.jar state=Not Installed m
| ode=Manual requiredState=Parse
| org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/usr/local/jboss-5.0.0.Beta4/server/default/deploy/Test1-ejb.jar
| .........
| 15:19:51,242 WARN [HDScanner] Failed to process changes
| org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| *** CONTEXTS IN ERROR: Name -> Error
|
| vfsfile:/usr/local/jboss-5.0.0.Beta4/server/default/deploy/Test1-ejb.jar -> org.jboss.xb.binding.JBossXBRuntimeException: jndi-name not found as a child of message-driven
|
|
| at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
| at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
| at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291)
| at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
| at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
| at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
| at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
| at java.lang.Thread.run(Thread.java:619)
|
If I remove jndi-name element from jboss.xml (I added it after NetBeans MDB wizard), I get following error during deployment:
| jboss.j2ee:binding=message-driven-bean,jndiName=local/NewMessageBean@24490290,plugin=invoker,service=EJB -> org.jboss.deployment.DeploymentException: The message-destination 'testQueue' has no jndi-name in jboss.xml
|
So it seems I'm providing wrong jndi-name which for some reason is a required param in Jboss 5. Perhaps the jndi-name is correct but my NewMessageBean class is somenow not compliant with something. I wonder if this has anything to do with differences between JBoss MQ and Jboss Messaging. I suspect NetBeans generated the code and config files targeted for JBoss MQ.
My MDB class head is:
public class NewMessageBean implements MessageDrivenBean, MessageListener { ...
I'm new to enterprise beans in general so I'm sorry if I'm missing something obvious.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133504#4133504
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133504
16 years, 10 months