Fred:

Sorry about that. Actually, the JNDI name "PersonBean" is bound correctly.
The file breakdown is simplified... Your suggestion is a good one. However,
I am concerned I will get the same error if I deal with a Session bean
instead than with an Entity bean. For some reason, if I add the
ClientJAR.jar to the Tomcat lib directory everything works fine...

Felix

-----Original Message-----
From: Fred Loney [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 25, 2001 4:04 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [JBoss-user] CommunicationException in JSP to EJB
communication


The jndi name "PersonBean" is bound to a com.munoz.concept.person.PersonHome
rather than a com.munoz.ejb.person.PersonHome. Perhaps a build problem?

It is preferable to insulate JSP from EJB. Wrap the Entity EJB calls in a
Session EJB. Wrap the Session EJB in a bean. Call the bean from the JSP.
Remove the EJB classes from the war. Cf. Sun J2EE blueprints for examples.

--
Fred Loney
Enterprise Java Consultant
Spirited Software, Inc.
[EMAIL PROTECTED]

Felix Munoz wrote:

> Hi:
>
> I have been trying to implement a simple JSP to EJB communication test
from
> an EAR file deployed on JBoss/Tomcat but I have been unsuccessful.
>
> This is the EAR file breakdown:
>
> TestEAR.ear
> ----application.xml
> ----TestWAR.war
> --------WEB-INF
> ------------lib
> ----------------ClientJAR.jar
> --------------------com
> ------------------------munoz
> ----------------------------ejb
> --------------------------------Person.class
> --------------------------------PersonBean.class
> --------------------------------PersonHome.class
> ------------web.xml
> --------ejbTest.jsp
>
> ----TestJAR.jar
> --------META-INF
> ------------ejb-jar.xml
> --------com
> ------------munoz
> ----------------ejb
> --------------------Person.class
> --------------------PersonBean.class
> --------------------PersonHome.class
>
> In the JSP I am making the following call:
>
>     Context initialContext = new InitialContext();
>     Object personHome = null;
>
>     try
>     {
>         personHome = initialContext.lookup("PersonBean");
>         if (personHome == null)
>         {
>             out.println("PersonHome is null");
>         }
>         else
>         {
>             out.println("Success!");
>         }
>     }
>     catch (Exception exception)
>     {
>         System.out.println(exception);
>         out.println(exception);
>         exception.printStackTrace(System.out);
>     }
>
> The page compiles correctly, but when I call it, I get back the following
> exception:
>
> [EmbeddedTomcat] javax.naming.CommunicationException [Root exception is
> java.lang.ClassNotFoundException: com.munoz.concept.person.PersonHome]
> javax.naming.CommunicationException.  Root exception is [EmbeddedTomcat]
> java.lang.ClassNotFoundException: com.munoz.concept.person.PersonHome
> [EmbeddedTomcat]        at
> javax.management.loading.MLet.findClass(MLet.java:800)
> [EmbeddedTomcat]        at java.lang.ClassLoader.loadClass(Unknown Source)
> [EmbeddedTomcat]        at java.lang.ClassLoader.loadClass(Unknown Source)
> [EmbeddedTomcat]        at java.lang.ClassLoader.loadClassInternal(Unknown
> Source)
> [EmbeddedTomcat]        at java.lang.Class.forName0(Native Method)
> [EmbeddedTomcat]        at java.lang.Class.forName(Unknown Source)
> [EmbeddedTomcat]        at
> sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
> [EmbeddedTomcat]        at
> java.io.ObjectInputStream.inputProxyClassDescriptor(Unknown Source)
> [EmbeddedTomcat]        at java.io.ObjectInputStream.readObject(Unknown
> Source)
> [EmbeddedTomcat]        at java.io.ObjectInputStream.readObject(Unknown
> Source)
> [EmbeddedTomcat]        at java.io.ObjectInputStream.inputObject(Unknown
> Source)
> [EmbeddedTomcat]        at java.io.ObjectInputStream.readObject(Unknown
> Source)
> [EmbeddedTomcat]        at java.io.ObjectInputStream.readObject(Unknown
> Source)
> [EmbeddedTomcat]        at java.rmi.MarshalledObject.get(Unknown Source)
> [EmbeddedTomcat]        at
> org.jnp.interfaces.NamingContext.lookup(NamingContext.java:299)
> [EmbeddedTomcat]        at
> org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
> [EmbeddedTomcat]        at javax.naming.InitialContext.lookup(Unknown
> Source)
> [EmbeddedTomcat]        at
>
_0002fejbTest_0002ejspejbTest_jsp_21._jspService(_0002fejbTest_0002ejspejbTe
> st_jsp_21.java:71)
> [EmbeddedTomcat]        at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> [EmbeddedTomcat]        at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> [EmbeddedTomcat]        at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:177)
> [EmbeddedTomcat]        at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
> [EmbeddedTomcat]        at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> [EmbeddedTomcat]        at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> [EmbeddedTomcat]        at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
> [EmbeddedTomcat]        at
> org.apache.tomcat.core.Handler.service(Handler.java:286)
> [EmbeddedTomcat]        at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> [EmbeddedTomcat]        at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7)
> [EmbeddedTomcat]        at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> [EmbeddedTomcat]        at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:210)
> [EmbeddedTomcat]        at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> [EmbeddedTomcat]        at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
> [EmbeddedTomcat]        at java.lang.Thread.run(Unknown Source)
>
> My confusion comes from the fact that the JSP compiles even though I am
> importing com.munoz.ejb.PersonHome, meaning that the class can be found at
> compile time, but the class cannot be found on runtime. Any ideas?

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to