-
1. Re: Local lookup failing
shinosha Jul 18, 2012 4:52 PM (in response to shinosha)Well, I used jnp-client-4.0.2.jar and it worked, but now I have Caused by: java.net.SocketTimeoutException: Receive timed out... I'd like to know what port is Jboss listening to but I can't find it on Jboss7. By the way, are my properties corrects ?
-
2. Re: Local lookup failing
wdfink Jul 19, 2012 6:39 AM (in response to shinosha)AS7 is different to former versions.
You should use the new ejb-client connections. See https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
-
3. Re: Local lookup failing
shinosha Jul 19, 2012 8:52 AM (in response to wdfink)So I put my properties file in my src folder of my .war and it looks like this :
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=127.0.0.1
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.username=Shinosha
remote.connection.default.password=*****
I of course have ejb-client.jar in my build path. But it's still asking me for an initial context :
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
What have I done wrong here ?
-
4. Re: Local lookup failing
shinosha Jul 20, 2012 10:58 AM (in response to shinosha)No one can help ? Is it even possible ?
-
5. Re: Local lookup failing
wdfink Jul 20, 2012 11:05 AM (in response to shinosha)Do you use a web-app as client? Is it deployed in a JBoss instance?
Also how your InitialContext looks like (what properties do you set) and how the properties are named?
-
6. Re: Local lookup failing
shinosha Jul 20, 2012 11:34 AM (in response to wdfink)Do you use a web-app as client? Is it deployed in a JBoss instance?
My .war contains the Service locator which does the lookup and the .jar my EJB stateless (no interface view)
Also how your InitialContext looks like (what properties do you set) and how the properties are named?
final Hashtable<String, String> jndiProperties = new Hashtable<String, String>();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
context = new InitialContext(jndiProperties);
Along with what I already said in my last post of course.
-
7. Re: Local lookup failing
jaikiran Jul 20, 2012 12:26 PM (in response to shinosha)You are using an incorrect JNDI name. You should be using ejb: namespace JNDI name. The article that Wolf pointed you to has the details. But before we go into that, I'm a bit confused about what you are trying to do. Your thread title says "Local lookup failing" but you are doing a lookup from a remote EJB client. You can't access local business interfaces from a remote client.
-
8. Re: Local lookup failing
shinosha Jul 21, 2012 9:05 AM (in response to jaikiran)I just have, on the same server, a jar with my business and a war that uses it. I would like my webapp to access my EJB. I'm confused about the terminology I guess.
You can't access local business interfaces from a remote client.
I just found this page... I understand better now but I already tried java:global actually but I got NoInitialContextException. That's why I tried remote access then, which was nonsense but I didn't realize it. From what I'm reading here I also need tobind my EJBs in my web.xml right ? Do you have a example because I don't really get what I'm supposed to write for an EJB. Thanks
-
9. Re: Local lookup failing
shinosha Jul 23, 2012 12:28 PM (in response to jaikiran)I changed my lookup to java:global and did not pass any parameter to the InitialContext constructor and still have the same thing from my TestNG class (NoInitialContextException). But when I do it from my action class in Struts 2 I get ClassCastException on my EJB... So I guess this is working somehow but I still have a problem regarding my tests and this ClassCastException. On the last one it seems it's due to my deployments and project structure but I can't solve the issue...
-
10. Re: Local lookup failing
wdfink Jul 24, 2012 4:46 AM (in response to shinosha)Do you pack the interface classes into both archives, that will force such ClassCastExecptions for the same class, as it is loaded by different classloaders.
You can drop the interface classes from your archive and provide it as a module.
Or you might use call-by-value instead of call-by-reference (in that case you use it global and you can not use local interfaces).
-
11. Re: Local lookup failing
shinosha Jul 24, 2012 8:19 AM (in response to wdfink)Since I'm all local, according to JEE6 I can adopt the no interface view for my EJB, which I did. So I don't have any interfaces. The only thing I have right now is my EJBs packaged in a jar in my war build path.
And I managed to make it work actually. Now I have an EJB module packaged as a jar inside my war project. And I only deployed the war on the server using the lookup with java:module/EJBname. Thanks for your help anyway.