1 Reply Latest reply on Nov 25, 2007 6:30 AM by Pete Muir

    Tomcat & Java 1.6SDK datasource problem

    Stateless Bean Novice

      Hi,
      I use Seam 2.0.0GA, JBoss embedded, tomcat 6.0.13, and quartz.
      When I moved my seam app from java 1.5 to 1.6 update 3 I get errors with datasource to my app and quartz?

      Can anyone tell me what's wrong?


      10:54:10,812 ERROR [JNDIConnectionProvider] Error looking up datasource: Name UniversumDatasource is not bound in this Context
      javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context
      at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at org.quartz.utils.JNDIConnectionProvider.init(JNDIConnectionProvider.java:127)
      at org.quartz.utils.JNDIConnectionProvider.<init>(JNDIConnectionProvider.java:105)
      at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:917)
      at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
      at org.jboss.seam.async.QuartzDispatcher.initScheduler(QuartzDispatcher.java:69)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
      at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
      at org.jboss.seam.Component.newInstance(Component.java:1968)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
      at org.jboss.seam.init.Initialization.init(Initialization.java:555)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      10:54:10,843 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
      10:54:11,046 INFO [QuartzScheduler] Quartz Scheduler v.1.6.0 created.
      10:54:11,062 INFO [JobStoreTX] Using thread monitor-based data access locking (synchronization).
      10:54:11,078 ERROR [QuartzDispatcher] Cannot get or start a Quartz Scheduler
      org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'quartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context [See nested exception: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context]]
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:557)
      at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:59)
      at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1204)
      at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
      at org.jboss.seam.async.QuartzDispatcher.initScheduler(QuartzDispatcher.java:69)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
      at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
      at org.jboss.seam.Component.newInstance(Component.java:1968)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
      at org.jboss.seam.init.Initialization.init(Initialization.java:555)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'quartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context [See nested exception: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context]
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:636)
      at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:72)
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3659)
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3624)
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.cleanVolatileTriggerAndJobs(JobStoreSupport.java:693)
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:555)
      ... 42 more
      Caused by: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context
      at org.quartz.utils.JNDIConnectionProvider.getConnection(JNDIConnectionProvider.java:166)
      at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:112)
      at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:633)
      ... 47 more


      Here is my datasource
      components.xml

       <core:init jndi-pattern="@jndiPattern@" debug="false"/>
      


      ds.xml
      <datasources>
       <local-tx-datasource>
       <jndi-name>UniversumDatasource</jndi-name>
       <connection-url>jdbc:postgresql://localhost:5432/Universum</connection-url>
       <driver-class>org.postgresql.Driver</driver-class>
       <user-name>postgres</user-name>
       <password>root</password>
       <blocking-timeout-millis>50000</blocking-timeout-millis>
       </local-tx-datasource>
      </datasources>
      


      and persistence.xml

      <?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="UniversumDatabase" transaction-type="JTA">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/UniversumDatasource</jta-data-source>
       <properties>
       <property name="dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
       <!-- These are the default for JBoss EJB3, but not for HEM: -->
       <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.cache.use_query_cache" value="true"/>
       <property name="hibernate.cache.region_prefix" value="hibernate.test"/>
       <property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
       <!--
       <property name="hibernate.generate_statistics" value="false"/>
       <property name="hibernate.connection.isolation" value="4"/> -->
       <property name="hibernate.cache.use_minimal_puts" value="true"/>
       <property name="hibernate.cache.use_query_cache" value="true"/>
       <property name="hibernate.cache.use_structured_entries" value="true"/>
      
      
       <!-- <property name="hibernate.show_sql" value="true"/> -->
       <!-- <property name="hibernate.hbm2ddl.auto" value="create"/> -->
      
       <property name="hibernate.transaction.manager_lookup_class"
       value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <property name="jboss.entity.manager.factory.jndi.name"
       value="java:/sguEntityManagerFactory" />
       </properties>
       </persistence-unit>
      </persistence>