3 Replies Latest reply on Dec 31, 2008 11:14 PM by jaikiran pai

    Migrating WAR binary from Tomcat to JBoss Web (JNDI/SAR/jbos

    darren hartford Expert

      I have a WAR binary that works in tomcat. It has datasource requirements that follow the normal TOMCAT jndi approach of /comp/env/jdbc/myDS.

      If you wanted to modify the WAR binary, yes you can add RESOURCE-REF and/or put in Resource Injection in the actual code.

      But lets say you don't, and have a 'certified' WAR binary and do not want to modify the WAR itself.

      Ideally, you create:

      myapp-datasources.sar (folder)
      -->META-INF/jboss-service.xml
      -->mydatasource-ds.xml
      -->lib/mydatabasejdbc.jar

      nope...not so easy.

      <jndi-name>myDS</jndi-name> fails
      <jndi-name>jdbc/myDS</jndi-name> fails
      <jndi-name>env/jdbc/myDS</jndi-name> fails
      <jndi-name>comp/env/jdbc/myDS</jndi-name> fails

      <use-java-context>true</use-java-context> fails (only couple of the above)

      Get errors like:

      javax.naming.NameNotFoundException: env not bound

      java.lang.RuntimeException: mapped-name is required for jdbc/myDS


      Is there anything that can be done in a SAR to map old Tomcat datasources to be usable by a WAR built for Tomcat to be usable Jboss Web without modifying the WAR?

      Thanks,
      -D