I've been trying to get OpenEJB hooked up to my web app project in Netbeans and I've been having a lot of problems, but am making progress but have spent almost 15 hours now looking at mailing list, forum, and documentation stuff.

I successfully deployed the OpenEJB war with Tomcat after running into a lot of issues trying to switch from Tomcat 7 to TomEE.

Basically my current status is:

1. I can run all the example openejb junit cases successfully but I'm not sure how to translate that success to my actual netbeans JSP 2.0 project. I'm not really familiar with how all the maven/junit stuff translates to actual web app/IDE configurations. 2. I can successfully get an openejb context using this command in my servlet code:

        Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
        InitialContext initialContext = new InitialContext(properties);

3. The tomcat log seems to indicate that openejb it is successfully loading my mysql datasource.

3. But I can't pull any bean objects out of the context.. this throws exception:

          Object object = initialContext.lookup("UserFacadeLocal");

4. I probably don't have them properly defined, but I'm not getting any errors about them being improperly defined to work with. So I'm not sure my ejb-jar.xml is being discovered and I'm not sure how detailed a description is necessary. I don't get any thing in my tomcat log output saying it's loading the ejb-jar.xml contents or saying that it is loading the <class> elements contained in my persistence.xml file.

5. I've tried putting a META-INF/ejb-jar.xml file about everywhere that is recommended in my project folders on other discussion threads but the only acknowledgement I get in the log output is that it is in the wrong place if I put it in the root project folder.

6. I'm working with Entity classes and facade/local interfaces created by netbeans from my db schema. They contain lots of this type stuff: @Entity, @NamedQueries etc.. I'm wondering if this setup replaces the need for any amount of explicit xml config file definitions.

7. Last.. I find that you get namespace and other exceptions if you include certain openejb/ejb jar files with your deployed project. I found a mailing list message saying to leave it out to avoid the errors, but it didn't say how you'd then go about referencing any openejb library classes in your project.

Thanks in advance.. It's been awhile since I've had to do a J2EE web app.. Last time I used Jboss and some ide that just generated all the classes and local and remote interfaces to persist class objects with my DB. I would like to keep things more simple and lightweight and stick with tomcat on this project.

-David

Reply via email to