This JSP it's locate on a Tomcat Server, it must to access an EJB
that reside on another machine with OpenEJB.
When I run it Tomcat show the error
> org.apache.jasper.JasperException: Unable to compile class for JSP
> package empleados does not exist import empleados.Employee;
Of course I know that my interfaces aren't founded, but It's fine
put these on WEB-INF/lib of my webapp ? or I only need the conection
with JNDI ?
See ya
Juan Wagner
<[EMAIL PROTECTED] import="employee.Employee,
employee.EmployeeHome,
javax.naming.InitialContext,
javax.naming.Context,
javax.rmi.PortableRemoteObject,
java.util.Properties"%>
<html>
<head><title>Using a remote EJB from a JSP file (Tomcat4)</title></head>
<body>
EmployeeBean says:
<% Properties env = new Properties();
//The JNDI properties you set depend on which server you are using.
String jndiProvider = "org.openejb.client.RemoteInitialContextFactory";
env.put( "java.naming.factory.initial", jndiProvider );
env.put( "java.naming.provider.url", "MACHINE IP:4201" ); <<<<<
env.put( "java.naming.security.principal", "myuser" );
env.put( "java.naming.security.credentials", "mypass" );
Context ctx = new InitialContext( env );
Object obj = ctx.lookup( "EmployeeBean" ); // EJB on remote OpenEJB
obj = PortableRemoteObject.narrow( obj, EmployeeHome.class );
EmployeeHome home = ( EmployeeHome ) obj;
Employee empl_create= home.create("John","Looking","[EMAIL PROTECTED]" );
Integer primaryKey = ( Integer ) empl_create.getPrimaryKey();
Employee empl_find = home.findByPrimaryKey( primaryKey );
%>
Do I got something here ? <%= empl_create.isIdentical( empl_find ) %>
<br>
<font color=GREEN>
<%= empl_find.says( "Response from EmployeeBean!!" ) %>
</font>
// empl_find.remove();
</body></html>
Mensaje citado por [EMAIL PROTECTED]:
>
>
> Hi, I hope somebody give some tip...
> I have a JSP Container (tomcat4) and de business components on a diferent
> machine with OpenEJB, do I have to use OpenEJB on the Tomcat machine or can
> I
> use JNDI to access and use my remote EJB ?
>
> Some example?
>
> Thanks
> Juan Wagner
>
>
>
>