File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Invoke Ejb from Tomcat 4.1.18 in JBoss 3.0.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Invoke Ejb from Tomcat 4.1.18 in JBoss 3.0.4" Watch "Invoke Ejb from Tomcat 4.1.18 in JBoss 3.0.4" New topic
Author

Invoke Ejb from Tomcat 4.1.18 in JBoss 3.0.4

Javier Huerta
Greenhorn

Joined: Apr 29, 2003
Posts: 5
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
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Originally posted by Javier Huerta:
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.....

well.. this is not exactly an answer but a suggestion. Jboss comes bundle with tomcat or jetty, so you don't need them separarate as you mentioned. This approach might ease your development. I've worked with Jboss 3.0.4 bundled with tomcat with no problems. Put my EAR file (WAR files -if i have a web app- and JAR's) and deploy it into jboss.
my $0.02
HTH


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoke Ejb from Tomcat 4.1.18 in JBoss 3.0.4