Hi,
ich habe jetzt JBoss soweit eingerichtet, dass RMI über Http funktioniert.
Zu mindest funktioniert der lookup().
Ich bekomm auch mein RemoteInterface vom Bean übergeben. Leider kann ich keine Methode aufrufen. Zu mindest bleibt er dort hängen ohne Fehlermeldung.
Was ich im Debug gesehen habe , ist das in den ejbMetaData LocatorUrl auf sockect://0.0.0.0:3873 steht.
Damit ist klar warum, ein externer Client die Methode vom Bean (getName())nicht aufrufen kann.
Wenn ich jetzt, laut Doku, in der Annotation @RemoteBinding
clientBindUrl="http://xxxxx.dyndns.org:8080" eintrage, bekomm ich folgende Fehlermeldung
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to org.jboss.aop.joinpoint.InvocationResponse
at org.jboss.aspects.remoting.InvokeRemoteInterceptor .invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationIntercepto r.invoke(ClientTxPropagationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientIntercept or.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke( IsLocalInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invo ke(StatelessRemoteProxy.java:107)
at $Proxy1.getName(Unknown Source)
Die Beanmethode getName() liefert ein String zurück.
Was fehlt mir hier schon wieder. Es muß doch mal möglich sein, dass ein externer Client Methode von einem Bean aufrufen kann.
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
props.setProperty(Context.PROVIDER_URL, "http://"+ChildrenData.this.tf_server.getText()+":"+Childr enData.this.tf_port.getText()+"/invoker/JNDIFactory");
props.setProperty("j2ee.clientName", "KitaEEClient");
InitialContext ctx;
try
{
ctx = new InitialContext(props);
Test remote = (Test) ctx.lookup("KitaEE/beans/TestBean");
textArea.append(remote.toString());
textField.setText(remote.getName());
// remote.create();
} catch (NamingException ex)
{
// TODO Auto-generated catch block
ex.printStackTrace();
}
ich habe jetzt JBoss soweit eingerichtet, dass RMI über Http funktioniert.
Zu mindest funktioniert der lookup().
Ich bekomm auch mein RemoteInterface vom Bean übergeben. Leider kann ich keine Methode aufrufen. Zu mindest bleibt er dort hängen ohne Fehlermeldung.
Was ich im Debug gesehen habe , ist das in den ejbMetaData LocatorUrl auf sockect://0.0.0.0:3873 steht.
Damit ist klar warum, ein externer Client die Methode vom Bean (getName())nicht aufrufen kann.
Wenn ich jetzt, laut Doku, in der Annotation @RemoteBinding
clientBindUrl="http://xxxxx.dyndns.org:8080" eintrage, bekomm ich folgende Fehlermeldung
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to org.jboss.aop.joinpoint.InvocationResponse
at org.jboss.aspects.remoting.InvokeRemoteInterceptor .invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationIntercepto r.invoke(ClientTxPropagationInterceptor.java:67)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientIntercept or.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke( IsLocalInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invo ke(StatelessRemoteProxy.java:107)
at $Proxy1.getName(Unknown Source)
Die Beanmethode getName() liefert ein String zurück.
Was fehlt mir hier schon wieder. Es muß doch mal möglich sein, dass ein externer Client Methode von einem Bean aufrufen kann.
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
props.setProperty(Context.PROVIDER_URL, "http://"+ChildrenData.this.tf_server.getText()+":"+Childr enData.this.tf_port.getText()+"/invoker/JNDIFactory");
props.setProperty("j2ee.clientName", "KitaEEClient");
InitialContext ctx;
try
{
ctx = new InitialContext(props);
Test remote = (Test) ctx.lookup("KitaEE/beans/TestBean");
textArea.append(remote.toString());
textField.setText(remote.getName());
// remote.create();
} catch (NamingException ex)
{
// TODO Auto-generated catch block
ex.printStackTrace();
}