Invoking invocation handler located on JBoss AS
thejavafreak Apr 17, 2008 5:15 AMDear all,
I have deployed an invocation handler and deployed it on JBoss AS 5.0.0Beta4 by inserting the configuration inside conf/jboss-service.xml as such:
<mbean code="org.jboss.remoting.transport.Connector" name="jboss.remoting:service=IVRConnector,transport=Socket" display-name="Socket transport Connector"> <!-- Can either just specify the InvokerLocator attribute and not the invoker element in the --> <!-- Configuration attribute, or do the full invoker configuration in the in invoker element --> <!-- of the Configuration attribute. --> <!-- Remember that if you do use more than one param on the uri, will have to include as a CDATA, --> <!-- otherwise, parser will complain. --> <attribute name="InvokerLocator"><![CDATA[socket://${jboss.bind.address}:6666/]]></attribute> <attribute name="Configuration"> <config> <!-- Other than transport type and handler, none of these configurations are required (will just use defaults). --> <invoker transport="socket"> <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> <!-- The following are specific to socket invoker --> <attribute name="numAcceptThreads">1</attribute> <attribute name="maxPoolSize">303</attribute> <attribute name="clientMaxPoolSize" isParam="true">304</attribute> <attribute name="socketTimeout">60000</attribute> <!-- To set socketTimeout on client as well, add "isParam" --> <!--<attribute name="socketTimeout" isParam="true">60000</attribute>--> <attribute name="serverBindAddress">${jboss.bind.address}</attribute> <attribute name="serverBindPort">6666</attribute> <attribute name="clientConnectAddress" isParam="true">${jboss.bind.address}</attribute> <attribute name="clientConnectPort" isParam="true">6666</attribute> <attribute name="enableTcpNoDelay" isParam="true">true</attribute> <attribute name="backlog">200</attribute> <!-- The following is for callback configuration and is independent of invoker type --> <attribute name="callbackMemCeiling">30</attribute> <!-- indicates callback store by fully qualified class name --> <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute> <!-- indicates callback store by object name --> <!-- <attribute name="callbackStore">jboss.remoting:service=CallbackStore,type=Serializable</attribute> --> <!-- config params for callback store. if were declaring callback store via object name, --> <!-- could have specified these config params there. --> <!-- StoreFilePath indicates to which directory to write the callback objects. --> <!-- The default value is the property value of 'jboss.server.data.dir' and if this is not set, --> <!-- then will be 'data'. Will then append 'remoting' and the callback client's session id. --> <!-- An example would be 'data\remoting\5c4o05l-9jijyx-e5b6xyph-1-e5b6xyph-2'. --> <attribute name="StoreFilePath">callback</attribute> <!-- StoreFileSuffix indicates the file suffix to use for the callback objects written to disk. --> <!-- The default value is ser. --> <attribute name="StoreFileSuffix">cst</attribute> <!-- Sets the callback error handler to use when determining how to manage failed push callbacks --> <!-- When not specified, the default is org.jboss.remoting.callback.DefaultCallbackErrorHandler --> <!-- <attribute name="callbackErrorHandler">org.jboss.remoting.callback.DefaultCallbackErrorHandler</attribute> --> </invoker> <!-- At least one handler is required by the connector. If have more than one, must declare --> <!-- different subsystem values. Otherwise, all invocations will be routed to the only one --> <!-- that is declared. --> <handlers> <!-- specify handler by fully qualified classname --> <handler subsystem="ivr">com.taxandtech.lab.remoting.SimpleInvocationHandler</handler> <!-- can also specify handler by object name --> <!-- <handler subsystem="mock">test:type=handler</handler> --> </handlers> </config> </attribute> <depends>jboss.remoting:service=NetworkRegistry</depends> </mbean>
But when I access it from client I get this stacktrace error:
org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://127.0.0.1:6666/] at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:530) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122) at org.jboss.remoting.Client.invoke(Client.java:1550) at org.jboss.remoting.Client.invoke(Client.java:530) at org.jboss.remoting.Client.invoke(Client.java:518) at com.taxandtech.lab.remoting.SimpleClient.makeInvocation(SimpleClient.java:26) at com.taxandtech.lab.remoting.SimpleClient.main(SimpleClient.java:47) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Caused by: java.net.SocketException: Software caused connection abort: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:187) at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:801) at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:526) ... 11 more
It said that it can not connect to the server, but I can see the MBean from the JMX Console. Why could this occur? On the other hand if I call the jboss.remoting:service=Connector, it will succeed and does not produce the same stacktrace. Could anyone guide me on this? I would really like to use the jboss-remoting on JBoss AS.
Thank you in advance