-
1. Re: Tomcat deployment with external datasource - is it possi
norman.richards Mar 20, 2007 11:55 AM (in response to asavitsky)What did you use as the JNDI name in persistence.xml?
-
2. Re: Tomcat deployment with external datasource - is it possi
baz Mar 20, 2007 11:58 AM (in response to asavitsky)Yes it is possible, but AFAIK you are losing seam managed transactions.
The last time i was using this was in March 2006. Until then i am bound to seam managed transactions.
But if i am wrong, and external datasources in combination with seam managed transactions in tomcat are possible, please tell me how.
But nevertheless, new projects will be deployed to an application server.
Ciao, -
3. Re: Tomcat deployment with external datasource - is it possi
asavitsky Mar 20, 2007 12:15 PM (in response to asavitsky)Norman,
Here's my persistence.xml file:<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="visitsDatabase" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:comp/env/jdbc/DataSource</jta-data-source> <properties> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> <property name="hibernate.bytecode.provider" value="javassist" /> <property name="hibernate.jdbc.batch_size" value="0" /> </properties> </persistence-unit> </persistence>
Actually, I have tried several ways of referencing the Tomcat JNDI data source, like: "jdbc/DataSource", "java:/jdbc/DataSource", "java:comp/env/jdbc/DataSource", "java:/DataSource". The JNDI name defined in Tomcat is "jdbc/DataSource"
Thanks,
Alex -
4. Re: Tomcat deployment with external datasource - is it possi
asavitsky Mar 21, 2007 1:13 PM (in response to asavitsky)Baz, could you please post your setup that you said was working? And what do you mean by "losing Seam-managed transactions"? Did you still use Seam's transactional JSF interceptor?
Overall, I'm leaning towards opening a JIRA issue for that, as it doesn't look like it's possible to mix the lookups to the Microcontainer JNDI and to the Tomcat one... -
5. Re: Tomcat deployment with external datasource - is it possi
norman.richards Mar 21, 2007 10:20 PM (in response to asavitsky)It wouldn't surprise me at all if the microcontainer overrides tomcat's JNDI. My understanding is that tomcat JNDI is read-only and is too limited for any sort of serious extension.
Honestly, if you need appserver class deployment options that you consider using an appserver. -
6. Re: Tomcat deployment with external datasource - is it possi
baz Mar 22, 2007 3:30 AM (in response to asavitsky)Hello,
i do not have the setup anymore:-(
But when i was using 'tomcats' datasource i wasn't using the microcontainer.
And Normans statement makes sense to me.
From chapter 21.5 of the seam docs:
The Seam support for Hibernate and JPA requires JTA and a JCA datasource. If you are running
in a non-EE environment like Tomcat or TestNG you can run these services, and Hibernate itself,
in the JBoss Microcontainer.
And for this setup, with microcontainer, i have never managed to access the tomcat resources.
So for conclusion, all of our new projects will be deployed to an appserver.
Ciao,
Carsten -
7. Re: Tomcat deployment with external datasource - is it possi
asavitsky Mar 22, 2007 9:32 AM (in response to asavitsky)"baz" wrote:
Hello,
i do not have the setup anymore:-(
But when i was using 'tomcats' datasource i wasn't using the microcontainer.
You mean - you were simply using a JTA-compliant TM, like I ended up doing? I finally sacked the MC and installed JOTM instead, and it works, with Tomcat datasource and such :) Is this what you've meant when you said you couldn't use the Seam-managed transactions with such setup? I haven't checked yet whether they work in my setup or not, gonna do it first thing today... -
8. Re: Tomcat deployment with external datasource - is it possi
baz Mar 22, 2007 9:44 AM (in response to asavitsky)I have never tried to use JOTM. But two years ago i considered using it.
But switched to the microcontainer setup. -
9. Re: Tomcat deployment with external datasource - is it possi
asavitsky Mar 22, 2007 10:05 AM (in response to asavitsky)Actually, any JTA-compliant TM should do, I suppose, JOTM was picked only because it was the first one I've heard about (I plan to try Atomikos, and to ask around who's using what on Spring forum). No MC for me for sure, as any appservers are off-limits in our environment, and the ability to use Tomcat DS is a must.
Now, sorry for being persistent, but could you expand a little bit more on why you couldn't use Seam-managed Tx in your setup?
Thanks,
Alex -
10. Re: Tomcat deployment with external datasource - is it possi
baz Mar 22, 2007 11:12 AM (in response to asavitsky)I will repeat the parts that i have written
but AFAIK you are losing seam managed transactions.
But if i am wrong, and external datasources in combination with seam managed transactions in tomcat are possible, please tell me how.
Conclusion: i am not sure but i have no time to test the opposite -
11. Re: Tomcat deployment with external datasource - is it possi
youngm Apr 10, 2007 9:31 PM (in response to asavitsky)I've created a jira issue and a candidate patch for pluggable transaction management in seam. This will allow for use of seam without a dependence on JTA obtained through JNDI. If you want try out the patch and post any feedback you have. At the very least if this is a feature you are interested in vote for it.
Thanks,
Mike -
12. Re: Tomcat deployment with external datasource - is it possi
przemjaskier Apr 11, 2007 4:35 AM (in response to asavitsky)Improvement created by Michael:
http://jira.jboss.org/jira/browse/JBSEAM-1144
Great idea, +1 for me. Support, please. -
13. Re: Tomcat deployment with external datasource - is it possi
asavitsky Apr 11, 2007 9:05 AM (in response to asavitsky)Great work, Mike! This one gets +1 from me as well.
BTW, in the meantime I managed to configure Seam (with managed transactions, PCs and the like) without the microcontainer at all - using either JOTM, Atomikos, or JBoss Transactions. Actually, the latter, being a JBoss product, might even be suitable to be included as a Seam-Tomcat example (instead of Microcontainer) -
14. Re: Tomcat deployment with external datasource - is it possi
youngm Apr 11, 2007 10:31 AM (in response to asavitsky)BTW, in the meantime I managed to configure Seam (with managed transactions, PCs and the like) without the microcontainer at all - using either JOTM, Atomikos, or JBoss Transactions.
It would be great if you could post how you did that in the Seam WIKI or something for others to see since things aren't looking so good for JBSEAM-1144. :)
Mike