Hello, I'm currently moving my Tapestry5.3 app away from Glassfish in favor
of Tomcat7 on the amazon cloud for my production env. As for my development
env, I'd like to continue using Jetty. Currently my Glassfish server JNDI
in configured to my JDBC connection pool and my hibernate.cfg.xml
datasource is configured to call jdbc/mydatabase.

<hibernate-configuration>
    <session-factory>
        <property
name="hibernate.connection.datasource">jdbc/mydatabase</property>
    </session-factory>
</hibernate-configuration>

My Jetty configuration is done in WEB-INF/jetty-env.xml and uses,

<Configure id='wac' class="org.mortbay.jetty.webapp.WebAppContext">
  <New id="LocalDS" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/mydatabase</Arg>
    <Arg>
      <New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
        <Set name="ServerName">localhost</Set>
        <Set name="PortNumber">3306</Set>
        <Set name="DatabaseName">mydatabase</Set>
        <Set name="User">root</Set>
        <Set name="Password">password</Set>
      </New>-->
    </Arg>
  </New>
</Configure>

I noticed with tomcat7 configurations I need to add the following code
snippet to WEB-INF/web.xml, something I've never had to do with Glassfish.

http://wiki.apache.org/tomcat/TomcatHibernate

<resource-ref>
  <description>This is a MySQL database connection</description>
  <res-ref-name>jdbc/mydatabase</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

and hibernate.cfg.xml

<!-- using container-managed JNDI -->
<propertyname="hibernate.connection.datasource">
   java:comp/env/jdbc/mydatabase
</property>

My question is if I use this configuration, how does Hibernate know to use
Jetty locally? I'm not a server expert by any means, so please forgive my
ignorance. Does Tapestry tell Hibernate about the local environment and
know to use the Jetty JDBC? How do others configure their Tapestry apps to
run under these conditions?

BTW, for some odd reason, I have not been receiving emails from the mailing
list and I'm not sure of the cause thus I'm not entirely sure how to
respond. This was never an issue when posting with Nabble.

Reply via email to