Tomcat and openEJB - how to do this simple config?
Joined: Jul 24, 2008
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:
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
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.
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.