-
1. Re: RMI-IIOP
one_special_user Aug 2, 2006 5:30 AM (in response to one_special_user)Hm propbably I should rephrase it:
Binding the current Instance of MySession seems to bind a RMI-Stub to the JNDI: "mypackage.mysession._MySession_Stub"...
And it's basically bound to "mysessions/mysessionid_123".
If I state context.rebind( "iiop/mysessions/" + mysessionid, ms ) I cannot look it up by my Java-Client neither via JRMP nor via IIOP ( always get a javax.naming.CommunicationException) ...
How to obtain an InitialReference not for JRMP but for IIOP, but not using Properties for the constructor? -
2. Re: RMI-IIOP
one_special_user Aug 2, 2006 7:04 AM (in response to one_special_user)It's me ... again :-)
Ok, i tried a different approach.
I've got a SessionBean A and a SessionBean B.
Have to use IIOP as stated above.
My ejb-jar.xml looks as follows:<?xml version="1.0" encoding="UTF-8"?> <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"> <display-name>MyStuff-ejb</display-name> <enterprise-beans> <session> <display-name>B</display-name> <ejb-name>B</ejb-name> <home>mypkg.BHome</home> <remote>mypkg.B</remote> <ejb-class>mypkg.BBean</ejb-class> <session-type>Stateful</session-type> <transaction-type>Container</transaction-type> </session> <session> <display-name>A</display-name> <ejb-name>A</ejb-name> <home>mypkg.AHome</home> <remote>mypkg.A</remote> <ejb-class>mypkg.ABean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-ref> <ejb-ref-name>ejb/A</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>mypkg.AHome</home> <remote>mypkg.A</remote> <ejb-link>A</ejb-link> </ejb-ref> </session> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>B</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>A</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar>
My jboss.xml looks as follows:<?xml version="1.0" encoding="UTF-8"?> <jboss> <enterprise-beans> <session> <ejb-name>A</ejb-name> <jndi-name>mystuff/A</jndi-name> <invoker-bindings> <invoker> <invoker-proxy-binding-name>iiop</invoker-proxy-binding-name> </invoker> </invoker-bindings> </session> <session> <ejb-name>B</ejb-name> <jndi-name>mystuff/B</jndi-name> <invoker-bindings> <invoker> <invoker-proxy-binding-name>iiop</invoker-proxy-binding-name> </invoker> </invoker-bindings> </session> </enterprise-beans> </jboss>
A makes use of B, so i have to look it up in order to invoke.
In ABean, I've tried to look up B via
Context ctx = new InitialContext()
followed by either
"ctx.lookup("java:comp/env/ejb/VFMSession")" or "ctx.lookup( "mystuff/B" )", but none works.
How to get a reference to BHome??!
Should I change my jndi.properties?java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces #java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-
3. Re: RMI-IIOP
one_special_user Aug 2, 2006 11:03 AM (in response to one_special_user)Ok, the status so far:
My C#-Client can lookup the SessionBeans and invoke them.
But I just don't get any Java-Client to retrieve any SessionBean.
Nevertheless, JNDIView states all EJBs are bound to right JNDI-Names.
Now I'm already getting a reference at the clientside, but narrowing causes a NullPointerException:public static Properties getJBOSSProperties() { Properties props = new Properties(); String factoryName = "org.jnp.interfaces.NamingContextFactory"; String providerURL = "iiop://localhost:2255"; String factoryPkgs = "org.jboss.naming:org.jnp.interfaces"; props.put(Context.INITIAL_CONTEXT_FACTORY, factoryName); props.put(Context.PROVIDER_URL, providerURL); props.put(Context.URL_PKG_PREFIXES, factoryPkgs); return props; } ... Properties props = getJBOSSProperties(); Context ctx = new InitialContext( props ); System.out.println( "Got InitialContext!" ); // some other SessionBeans-Names, but doesn't matter // String jndi = "vfmcontroller/VFMController"; Object obj_ref = ctx.lookup( jndi ); System.out.println( "Got Reference: " + jndi ); System.out.println( "Class: " + obj_ref.getClass() ); VFMControllerHome home = (VFMControllerHome)PortableRemoteObject.narrow( obj_ref, VFMControllerHome.class ); VFMController controller = home.create(); System.out.println( "Got VFMController: " + controller.getTime() );
StackTrace:Got InitialContext! log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext). log4j:WARN Please initialize the log4j system properly. Got Reference: vfmcontroller/VFMController Class: class org.omg.stub.javax.ejb._EJBHome_Stub Exception in thread "main" java.lang.NullPointerException at test.TestKlasse.main(TestKlasse.java:93)
I've tried all combinations of Properties (INITIAL_CONTEXT_FACTORY, PROVIDER_URL, URL_PKG_PREFIXES) with corresponding values and I think i have included all clientside-necessary JARs (jbossall-client.jar etc).
WHAT AM I DOING WRONG?
I've searched the web and found all just the same but no solution works for me.
Please tell me, which jar's to be included (serverside/clientside) or specific configurations which might cause problems... :-/