开发者

Migration Apache Tomcat 6 project with context.xml to GlassFish

I have application originally developed for Tomcat. There is context.xml file in META-INF using for creating datasource. As was mention开发者_运维知识库ed 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


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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜