views:

23

answers:

1

Hi. I have application originally developed for Tomcat. There is context.xml file in META-INF using for creating datasource. As was mentioned here glassfish has support of context.xml file from Tomcat. I tried to migrate this app to Glassfishv3. But I still, my app (actually Hibernate) can't find jdbc datasource resource via jndi. There is code of context.xml from tomcat

<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false"
antiJARLocking="false" reloadable="true">
<!-- JOTM -->

<Transaction factory="org.objectweb.jotm.UserTransactionFactory"
    jotm.timeout="60" />
<Resource name="jdbc/companydb" type="javax.sql.DataSource"
    driverClassName="org.hsqldb.jdbcDriver" maxIdle="2" maxWait="5000"
    url="jdbc:hsqldb:hsql://localhost:9002/companydb" username="sa"
    password="" maxActive="4" />

</Context>

I redeployed app from tomcat without any changes to Glassfish. There is exception from Glassfish

java.lang.RuntimeException : org.hibernate.HibernateException: Could not find datasource jdbc/companydb

Have someone successfully switched to Glassfish from tomcat? Thanks

A: 

Have someone successfully switched to Glassfish from tomcat? Thanks

I'm 100% positive about that. I never tried the context.xml support though. And personally I wouldn't even try to reuse a context.xml but just re-create the connection pool under GlassFish. This will take less time than the time spent to write your question and will give you better administration support :)

Pascal Thivent