-
1. Re: Calling JBoss 3.2.3 from standalone Tomcat
juha May 18, 2004 12:43 PM (in response to damonrand)Are you sure your web-app is seeing the JBoss client/ libs? If it's not finding the J2EE interfaces then it is probably not finding much anything else either.
-
2. Re: Calling JBoss 3.2.3 from standalone Tomcat
raja05 May 18, 2004 2:45 PM (in response to damonrand)Can you try removing the ejb-link? Anyway you are not in-VM to use the ejb-link feature!
-
3. Re: Calling JBoss 3.2.3 from standalone Tomcat
ricardoarguello May 18, 2004 3:23 PM (in response to damonrand)You don't have to copy ALL the jars!
You just need jboss-3.2.3/client/jbossall-client.jar, but copy it in WEB-INF/lib, not in %JRE_HOME%/lib/ext
Ricardo Arguello -
4. Re: Calling JBoss 3.2.3 from standalone Tomcat
damonrand May 19, 2004 6:56 AM (in response to damonrand)Thanks for the replies everyone,
I returned my JDK/Tomcat to a default environment and copied jbossall-client.jar into the WEB-INF lib along with my helloworld-service.jar. I removed the <ejb-link/> tag so I have..
<ejb-ref>
Test EJB connection
<ejb-ref-name>ejb/HelloWorld</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
org.service.helloworld.server.facade.interfaces.HelloWorldRemoteHome
org.service.helloworld.server.facade.interfaces.HelloWorldRemote
</ejb-ref>
And modified jndi.properties to be
java.naming.factory.url.pkgs=org.apache.naming:org.jnp.interfaces
java.naming.provider.url=jnp://server:1099
Now I am getting a different error:
class javax.naming.NameNotFoundException: org.service.helloworld.server.facade.ejb.HelloWorld not bound
I have connected to the EJB server with jndiexplorer and confirmed the JNDI path. An ethereal packet traces show that no connection is made to the EJB server though.
Am I missing anything else?
Regards,
Damon. -
5. Re: Calling JBoss 3.2.3 from standalone Tomcat
damonrand May 19, 2004 7:05 AM (in response to damonrand)Oops, was using the apache naming factory, not the jboss one.. Now I have this in jndi.properties.
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://server:1099
And am getting this error message..
class javax.naming.NamingException: Cannot create resource instance
Regards,
Damon. -
6. Re: Calling JBoss 3.2.3 from standalone Tomcat
gorano May 19, 2004 8:58 AM (in response to damonrand)If you used the default settings when you installed Tomcat it added a space in the path to Tomcat.
Get rid of this space if you have it, otherwise it won't work.
/Goran -
7. Re: Calling JBoss 3.2.3 from standalone Tomcat
ricardoarguello May 20, 2004 9:43 AM (in response to damonrand)You are probably using Tomcat's embedded JNDI server without knowing it!
Read this:
http://www.amitysolutions.com.au/documents/JBossTomcatJNDI-technote.pdf
You might start Tomcat with the "-nonaming" option to disable their JNDI server.
Or you could programatically create an InitialContext with properties pointing to your EJB server... this is hardcoded and sucks.
Ricardo Arguello -
8. Re: Calling JBoss 3.2.3 from standalone Tomcat
damonrand May 20, 2004 6:31 PM (in response to damonrand)Thanks,
I don't want to mess around with -nonaming, sounds too brutal a solution to me..
The amity article looks to be exactly what I need. I'll give that a try tomorrow.. I found org.apache.naming.factory.EjbFactory in the Tomcat source but looking at the code it seems to use a hardcoded reference to a specific (non-jboss) factory class.. Pity there is no org.apache.naming.factory.GenericEjbFactory with Tomcat yet.
Once again, thanks for your help.
Regards,
Damon. -
9. TOMCAT + JBOSS - CALLING EJB IN A JBOSS FROM A EXTERNAL TOMC
borysmarcelo Mar 22, 2006 4:22 PM (in response to damonrand)Hello guy´s.
For a cups of days I´ve been trying to lookup an ejb in a Jboss Server from a Tomcat 5.x. I tried a lot of solutions, that with the inside a contex too, and I realized that nothing work at all.
So, I did the obvious...
I unistalled the tomcat from my computer. Instaled Again in a directory called D:\Tomcat
Put my application inside the webapps.
And called EJB in the normal classic way!... And works for me. The trick is that in a Windows OS, the tomcat instalation home had a blank spaces in the name of the path. i.e - c:\Program Files\Apache Software Foundation\Tomcat 5.5\....
so, this blank spaces do not let the initial context to initialized de properties wrigth.
BoryS
My CODE:package br.gov.tresp.servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.Properties; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.fiap.hello.ejb.Hello; import com.fiap.hello.ejb.HelloHome; import com.fiap.hello.ejb.Pessoa; public class Cliente extends HttpServlet { /** * */ private static final long serialVersionUID = -2896402595743969746L; protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { // TODO Auto-generated method stub this.doPost(arg0, arg1); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub Properties props = new Properties(); props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); props.setProperty("java.naming.provider.url", "localhost:1099"); props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming"); try { InitialContext context = new InitialContext(props); Object objref = context.lookup("ejb/HelloHome"); //Object objref = new InitialContext().lookup("java:comp/env/bean/Locator"); HelloHome home = (HelloHome)PortableRemoteObject.narrow(objref, HelloHome.class); System.out.println(home); Hello hello = home.create(); Pessoa p = new Pessoa(); p.setNome("Borys Marcelo"); p.setIdade(24); hello.meMostra(p); } catch (Exception e){ e.printStackTrace(); PrintWriter out = response.getWriter(); StackTraceElement[] elements = e.getStackTrace(); e.printStackTrace(out); out.print(e.getMessage()); } } }
Don´t need nothing more in the WEB.xml neither in a Context.xml