Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem running enity bean from one Jsp over Tomcat 4.1.18 with JBoss 3.0.4

 
Javier Huerta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have the next problem.
i am programming an application for the Web,
i installed tomcat 4.1.18 and Jboss 3.0.4 separately.
i have the structure
WEB-INF/classes/com
i put my home and remote interfaces
WEB-INF/lib
i have the jar file necessary for the apllication (Postgres driver.)
i have my jsp's in /webapps/com/jsp
configured in web.xml

in my jsp i can't invoke the entity bean via jndi
with Jboss, i have all files necessarys from Jboss
client in tomcat/common/lib
jboos-j2ee.jar
jmx-connector-client-factory.jar
and others.
i have the next code in my jsp.
<%
import="javax.rmi.PortableRemoteObject"
import="javax.naming.InitialContext"
import="java.util.Hashtable"
import="javax.naming.Context"
%>
<%
NodosRemoteHome remoteHome = null;
NodosRemote peticion = null;
Object ref = null;
Context jndiContext = null;
String error = "";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL,"147.15.80.121:1099");
env.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");
try {
jndiContext = new InitialContext(env);
error += " Got Context";
} catch (Exception e) {
error += "Not Got Context - " + e;
}
try {
ref = jndiContext.lookup("NodosBean");
error += " Got Reference() ref -> " + ref + ";
} catch (Exception e1) {
error += "Not Got Reference() " + e1;
}
try {
remoteHome = (NodosRemoteHome) PortableRemoteObject.narrow(
ref, NodosRemoteHome.class);
error += "Succesfull: " + remoteHome;
} catch (Exception e2) {
error += " i'cant invoke object - " + e2;
}
these are results
Got Context()
Got Reference()[ ref -> NodosBeanHome ]
i'cant invoke object java.lang.ClassCastException

please help me what's wrong.
and please guide me with all neccesary between Tomcat and Jboss communication
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic