tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Tomcat and openEJB - how to do this simple config?
Date Wed, 18 Feb 2009 21:12:20 GMT

On Feb 13, 2009, at 12:12 AM, jpmad4it wrote:

> I have had a chance to look into the EJB issue a lot more, and I think
> you're right in saying that maybe its not the best solution.
>
> Basically, at a high level view here is what we want to achieve:
>
>
> IDMS --------JDBC-------Tomcat------ PHP/Java Bridge-----PHP------- 
> TYPO3 CMS
>
> |
>
> |
>
> MySQL
>
>
> The non-IDMS technologies are running on Linux.
>
> The issue causing all the problems is getting PHP to connect to  
> IDMS. We
> have to use JDBC because there is no IDMS ODBC driver available on  
> Linux. So
> this is where JDBC and Tomcat come into it.

Have you tried using the JDBC Driver directly from the PHP/Java  
Bridge.  Seems if you could get that to work that'd be the most direct  
approach.


-David


> I have been experimenting with
> the PHP/Java Bridge, and Quercus on Resin. I have found out that I can
> actually run the TYPO3 CMS (all written in PHP) in Tomcat using the  
> PHP/Java
> Bridge. It allows me to connect to (via JDBC) and query both MySQL  
> and IDMS
> using SQL which is pretty cool.....but I'm worried that somewhere  
> down the
> line problems will crop up due to TYPO3 running in Tomcat (which its  
> not
> made to do). I tried Resin but that wouldn't install, so I tried  
> quercus
> standalone in Tomcat but it didnt give the same results as the PHP/ 
> Java
> bridge.
>
> I'd rather run TYPO3 in Apache and somehow send the JDBC requests to  
> IDMS
> via Tomcat.....but I dont know if that is possible? I do have Apache  
> and
> Tomcat mod_proxy(ed) together if that helps? Maybe someone knows of  
> a better
> setup?
>
> In my posts I was only using EJB-----MySQL as an example, as the  
> IDMS has
> its own JDBC driver so the setup would have been pretty much the same.
>
> So I was trying to get EJB to handle the JDBC connection to  
> IDMS......but
> I've learnt that I was going down the wrong route now.
>
> Kind regards
> Jonathan
>
>
>
>
> David Blevins wrote:
>>
>>
>> On Feb 5, 2009, at 8:38 AM, jpmad4it wrote:
>>
>>> Can anyone help, I'm still struggling with this??
>>
>> Hi Jp, and thanks again for the patience.
>>
>> Answering the middle question first as the first and last question
>> seem related.
>>
>>> EDIT2: I am now trying to setup the injection-of-datasource example,
>>> I've
>>> changed the test java file so that its correct for my mysql
>>> database, but
>>> during "mvn clean install" the process fails, saying it cannot find
>>> the jdbc
>>> driver 	. The mysql-connector/J.jar is in my tomcat/lib
>>> folder:
>>
>> For build the code via maven, there simply needs to be a <dependency>
>> section added to the pom.xml file to get it included into the build/
>> test classpath.
>>
>> I think this is the right dep:
>>
>> <dependency>
>>     <groupId>mysql</groupId>
>>     <artifactId>mysql-connector-java</artifactId>
>>     <version>5.1.6</version>
>> </dependency>
>>
>> You can add that next to the openejb dep in the examples pom.xml  
>> file.
>>
>>> EDIT: I think I managed to call the Calculator web service through
>>> PHP. I
>>> used the script soap.php:
>> [...]
>>> So I think that it has successfully called the service and grabbed
>>> the types
>>> from it? I don't know how to code the PHP to actually do a simple
>>> addition
>>> though.
>>>
>>> Maybe I should start to think about getting a service setup for the
>>> MySQL
>>> database?
>> [...]
>>> I do have another concern......from studying the injection example,
>>> all the
>>> SQL is wrote in Java. This is something that we don't really want to
>>> do. We
>>> want to call the connection written in Java from PHP, and then use
>>> that
>>> connection to carry out mysql queries within PHP - is this going  
>>> to be
>>> possible? Or does all the SQL have to be writtin in the Java?
>>
>> From this feedback it seems like the webservice approach may not
>> quite be the right direction for you.
>>
>> Maybe we should zoom out a bit and get the bigger picture view of  
>> what
>> you want to do at a very high level and the motivation behind it.   
>> The
>> biggest question in my mind is what are you looking to get from the
>> java side of things and what limitations are you dealing with that
>> motivates it.
>>
>>
>> -David
>>
>>>
>>> David Blevins wrote:
>>>>
>>>>
>>>>> Sorry for the delay -- we're a bit backed up at the moment :)
>>>>
>>>> No problem!
>>>>
>>>>> I see. This is a very different approach to accessing the bean  
>>>>> than
>>>>> via SOAP as shown in the other article.  With SOAP you have 100%
>>>>> native client.  This technique uses java on the client which as a
>>>>> result is going to use our binary protocol to do the remote
>>>>> invocations.  This is fine.  If you go this route you'll need to
>>>>> follow a different example, the one I created for you won't work.
>>>>> The
>>>>> main difference is that you'd remove the @WebService and then  
>>>>> you'd
>>>>> need to add an @Remote interface.  The "component-interfaces"
>>>>> example
>>>>> matches that article the best as it uses the old style home/remote
>>>>> interfaces.  A newer approach would be to follow the "telephone-
>>>>> stateful" example.
>>>>
>>>> Lets take the SOAP route for now, and access the Calculator service
>>>> from
>>>> PHP. Once this is done I can think about getting a web service set
>>>> up for
>>>> MySQL database access via JDBC type 4 or JNDI (required for the  
>>>> IDMS
>>>> database JDBC driver), and then calling this from PHP. If it all
>>>> works
>>>> well I can implement this into the IDMS config - just change the
>>>> JNDI /
>>>> JDBC configs hopefully?
>>>>
>>>>> I suspect though that there's going to be a slight learning  
>>>>> curve on
>>>>> either one, though.
>>>>
>>>> I'm ready for it!
>>>>
>>>>> Which startup script are you referring to?  If you mean the  
>>>>> tomcat/
>>>>> bin/
>>>>> startup.sh than, no, you don't need to modify that.  We'll find  
>>>>> our
>>>>> libraries and load them automatically.
>>>>
>>>> My .bashrc file for Linux startup. I dont think this applies.
>>>>
>>>>> One idea for you as I know getting started in a new technology is
>>>>> extremely difficult due to all the very large pieces that have  
>>>>> to be
>>>>> learned before much of anything can be done.  Rather than buying
>>>>> bunch
>>>> of books, you might try finding the mailing list for the local java
>>>>> user group and offering a 100 bucks and a few beers (or coffees  
>>>>> and
>>>>> snacks) for an afternoon side by side hacking.  Just let them know
>>>>> what your trying to do and what technologies you're using (PHP,  
>>>>> EJB,
>>>>> JDBC, Servlets).  In this economy there's guaranteed to be a few
>>>>> people who'd take you up on that offer.  Will be the best 100 you
>>>>> ever
>>>>> spent.
>>>>
>>>> Agreed, is this forum US based? I am in the UK, I wonder if there  
>>>> is
>>>> anyone here willing to do that??
>>>>
>>>> As for SOAP and PHP, I now have the SOAP extension installed - I
>>>> recompiled PHP with --enable-soap and its now available in PHP as  
>>>> an
>>>> extension.
>>>>
>>>> Can I access the Calculator web service using the PHP SOAP  
>>>> extension
>>>> without adding axis2 or any other SOAP service for Apache2 and
>>>> Tomcat? ( I
>>>> read above that you use Apache CXF?)
>>>>
>>>> I've got to a point now where I'm stuck again - I saw that you gave
>>>> me the
>>>> following:
>>>>
>>>>> As an FYI, the client-side SOAP message associated with that call
>>>>> looks like this:
>>>>
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
>>>> envelope/">
>>>>  <soap:Body>
>>>>    <ns1:multiply xmlns:ns1="http://superbiz.org/wsdl">
>>>>      <arg0>3</arg0>
>>>>      <arg1>4</arg1>
>>>>    </ns1:multiply>
>>>>  </soap:Body>
>>>> </soap:Envelope>
>>>>
>>>> Where do I insert this config?
>>>>
>>>> Also, how do I actually get the Calculator web service to do some
>>>> calculations? Can I add variables to the URL to get some output  
>>>> e.g.
>>>> www.localhost:8080/Calculator?some_variable_add etc
>>>>
>>>> PHP can call a WSDL file using the following code (this requires
>>>> NuSOAP):
>>>>
>>>> < ?php
>>>>
>>>> // include the SOAP classes
>>>> require_once(’nusoap.php’);
>>>>
>>>> $client = new soapclient(’http://example.com/url/to/some/
>>>> valid.wsdl’,
>>>> True);
>>>>
>>>> $err = $client->getError();
>>>> if ($err) {
>>>> // Display the error
>>>> echo ‘client construction error: ‘ . $err ;
>>>> } else {
>>>> $answer = $client->call(’someSOAPMethod’,
>>>> array(
>>>> ‘param1′=>’foo’
>>>> ,’param2′=>’bar’));
>>>>
>>>> $err = $client->getError();
>>>> if ($err) {
>>>> // Display the error
>>>> echo ‘Call error: ‘ . $err;
>>>> print_r($client->response);
>>>> print_r($client->getDebug());
>>>> } else {
>>>> print_r($answer);
>>>> }
>>>> }
>>>> ?>
>>>>
>>>> Is it possible to create a WSDL file for the Calculator service?
>>>> How is
>>>> this done? If I can do this I can call it from PHP.
>>>>
>>>> Sorry that my questions are really poor quality, but I've got  
>>>> really
>>>> confused and prety stuck.
>>>>
>>>> Any help will be fantastic again.
>>>> king regards
>>>> Jp
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Tomcat-and-openEJB---how-to-do-this-simple-config--tp21582249p21855662.html
>>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Tomcat-and-openEJB---how-to-do-this-simple-config--tp21582249p21991942.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Mime
View raw message