Wow! Thanks David! At last a clear explanation that allowed me to get it
working!

I deployed the war file that was included in the zip, and its all fine. The
only thing I needed to do was to setup the mod_proxy in Apache. So instead
of using http://localhost:8080/Calculator I can use
http://localhost/Calculator. If I go to this webpage I get:

Hi, this is 'CalculatorWebService' web service.

However, if I go to http://localhost/Calculator?wsdl I get an XML file
output - is that expected?

Im my catalina.out log I get this:

INFO: Deploying web application archive ejb-webservice.war
context path = /ejb-webservice
22-Jan-2009 08:02:21
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service {http://superbiz.org/wsdl}CalculatorWebService from
class org.superbiz.ws.Calculator
22-Jan-2009 08:02:22
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: {http://superbiz.org/wsdl}arg0 part element name
{http://superbiz.org/wsdl}arg0 references element
{http://superbiz.org/wsdl}arg0
{http://superbiz.org/wsdl}arg1 part element name
{http://superbiz.org/wsdl}arg1 references element
{http://superbiz.org/wsdl}arg1
{http://superbiz.org/wsdl}return part element name
{http://superbiz.org/wsdl}return references element
{http://superbiz.org/wsdl}return
{http://superbiz.org/wsdl}arg0 part element name
{http://superbiz.org/wsdl}arg0 references element
{http://superbiz.org/wsdl}arg0
{http://superbiz.org/wsdl}arg1 part element name
{http://superbiz.org/wsdl}arg1 references element
{http://superbiz.org/wsdl}arg1
{http://superbiz.org/wsdl}return part element name
{http://superbiz.org/wsdl}return references element
{http://superbiz.org/wsdl}return

22-Jan-2009 08:02:22 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://nopath:80
context path = 
context path = /docs
context path = /examples
context path = /host-manager
context path = /manager

I just wondered what this line meant:

INFO: Setting the server's publish address to be http://nopath:80

Will this affect things such as mod_proxy (it doesn't seem to have caused
problems so far).

My ejb log looks like this:

2009-01-22 08:02:19,395 - INFO  - Found ejb module EjbModule in war
/ejb-webservice
2009-01-22 08:02:19,396 - INFO  - Configuring enterprise application:
/home/tomcat/webapps/ejb-webservice
2009-01-22 08:02:19,522 - INFO  - Enterprise application
"/home/tomcat/webapps/ejb-webservice" loaded.
2009-01-22 08:02:19,523 - INFO  - Assembling app:
/home/tomcat/webapps/ejb-webservice
2009-01-22 08:02:20,151 - INFO  - Created Ejb(deployment-id=Calculator,
ejb-name=Calculator, container=My Stateless Container)
2009-01-22 08:02:20,151 - INFO  - Deployed
Application(path=/home/tomcat/webapps/ejb-webservice)
2009-01-22 08:02:22,831 - INFO  -
Webservice(wsdl=http://localhost:8080/Calculator,
qname={http://superbiz.org/wsdl}CalculatorWebService) --> Ejb(id=Calculator)

It all looks good to me?

I do have some other questions about the process if thats ok:

1) In my EJB log on Tomcat startup I get this WARN:
WARN  - WARN ... MEJB:  @Init is ignored for beans of type Stateless. 
Method: create

Is that something that needs looking into? How can I correct this?

2) I read a little about maven on the maven website: 
a) Are the pom.properties and pom.xml files automatically created by the
'maven' process? 
b) What does the maven process do?
b) If I am creating my own webapps can I simply copy your META-INF folder
and tweak the files so that they contain references to my webapp? Or would I
have to 'maven' my new webapps files? Which files does maven take, and what
are the outputs?

3) Is the Calculator.class file you posted above a .java file? If so, is it
compiled using "javac Calculator.java"? Is the Calculator.class the actual
EJB?

4) What is the class file actually doing? I noticed some references to SOAP
in the XML output:

- <wsdl:binding name="CalculatorWebServiceSoapBinding"
type="tns:Calculator">
  <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"; /> 

5) Is this method a replacement for SOAP? If so, how can I call this EJB
from PHP??

6) Is the web.xml file universal to all EJB webapps, or does it need
tweaking for different ones? If the web.xml file is left totally blank I
have seen errors about "being unable to marshall the file". So I guess it
has to contain some references?

7) What do these lines of code in the java mean:

package org.superbiz.ws;  - this is the folder structure to the class file
/org/superbiz/ws/Calculator.class?

import javax.ejb.Stateless; ???
import javax.jws.WebService; ???

8) If I was to create an EJB which simply connected to a MySQL database via
JNDI, and returned the output that the connection was successfully made, how
can I do this!?!?! I'm guessing that I would create my java file with the
correct imports and the code for the DB connection (using the JNDI thats
already setup in server.xml with context reference to correct folder),
compile the code using the javac command, do the maven process to create the
META-INF folder, set up the file structure, and compile to a war file and
deploy to Tomcat? Please let me know if I am kind of on the right track, or
correct me if I totally wrong!

I'm not a Java coder, and I need this DB connection ASAP...so I'd have to
find a reference online for some Java to allow me to create a
connection.....do you know of any? I've tried a few but I get compile errors
when trying to compile the Java files to class file (if they are Java files
that I have been using!!). I've successfully connected to MySQL via JNDI,
but not through an EJB process. The only reason I am looking into EJB is
because the creators of the sourceforge PHP-Java bridge said that a
connection to the MySQL database can be created in an EJB, and then called
by PHP. After the connection is made I can then use PHP and MySQL to query
the database. Does that sound correct? I tried calling a JDBC and JNDI
connection to MySQL straight to Java from PHP. The connection worked, but
when I the mysql_select_db() I got nothing. No errors, no log errors, just
blank.

I think I need to explain further now that I have said the above! My main
objective is to connect to an IDMS database. Now the only way this can be
done (in our environment) is via the IDMS JDBC type 4 drivers which support
JNDI.....this requires a Java environment. BUT, we want to code our website
using PHP. So the PHP-Java bridge will allow us to use PHP and Java
together, and so I have been told that PHP can call the EJB and connect to
the database. This is why I looking at the guide mentioned in my 1st post,
and this is why I am testing the PHP-Java bridge with MySQL - all I would
have to do to connect to IDMS is change the JNDI settings i.e. URL,
username, pass etc etc. 

Phew! Sorry about the pile of questions. There's just so much I need to find
out and I can't seem to find answers anywhere. If you could help me obtain a
PHP-(Java-EJB)-JNDI/JDBC-MySQL connection I think I'd buy you a present!
lol.

Seriously, I would be extremely grateful if you can answer any of the
questions to help me along the way.

regards
Jp
-- 
View this message in context: 
http://www.nabble.com/Tomcat-and-openEJB---how-to-do-this-simple-config--tp21582249p21600552.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to