Not getting TestServlet to see the beans - IntialContext lookup

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Not getting TestServlet to see the beans - IntialContext lookup

laurelkhall@gmail.com
Hello World,

I've followed the simple instructions for building OpenEJB using the war file in Tomcat 6.0.
It seems I've got something fundamentally wrong, as I've spent days trying to figure out the problem and feel like I've tried every possible to rid my server of errors.

My Environment:

Eclipse
Tomcat 6.0.29
OpenEJB 3.1.4

I have a servlet called TestServlet
I've got the web.xml as follows:
  <ejb-ref>
     <description>EJB Reference to the bean deployed to OpenEJB</description>
 
        <ejb-ref-name>view</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <home>swEBJ.view.viewHome</home>
        <remote>swEBJ.view.view</remote>
        <ejb-link>swEJB.view</ejb-link>
    </ejb-ref>

I have imported a jar to my TestServlet, swEJB.jar with the "view" ejb-ref.
>> jar tvf swEJB.jar
META-INF/MANIFEST.MF
swEJB/view/viewLocal.class
swEJB/view/viewLocalHome.class
swEJB/view/viewHome.class
swEJB/view/viewBeanSession.class
swEJB/view/viewBean.class
swEJB/view/view.class
swEJB/view/viewUtil.class
swEJB/view/viewSession.class

Server.xml:
-----------
<Context docBase="C:\Workspace\TestServlet" path="/TestServlet" reloadable="true" source="org.eclipse.jst.j2ee.server:TestServlet">
<Ejb name="ejb/view"
    type="view"
    home="swEJB.view.viewHome"
    remote="swEJB.view.view"/>
<ResourceParams name="ejb/view">
    <parameter>
        <name>factory</name>
        <value>org.openejb.client.TomcatEjbFactory</value>
    </parameter>
    <parameter>
        <name>openejb.naming.factory.initial</name>
        <value>org.openejb.client.LocalInitialContextFactory</value>
    </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>view</value>
    </parameter>
</ResourceParams>
</Context>
<Context docBase="C:\Workspace\openejb" path="/openejb" reloadable="true" source="org.eclipse.jst.j2ee.server:openejb">

Snippet of serious issues in OpenEJB.log:
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent.  
...

2010-12-13 20:22:52,890 - INFO  - PersistenceUnit(name=cmp, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 299ms
2010-12-13 20:22:52,890 - INFO  - Undeploying app: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
2010-12-13 20:22:52,921 - ERROR - Unable to deploy collapsed ear in war : Exception: Creating application failed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT: PersistenceUnit already deployed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb\lib\openejb-itests-standalone-client-3.1.2.jar
org.apache.openejb.OpenEJBException: Creating application failed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT: PersistenceUnit already deployed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb\lib\openejb-itests-standalone-client-3.1.2.jar
...

2010-12-13 20:22:55,468 - INFO  - Undeploying app: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb
2010-12-13 20:22:55,484 - ERROR - Unable to deploy collapsed ear in war /openejb: Exception: Creating application failed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb: PersistenceUnit already deployed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb\lib\openejb-itests-standalone-client-3.1.2.jar
org.apache.openejb.OpenEJBException: Creating application failed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb: PersistenceUnit already deployed: C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\openejb\lib\openejb-itests-standalone-client-3.1.2.jar
...

2010-12-13 20:24:07,750 - ERROR - Unable to stop web application /TestServlet: Exception: Failed undeploying application: id=C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\TestServlet
org.apache.openejb.UndeployException: Failed undeploying application: id=C:\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\TestServlet
        at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:815)

-----------------------------------------------------------------------

I was trying to use the COLLAPSED EAR method. (http://openejb.apache.org/collapsed-ear.html) so I put all the bean classes in my swEJB.jar. I really don't understand what I can do about the openejb-itests-standalone-client-3.1.2.jar since it was included in OpenEJB.war. It seems to be a problem. I've tried deleting it and then I've broken the OpenEJB app. Any suggestions for resolving any of these issues?

Am I completely off base? Missing the whole boat? So frustrated.

Thanks in advance for your help.
-Laurie
Reply | Threaded
Open this post in threaded view
|

Re: Not getting TestServlet to see the beans - IntialContext lookup

Jacek Laskowski
On Tue, Dec 14, 2010 at 3:30 AM, [hidden email]
<[hidden email]> wrote:

> I've followed the simple instructions for building OpenEJB using the war
> file in Tomcat 6.0.

Hi,

I've been trying to reproduce the issue you're having and frankly am
myself stuck with it as well :) It's been a while since I've been
trying openejb and tomcat together and would love some help before
lending my hand to you.

What was the document you followed? Would you be able to attach a
complete WAR w/ the sources?

Jacek

--
Jacek Laskowski
Notatnik Projektanta Java EE - http://jaceklaskowski.pl
Reply | Threaded
Open this post in threaded view
|

Re: Not getting TestServlet to see the beans - IntialContext lookup

laurelkhall@gmail.com
Hi Jacek,

Thanks so much for your effort to try and duplicate the problem. 
I am new to EJB and OpenEJB and it will be so cool to get it running! I will email the code to you directly.

I didn't follow any specific documentation accept for the four steps (http://openejb.apache.org/3.0/tomcat.html) "Installation for the Impatient". I did watch the video on how to build one of the examples. And read numerous pages on the the OpenEJB web site to get this far.  Then I tried to integrate my existing client test case (not using Junit) with OpenEJB.

The biggest issue I'm facing is that the InitialContext() lookup returns no errors, however, it returns NULL. It seems that I'm find the context, but it's not defined correctly

Laurie
Reply | Threaded
Open this post in threaded view
|

Re: Not getting TestServlet to see the beans - IntialContext lookup

Jacek Laskowski
On Wed, Dec 15, 2010 at 4:11 PM, [hidden email]
<[hidden email]> wrote:

> Thanks so much for your effort to try and duplicate the problem.
> I am new to EJB and OpenEJB and it will be so cool to get it running! I will
> email the code to you directly.

Got the code. Thanks.

Jacek

--
Jacek Laskowski
Notatnik Projektanta Java EE - http://jaceklaskowski.pl
Reply | Threaded
Open this post in threaded view
|

Re: Not getting TestServlet to see the beans - IntialContext lookup

laurelkhall@gmail.com
In reply to this post by laurelkhall@gmail.com
Abandoning OpenEJB due to complexity. My EJB works fine under JBoss, so, not sure why it wouldn't fly in OpenEJB.

(There was no solution to this issue)