This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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
 
GeeCON Prague 2014
 
subject: Problem accessing session bean return value