wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat and openEJB - how to do this simple config? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat and openEJB - how to do this simple config?" Watch "Tomcat and openEJB - how to do this simple config?" New topic
Author

Tomcat and openEJB - how to do this simple config?

jonathan pilling
Greenhorn

Joined: Jul 24, 2008
Posts: 4
Hi,

I am trying to setup a JNDI database connection through an EJB in Tomcat. First of all, is this possible? If it is, I would then like to call this database connection created in the EJB from PHP. However, this post's questions relate to EJB and Tomcat, not PHP.

I found that I need openEJB to enable EJB support in Tomcat, so I’ve installed that by deploying the war file. Am I correct saying that openEJB enables EJB and *.ear support in Tomcat?

I found a simple article here, which simply calls a “Hello World” EJB from within PHP:

http://www.devx.com/Java/Article/21707/0/page/1

I am trying to crack this tutorial first, and then move onto JNDI database connections later (ps the connection will be with a mySQL database).

I have some questions about the article above:

1) What would the folder structure be under a Tomcat webapp? E.g. /webapps/greentest/WEB-XML/classes etc? Its confusing with the src/ directory they have mentioned.
2) Are all java files mentioned simply compiled into class files using the ‘javac’ command?
3) After the compile, where would the class files be located in the Tomcat webapp folder structure?
4) On page 2 of the article, a few important steps seem to be automated:
a. How can I compile a jar file from multiple class files from the linux command line (image 2)?
b. How do I create the enterprise session (stateless) bean (image 3) in Tomcat? (and also would this EJB be the same for a database
connection?)
c. How would I setup the web.xml, server.xml, open-ejb.xml, persistence.xml files (or anything that’s necessary) for Tomcat?

Sorry for the long post, but I’m very new to Java. However I have successfully setup a JNDI connection from JSP to MySQL, so I do have some knowledge of the JNDI setup….I’m just struggling with the EJB part within Tomcat.

I've looked around for tutorials, but I've not found anything that I can understand. They seem a little too advanced for me.

The most helpful was the Apache guide here (Generic Javabean Resources section):
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#Generic%20JavaBean%20Resources

However, I'm not sure what that that bean does, and I'm still fuzzy on where to locate some files. Plus I don't know if what I want to achieve can be done with the Apache guide, or if it relates to EJB or openEJB.

If anyone could find the time to help me and answer my questions I would greatly appreciate it.

Regards
Jp
 
 
subject: Tomcat and openEJB - how to do this simple config?
 
Similar Threads
Getting NullPointerException
Newbie naive questions Regarding glassfish
regarding JNDI
Returning a value from a Netbeans / SWING application
Help: Connecting Tomcat to CA-IDMS Using JDBC Type 4 Drivers (JNDI / IDMSDataSource)