Once again, I am having a very bad day (actually bad week!) trying to
get an EJB deployed in a test environment. Y'all were so helpful
roughly a year ago, with a similar albeit J-Boss issue, that I figured
I would impose again and ask for more help. I'm sure, as before, it's
my dumb mistake.
I'm trying to deploy what I again thought was a simple EJB to a
OpenEJB server running with Tomcat.
Using the files below, I get the messages below when I copy the JAR
file to the deployment directory.
I am trying to configure Tomcat 5.0 and OpenEJB together on Windows
2000. I have been following the instructions at this URL:
http://www.onjava.com/pub/a/onjava/2003/02/12/ejb_tomcat.html?page=1
I have the following relevant environment variables set:
CLASSPATH=.;C:\j2sdk1.4.2_04\lib\tools.jar;C:\j2sdkee1.4\lib\j2ee.jar;C:\j2sdkee1.4\lib\ejbdeployment10.jar;C:\j2sdkee1.4\lib\jhall.jar;C:\Tomcat5.0\common\lib\servlet-api.jar;C:\Tomcat\5.0\common\lib\jsp-api.jar;C:\ProgramFiles\SQLLIB\java\db2java.zip;C:\ProgramFiles\SQLLIB\java\runtime.zip;C:\ProgramFiles\SQLLIB\java\sqlj.zip;C:\ProgramFiles\SQLLIB\bin
J2EE_HOME=C:\j2sdkee1.4
JAVA_HOME=C:\j2sdk1.4.2_04
OPENEJB_HOME=c:\openejb-0.9.2
PATH=.;C:\j2sdk1.4.2_04\bin;C:\j2sdkee1.4\bin;C:\PROGRA~1\IBM\IMNNQ;C:\ProgramFiles\SQLLIB\BIN;C:\ProgramFiles\SQLLIB\FUNCTION;C:\ProgramFiles\SQLLIB\SAMPLES\REPL;C:\ProgramFiles\SQLLIB\HELP;C:\oracle\ora90\BIN;C:\Winnt;C:\Winnt\System32
Tomcat is installed in C:\Tomcat 5.0 and I have added
the following entry to C:\Tomcat 5.0\conf\server.xml
-------------------------------------------------------
<Context path="/jsp-examples" docBase="jsp-
examples" debug="0"
reloadable="true" crossContext="true">
<Ejb name="ejb/hello"
type="Session"
home="org.acme.HelloHome"
remote="org.acme.Hello"/>
<ResourceParams name="ejb/hello">
<parameter>
<name>factory</name>
<value>org.openejb.client.TomcatEjbFactory</value>
</parameter>
<parameter>
<name>openejb.naming.factory.initial</name>
<value>org.openejb.client.LocalInitialContextFactory</val
ue>
</parameter>
<parameter>
<name>openejb.naming.security.principal</name>
<value>username</value>
</parameter>
<parameter>
<name>openejb.naming.security.credentials</name>
<value>password</value>
</parameter>
<parameter>
<name>openejb.naming.provider.url</name>
<value>localhost:4201</value>
</parameter>
<parameter>
<name>openejb.ejb-link</name>
<value>Hello</value>
</parameter>
</ResourceParams>
</Context>
-------------------------------------------------------
OpenEJB is installed in C:\openejb-0.9.2 and I have downloaded the
test file 'myHelloEjb.jar' into the directory
'C:\openejb-0.9.2\beans'. I also downloaded the test JSP 'openejb.jsp'
into the directory 'C:\Tomcat 5.0\webapps\jsp-examples'.
'openejb.jsp' contains the following:
-------------------------------------------------------
<%@ page import="org.acme.HelloObject,
org.acme.HelloHome,
javax.naming.InitialContext,
javax.naming.Context"%>
<html>
<head>
<title>OpenEJB -- EJB for Tomcat</title>
</head>
<body>
Stateless Session bean - HelloBean - says:
<%
Context initCtx = new InitialContext();
Object object = initCtx.lookup("java:comp/env/ejb/hello");
HelloHome helloHome = (HelloHome)
javax.rmi.PortableRemoteObject.narrow(object, HelloHome.class);
HelloObject bean = helloHome.create();
%>
<%= bean.sayHello() %>
</body>
</html>
-------------------------------------------------------
When I try to enter the URL
'http://localhost/jsp-examples/openejb.jsp',
I get the following HTTP error:
-------------------------------------------------------
type Exception report
message
description The server encountered an internal error ()
that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.se
rvice(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJsp
File(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:248)
javax.servlet.http.HttpServlet.service
(HttpServlet.java:856)
root cause
java.lang.reflect.UndeclaredThrowableException
$Proxy13.create(Unknown Source)
org.apache.jsp.openejb_jsp._jspService
(openejb_jsp.java:61)
org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service
(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.se
rvice(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJsp
File(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:248)
javax.servlet.http.HttpServlet.service
(HttpServlet.java:856)
-------------------------------------------------------
I'm sure this is my stupid error but despite puzzling over
this for three complete days now, I am no further forward.
Can someone PUHLEEZE give me some advice!??!!
Thanks in advance ...
Jeremy
John C. Bollinger - 17 Mar 2004 18:27 GMT
> I'm trying to deploy what I again thought was a simple EJB to a
> OpenEJB server running with Tomcat.
>
> Using the files below, I get the messages below when I copy the JAR
> file to the deployment directory.
> 'openejb.jsp' contains the following:
>
[quoted text clipped - 39 lines]
>
> org.apache.jasper.JasperException
Jasper is Tomcat's JSP engine. JasperExceptions indicate problems with
accessing a JSP page; they are often caused either by JSP syntax errors
(detected during translation of the JSP source to Java source) or by
compilation errors in the Java source derived from the JSPs. Here,
however, it is caused by an exception thrown at runtime when the
create() method is invoked on your bean's home interface.
> org.apache.jasper.servlet.JspServletWrapper.se
> rvice(JspServletWrapper.java:358)
[quoted text clipped - 9 lines]
> java.lang.reflect.UndeclaredThrowableException
> $Proxy13.create(Unknown Source)
The UndeclaredThrowableException indicates that your bean's home
interface implementation threw a checked exception that the home
interface did not declare. This indicates an error in the definition of
the home interface (it fails to declare at least one of the checked
exceptions that the corresponding ejbCreate method on the implementation
class may throw). You also have another problem, however, which is that
your ejbCreate method is throwing the exception in the first place,
whether or not the exception was declared. Once you clear up the first
problem, the nature of the second should become more apparent.
John Bollinger
jobollin@indiana.edu