Check to make sure you've set the openejb.home init-param correctly.
In the web.xml of the moviefun.war or the Opossum.war there is a
LoaderServlet which actually loads OpenEJB into the webapp. The
declaration looks something like this.
<servlet>
<servlet-name>loader</servlet-name>
<servlet-class>org.openejb.loader.LoaderServlet</servlet-class>
<init-param>
<param-name>openejb.loader</param-name>
<param-value>tomcat-webapp</param-value>
</init-param>
<init-param>
<param-name>openejb.home</param-name>
<param-value>/home/dblevins/openejb-1.0-beta1</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
In this example, the openejb.home init-param is set to "/home/
dblevins/openejb-1.0-beta1" Edit the web.xml and replace "/home/
dblevins/openejb-1.0-beta1" with the actual path of OpenEJB on your
system. Once this is done, restart tomcat to get Tomcat to reread
the web.xml and reload the webapp.
Let me know if you still have troubles. At the very least, the error
messages should sort of lead you in the right direction to solving
the problem, which is something we can improve.
-David
On Sep 12, 2005, at 12:23 PM, Rajesh Puri wrote:
David,
I copied the war file to my webapps and try to run
test.jsp and I got these eror messages. I guess I need
not have anything running on the server except Tomcat
and OpenEjb will be started by the library
automatically. I am still to do my first tutorial and
have failed to make moviefun and this one work.
Do I need to set anything in Tomcat environment etc?
-----------------------
type Exception report
message
description The server encountered an internal error
() that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Attempted to load
OpenEJB. Could not load OpenEJB class after embedding
libraries. Exception: java.lang.ClassNotFoundException
org.openejb.OpenEJB
org.apache.jasper.runtime.PageContextImpl.doHandlePageException
(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:758)
org.apache.jsp.test_jsp._jspService(test_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
root cause
javax.naming.NamingException: Attempted to load
OpenEJB. Could not load OpenEJB class after embedding
libraries. Exception: java.lang.ClassNotFoundException
org.openejb.OpenEJB [Root exception is
java.lang.Exception: Could not load OpenEJB class
after embedding libraries. Exception:
java.lang.ClassNotFoundException org.openejb.OpenEJB]
org.openejb.client.LocalInitialContextFactory.getInitialContext
(LocalInitialContextFactory.java:74)
javax.naming.spi.NamingManager.getInitialContext(Unknown
Source)
javax.naming.InitialContext.getDefaultInitCtx(Unknown
Source)
javax.naming.InitialContext.init(Unknown Source)
javax.naming.InitialContext.<init>(Unknown Source)
org.apache.jsp.test_jsp._jspService(test_jsp.java:54)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
root cause
java.lang.Exception: Could not load OpenEJB class
after embedding libraries. Exception:
java.lang.ClassNotFoundException org.openejb.OpenEJB
org.openejb.loader.OpenEJBInstance.loadOpenEJBClass
(OpenEJBInstance.java:111)
org.openejb.loader.OpenEJBInstance.<init>(OpenEJBInstance.java:69)
org.openejb.client.LocalInitialContextFactory.init
(LocalInitialContextFactory.java:84)
org.openejb.client.LocalInitialContextFactory.getInitialContext
(LocalInitialContextFactory.java:72)
javax.naming.spi.NamingManager.getInitialContext(Unknown
Source)
javax.naming.InitialContext.getDefaultInitCtx(Unknown
Source)
javax.naming.InitialContext.init(Unknown Source)
javax.naming.InitialContext.<init>(Unknown Source)
org.apache.jsp.test_jsp._jspService(test_jsp.java:54)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
note The full stack trace of the root cause is
available in the Apache Tomcat/5.0.25 logs.
--- David Blevins <[EMAIL PROTECTED]> wrote:
Hello kapi59ttp,
I have your fixed app right here:
http://openejb.org/Opossum.war
When setting the openejb.loader init param to
tomcat-webapp, you
effectively embedd OpenEJB and your ejbs into your
war file
completely. The result is package that is run
entirely in your
webapp space and does not affect any other webapp or
the Tomcat
server itself. This does change the layout and
classloading concepts
put forth in the traditional style of embedding
OpenEJB gloabally
into Tomcat. We call this new concept of app
development and
approach to packaging a Collapsed EAR
(http://openejb.org/Collapsed+EAR)
We are still working on the documentation for this
and are looking
for people to write articles about. It's very
exciting.
So here is your app converted to a Collapsed EAR
supported by Tomcat
and OpenEJB.
BEFORE:
-------
The OpenEJB Home:
./conf/openejb.conf
./conf/logging.conf
./beans/Opossum.jar
The Webapp:
./WEB-INF/lib/openejb-loader-1.0-beta1.jar
./WEB-INF/web.xml
The Opossum.jar:
./META-INF/ejb-jar.xml
./META-INF/openejb-jar.xml
./ops/opejb/OpossumBean.class
./ops/opejb/OpossumBean.java
./ops/opejb/OpossumClient.class
./ops/opejb/OpossumClient.java
./ops/opejb/OpossumHome.class
./ops/opejb/OpossumHome.java
./ops/opejb/OpossumObject.class
./ops/opejb/OpossumObject.java
AFTER:
------
The Webapp (collapsed ear style):
./META-INF
./META-INF/ejb-jar.xml
./META-INF/log4j.properties
./META-INF/openejb-jar.xml
./META-INF/openejb.xml
./test.jsp
./WEB-INF/classes
./WEB-INF/classes/ops
./WEB-INF/classes/ops/opejb
./WEB-INF/classes/ops/opejb/OpossumBean.class
./WEB-INF/classes/ops/opejb/OpossumBean.java
./WEB-INF/classes/ops/opejb/OpossumClient.class
./WEB-INF/classes/ops/opejb/OpossumClient.java
./WEB-INF/classes/ops/opejb/OpossumHome.class
./WEB-INF/classes/ops/opejb/OpossumHome.java
./WEB-INF/classes/ops/opejb/OpossumObject.class
./WEB-INF/classes/ops/opejb/OpossumObject.java
./WEB-INF/lib
./WEB-INF/lib/geronimo-spec-ejb-2.1-rc4.jar
./WEB-INF/lib/openejb-loader-1.0-beta1.jar
./WEB-INF/web.xml
So what we've done is taken OpenEJB and your EJB jar
and overlayed
them right on top of your war file. We have
collapsed all the
archives and directories and config files into one
unit containing
ejbs and servlets, hence the term Collapsed EAR.
The result is one
application containing everything in one archive and
one
classloader. Easy and straight-forward. Not need
to split things up
and spread them out over several jars and
directories. Put your ejb
classes and you servlets in WEB-INF/lib and
WEB-INF/classes.
Hope this helps everyone understand this new
concept. It's a bit
radical and undocumented, but extremely cool.
So here is a request for feedback from users and
potential users.
When I whipped up this stuff I chose to keep the
META-INF directory
as not to confuse things too much, however another
option that was
attractive to me was to just use the WEB-INF
directory for
everything. Using the above setup as an example,
that would give us:
POTENTIAL OPTION:
------
The Webapp (collapsed ear style):
./test.jsp
./WEB-INF/classes
./WEB-INF/classes/ops
./WEB-INF/classes/ops/opejb
./WEB-INF/classes/ops/opejb/OpossumBean.class
./WEB-INF/classes/ops/opejb/OpossumBean.java
./WEB-INF/classes/ops/opejb/OpossumClient.class
./WEB-INF/classes/ops/opejb/OpossumClient.java
./WEB-INF/classes/ops/opejb/OpossumHome.class
./WEB-INF/classes/ops/opejb/OpossumHome.java
./WEB-INF/classes/ops/opejb/OpossumObject.class
./WEB-INF/classes/ops/opejb/OpossumObject.java
./WEB-INF/lib
./WEB-INF/lib/geronimo-spec-ejb-2.1-rc4.jar
./WEB-INF/lib/openejb-loader-1.0-beta1.jar
./WEB-INF/log4j.properties
./WEB-INF/openejb-jar.xml
./WEB-INF/openejb.xml
./WEB-INF/ejb-jar.xml
./WEB-INF/web.xml
In this setup, the ejb-jar.xml and web.xml are right
next to each
other which gives a more unified feel. What do
people think? Which
is better?
Thanks,
David
On Sep 10, 2005, at 7:23 AM, kapi59ttp wrote:
Hi there,
i cannot make OpenEJB and Tomcat work togheter. I
am really
stressed :S
I need help, so lets see if anyone can help me. I
have followed the
example but i cant make ir work :(
So i describe what i exactly did, and i also
attach my files...so lets
se if i can get some help
1. Make an EJB using HelloWorld example and deploy
it. It works
fine :D.
Thank you.
2. I make a new context for Tomcat in webapps
directory. I have a test
jsp page calle open.jsp.
3. Describe the content of the directory:
/ (with open.jsp)
/ WEB-INF
/classes (empty)
/lib with openejb-loader-1.0-beta1.jar
web.xml (with the adding described on
the page)
With this configuration it returns:
/usr/share/tomcat4/work/Standalone/localhost/opossum/open_jsp.java:7:
package ops.opejb does not exist
import ops.opejb.*;
I have tried to copy the deployed Opossum.jar file
into WEB-INF/lib
but i cant make it work :S
Any ideas???
Thanks for all :-)
<Opossum.jar>
<web.xml>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com