File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Problem accessing session bean return value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem accessing session bean return value" Watch "Problem accessing session bean return value" New topic
Author

Problem accessing session bean return value

Samson Mlati
Ranch Hand

Joined: Feb 23, 2009
Posts: 41

Hi,

I have written an EJB module that accesses a database and retrieves a record. I want to pass this record back as an object to the client, a jsp page. The ejb module session bean works fine and retrieves data. However on the client side I can't get stuff out of the object i returned by the session bean method. I get the error below

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "com/jjpeople/db/FlightProfile"
org.apache.jsp.client_jsp._jspService(client_jsp.java:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


What does this error mean? How do i pass a bean back to the client? I'm using jboss and ejb 2.0.

Heres how my jsp client.. the error line is highlighted

<%

FlightInfoHome home=null;

String name = "";


System.out.println("-> init()");

Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");

try {
// Obtain the JNDI initial context.
Context ctx = new InitialContext(env);
// Get a reference to the home object.
Object obj = ctx.lookup("ejb/FlightInfo");
// Cast the RMI-IIOP object.
home = (FlightInfoHome) PortableRemoteObject.narrow(obj,
FlightInfoHome.class);
} catch (Exception e) {
e.printStackTrace();
}

try {


System.out.println(" -> Creating Flight Info!");

FlightInfoRemote obj = home.create();

FlightProfile p = (FlightProfile)obj.inquiry("162");

out.println(p.toString());

if(p == null){

System.out.println("NULL OBJECT");
out.println("Null object");
}

else {System.out.println("NOT NULL");
out.println("Not null...");
}

// System.out.println("Finished invoking..");
// String to = p.getTo();
// System.out.println(to);



} catch (RemoteException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

%>
Thanks


Best,
Mlati
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem accessing session bean return value
 
Similar Threads
unable to run ejb client
Exception accessing Local EJB
New to EJB
NamingException
Problem calling EJB deployed on websphere from Java Client