10 Replies Latest reply on Apr 15, 2008 4:16 AM by jaikiran

    Referenced datasource not found with JBoss 5.0 (Beta4)

      Hi,

      We are currently using JBoss 4.2.2 but we are trying to make our application work under JBoss 5.0.

      We are using a WAR file as well as an EAR file containing our EJB jar file.

      We defined our datasource as a JNDI resource in a "-ds.xml" file in the deploy directory; it seems to be correctly deployed both under 4.2.2 and 5.0.

      That data source is accessed by our application through a reference that is defined in web.xml:

       <resource-ref>
       <res-ref-name>app-specific/datasource</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       <res-sharing-scope>Shareable</res-sharing-scope>
       </resource-ref>
      


      The mapping between the resource reference name and the JNDI name is in our jboss-web.xml file:

       <resource-ref>
       <res-ref-name>app-specific/datasource</res-ref-name>
       <jndi-name>java:/app/datasource</jndi-name>
       </resource-ref>
      


      This set-up used to work under JBoss 4.2.2 but doesn't work anymore under JBoss 5.0; it complains that the datasource is not bound:

      Caused by: javax.naming.NameNotFoundException: app-specific not bound
      


      I know JBoss 5.0 is still Beta; I was just wondering if anybody else ran into this problem too...

      Thanks!

        • 1. Re: Referenced datasource not found with JBoss 5.0 (Beta4)
          jaikiran

          Please post the entire exception stacktrace, the contents of your -ds.xml and also the code where you are looking up the datasource.

          • 2. Re: Referenced datasource not found with JBoss 5.0 (Beta4)

            Here is the full stack trace. This happens after the EJB deployment (which is fine), then Tomcat deploys the WAR and our Servlet entry point is being executed; it tries to access our database (Oralce) and the exception happens:

            javax.ejb.EJBException: com.imsweb.seerdms.shared.exception.SeerInvalidStateException: Unable to get connection.
             at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
             at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
             at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:193)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:64)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:249)
             at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
             at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:86)
             at $Proxy109.getDbColumnInfo(Unknown Source)
             at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.java:139)
             at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.java:111)
             at com.imsweb.seerdms.web.shared.configuration.ConfigurationServlet.init(ConfigurationServlet.java:158)
             at javax.servlet.GenericServlet.init(GenericServlet.java:212)
             at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
             at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
             at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4072)
             at org.apache.catalina.core.StandardContext.start(StandardContext.java:4377)
             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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
             at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
             at org.apache.catalina.core.StandardContext.init(StandardContext.java:5357)
             at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:346)
             at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
             at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:347)
             at org.jboss.web.deployers.WebModule.startModule(WebModule.java:89)
             at org.jboss.web.deployers.WebModule.start(WebModule.java:67)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
             at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:184)
             at $Proxy5.start(Unknown Source)
             at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
             at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
             at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
             at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
             at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
             at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:255)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
             at org.jboss.system.ServiceController.doChange(ServiceController.java:659)
             at org.jboss.system.ServiceController.start(ServiceController.java:431)
             at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:150)
             at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:108)
             at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
             at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65)
             at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
             at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:874)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:906)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
             at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
             at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:246)
             at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:131)
             at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:408)
             at org.jboss.Main.boot(Main.java:208)
             at org.jboss.Main$1.run(Main.java:534)
             at java.lang.Thread.run(Thread.java:619)
            Caused by: com.imsweb.seerdms.shared.exception.SeerInvalidStateException: Unable to get connection.
             at com.imsweb.seerdms.app.shared.dao.hibernate.HibernateCommonDataDAO.getDbColumnInfo(HibernateCommonDataDAO.java:125)
             at com.imsweb.seerdms.app.shared.buslogic.CommonDataApiSessionBean.getDbColumnInfo(CommonDataApiSessionBean.java:143)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
             at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
             at com.imsweb.seerdms.app.shared.buslogic.SessionInterceptor.aroundInvoke(SessionInterceptor.java:45)
             at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
             at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
             ... 93 more
            Caused by: javax.naming.NameNotFoundException: app-specific not bound
             at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
             at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
             at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
             at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
             at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
             at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
             at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:776)
             at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
             at javax.naming.InitialContext.lookup(InitialContext.java:392)
             at com.imsweb.seerdms.shared.api.ServiceLocator.lookup(ServiceLocator.java:631)
             at com.imsweb.seerdms.shared.api.ServiceLocator.getConnection(ServiceLocator.java:597)
             at com.imsweb.seerdms.app.shared.dao.hibernate.HibernateCommonDataDAO.getDbColumnInfo(HibernateCommonDataDAO.java:97)
             ... 113 more
            


            Here is our datasource file:

            <datasources>
             <local-tx-datasource>
             <jndi-name>app/datasource</jndi-name>
             <connection-url>jdbc:oracle:thin:@some.address:1521:app</connection-url>
             <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
             <user-name>***</user-name>
             <password>***</password>
             <min-pool-size>5</min-pool-size>
             <max-pool-size>100</max-pool-size>
             <blocking-timeout-millis>60000</blocking-timeout-millis>
             <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
             </local-tx-datasource>
            </datasources>
            


            This is the code that provides the connection, the first method is actually throwing a NamingException that is catch by some other code, but this is the root of the problem:

             public Connection getConnection() throws NamingException, SQLException {
             DataSource dataSource = (DataSource)lookup(DataSource.class, "java:comp/env/app-specific/datasource");
            
             return dataSource.getConnection();
             }
            
             protected Object lookup(Class<?> clazz, String name) throws NamingException {
            
             //- Obtain a cached initial context
             InitialContext context = new InitialContext();
            
             try {
             Object objRef = context.lookup(name);
             return PortableRemoteObject.narrow(objRef, clazz);
             }
             finally {
             context.close();
             }
             }
            


            • 3. Re: Referenced datasource not found with JBoss 5.0 (Beta4)
              jaikiran

              Is it a case of your init servlet being invoked even before the ENC is initialized (or maybe even before the datasource deployed). I have seen posts about JBoss-5 has issues related to deployment and deployment ordering. Do the logs show that the datasource is bound before the servlet is called? Can you post that part of the logs?

              • 4. Re: Referenced datasource not found with JBoss 5.0 (Beta4)

                There is a message about the connection being bound to the JNDI name, so I know this is successful and done before the exception:

                15:27:26,446 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=app/datasource' to JNDI name 'java:/app/datasource'
                


                Here is the full log (I removed some EJB messages because we have many of them).

                15:26:29,785 INFO [ServerImpl] Starting JBoss (Microcontainer)...
                15:26:29,785 INFO [ServerImpl] Release ID: JBoss [Morpheus] 5.0.0.Beta4 (build: SVNTag=JBoss_5_0_0_Beta4 date=200802091115)
                15:26:29,785 INFO [ServerImpl] Home Dir: C:\dev\jboss-5.0.0.Beta4
                15:26:29,785 INFO [ServerImpl] Home URL: file:/C:/dev/jboss-5.0.0.Beta4/
                15:26:29,785 INFO [ServerImpl] Library URL: file:/C:/dev/jboss-5.0.0.Beta4/lib/
                15:26:29,785 INFO [ServerImpl] Patch URL: null
                15:26:29,785 INFO [ServerImpl] Server Name: default
                15:26:29,785 INFO [ServerImpl] Server Home Dir: C:\dev\jboss-5.0.0.Beta4\server\default
                15:26:29,785 INFO [ServerImpl] Server Home URL: file:/C:/dev/jboss-5.0.0.Beta4/server/default/
                15:26:29,785 INFO [ServerImpl] Server Data Dir: C:\dev\jboss-5.0.0.Beta4\server\default\data
                15:26:29,785 INFO [ServerImpl] Server Temp Dir: C:\dev\jboss-5.0.0.Beta4\server\default\tmp
                15:26:29,785 INFO [ServerImpl] Server Config URL: file:/C:/dev/jboss-5.0.0.Beta4/server/default/conf/
                15:26:29,785 INFO [ServerImpl] Server Library URL: file:/C:/dev/jboss-5.0.0.Beta4/server/default/lib/
                15:26:29,785 INFO [ServerImpl] Root Deployment Filename: jboss-service.xml
                15:26:30,241 INFO [ServerImpl] Starting Microcontainer, bootstrapURL=file:/C:/dev/jboss-5.0.0.Beta4/server/default/conf/bootstrap-beans.xml
                15:26:32,851 INFO [ProfileImpl] Using profile root:C:\dev\jboss-5.0.0.Beta4\server\default
                15:26:33,669 INFO [ServerInfo] Java version: 1.6.0_05,Sun Microsystems Inc.
                15:26:33,669 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 10.0-b19,Sun Microsystems Inc.
                15:26:33,684 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
                15:26:33,732 INFO [JMXKernel] Legacy JMX core initialized
                15:26:59,012 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
                15:27:00,018 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
                15:27:00,018 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
                15:27:00,317 INFO [TransactionManagerService] Starting recovery manager
                15:27:00,443 INFO [TransactionManagerService] Recovery manager started
                15:27:00,443 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
                15:27:14,938 INFO [AspectDeployer] Deploying xml into org.jboss.aop.AspectManager@980b32 for BaseClassLoader@14536a5{vfsfile:/C:/dev/jboss-5.0.0.Beta4/server/default/deploy/ejb3-i
                nterceptors-aop.xml}
                15:27:17,045 INFO [RARDeployment] Required license terms exist, view vfsfile:/C:/dev/jboss-5.0.0.Beta4/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
                15:27:17,045 INFO [RARDeployment] Required license terms exist, view vfsfile:/C:/dev/jboss-5.0.0.Beta4/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
                15:27:17,123 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
                15:27:17,579 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
                15:27:17,642 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
                15:27:17,642 INFO [JobStoreCMT] Using db table-based data access locking (synchronization).
                15:27:17,674 INFO [JobStoreCMT] Removed 0 Volatile Trigger(s).
                15:27:17,674 INFO [JobStoreCMT] Removed 0 Volatile Job(s).
                15:27:17,674 INFO [JobStoreCMT] JobStoreCMT initialized.
                15:27:17,674 INFO [StdSchedulerFactory] Quartz scheduler 'JBossEJB3QuartzScheduler' initialized from an externally provided properties instance.
                15:27:17,674 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
                15:27:17,689 INFO [JobStoreCMT] Freed 0 triggers from 'acquired' / 'blocked' state.
                15:27:17,689 INFO [JobStoreCMT] Recovering 0 jobs that were in-progress at the time of the last shut-down.
                15:27:17,689 INFO [JobStoreCMT] Recovery complete.
                15:27:17,689 INFO [JobStoreCMT] Removed 0 'complete' triggers.
                15:27:17,689 INFO [JobStoreCMT] Removed 0 stale fired job entries.
                15:27:17,689 INFO [QuartzScheduler] Scheduler JBossEJB3QuartzScheduler_$_NON_CLUSTERED started.
                15:27:19,497 INFO [TomcatDeployment] deploy, ctxPath=/invoker, vfsUrl=http-invoker.sar/invoker.war
                15:27:21,541 INFO [NativeServerConfig] JBoss Web Services - Native
                15:27:21,557 INFO [NativeServerConfig] jbossws-native-2.0.3.GA (build=200801241020)
                15:27:22,547 INFO [TomcatDeployment] deploy, ctxPath=/jbossws, vfsUrl=jbossws.sar/jbossws-context.war
                15:27:22,642 INFO [RARDeployment] Required license terms exist, view vfsfile:/C:/dev/jboss-5.0.0.Beta4/server/default/deploy/jms-ra.rar/META-INF/ra.xml
                15:27:22,689 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war
                15:27:24,088 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector
                15:27:24,151 INFO [RARDeployment] Required license terms exist, view vfsfile:/C:/dev/jboss-5.0.0.Beta4/server/default/deploy/mail-ra.rar/META-INF/ra.xml
                15:27:24,261 INFO [MailService] Mail Service bound to java:/Mail
                15:27:24,450 INFO [TomcatDeployment] deploy, ctxPath=/web-console, vfsUrl=management/console-mgr.sar/web-console.war
                15:27:25,487 WARN [SecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has
                 not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
                15:27:25,975 INFO [ServerPeer] JBoss Messaging 1.4.1.Beta1 server [0] started
                15:27:26,053 INFO [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
                15:27:26,163 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
                15:27:26,163 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@14b052 started
                15:27:26,163 WARN [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but
                post office is non clustered. So connection factory will *not* support failover
                15:27:26,163 WARN [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory
                 but post office is non clustered. So connection factory will *not* support load balancing
                15:27:26,163 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
                15:27:26,179 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@1737301 started
                15:27:26,179 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
                15:27:26,179 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@3540ce started
                15:27:26,179 INFO [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
                15:27:26,179 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
                15:27:26,211 INFO [RARDeployment] Required license terms exist, view vfsfile:/C:/dev/jboss-5.0.0.Beta4/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
                15:27:26,226 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
                15:27:26,226 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
                15:27:26,226 INFO [RAMJobStore] RAMJobStore initialized.
                15:27:26,226 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
                15:27:26,226 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
                15:27:26,226 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
                15:27:26,446 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=app/datasource' to JNDI name 'java:/app/datasource'
                15:27:29,025 INFO [MCKernelAbstraction] installing bean: jboss.j2ee:ear=seerdms.ear,jar=seerdms.jar,name=ConsolidationApiSessionBean,service=EJB3 with dependencies:
                15:27:29,025 INFO [MCKernelAbstraction] and demands:
                15:27:29,025 INFO [MCKernelAbstraction] jboss.ejb:service=EJBTimerService
                15:27:29,025 INFO [MCKernelAbstraction] and supplies:
                15:27:29,025 INFO [MCKernelAbstraction] Class:com.imsweb.seerdms.shared.api.ConsolidationApi
                15:27:29,764 INFO [EJBContainer] STARTED EJB: com.imsweb.seerdms.app.consolidation.buslogic.ConsolidationApiSessionBean ejbName: ConsolidationApiSessionBean
                
                ... (many other EJBs)
                
                15:27:39,385 INFO [MCKernelAbstraction] installing bean: jboss.j2ee:ear=seerdms.ear,jar=seerdms.jar,name=WorkflowWebBean,service=EJB3 with dependencies:
                15:27:39,385 INFO [MCKernelAbstraction] and demands:
                15:27:39,385 INFO [MCKernelAbstraction] jboss.ejb:service=EJBTimerService
                15:27:39,385 INFO [MCKernelAbstraction] and supplies:
                15:27:39,385 INFO [MCKernelAbstraction] Class:com.imsweb.seerdms.shared.api.WorkflowApi
                15:27:39,810 INFO [EJBContainer] STARTED EJB: com.imsweb.seerdms.app.workflow.buslogic.WorkflowWebBean ejbName: WorkflowWebBean
                15:27:57,528 INFO [TomcatDeployment] deploy, ctxPath=/seerdms, vfsUrl=seerdms.ear/seerdms.war
                15:28:05,405 INFO [ConfigurationApiSessionBean] Loaded local configuration
                15:28:05,641 INFO [ConfigurationServlet] Velocity engine initialized
                15:28:14,013 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
                15:28:14,028 INFO [ConfigurationServlet] Quartz scheduler initialized
                15:28:14,122 INFO [LookupConfigLoader] Lookup definitions loaded in 94ms
                15:28:14,138 INFO [ReportConfigurator] Reporting engine initialized.
                15:28:14,185 INFO [MatchingFactoryFinder] Initializing matching factory...
                15:28:14,248 INFO [FunctionFactoryFinder] Initializing matching user-defined function factory...
                15:28:14,248 INFO [ExpressionFactoryFinder] Initializing matching user-defined function factory...
                15:28:14,765 INFO [PropertyMappingsUtils] Starting property mapping initialization
                15:28:14,797 ERROR [[/seerdms]] StandardWrapper.Throwable
                javax.ejb.EJBException: com.imsweb.seerdms.shared.exception.SeerInvalidStateException: Unable to get connection.
                 at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
                 at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:193)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:64)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:249)
                 at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
                 at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:86)
                 at $Proxy109.getDbColumnInfo(Unknown Source)
                 at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.java:139)
                 at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.java:111)
                 at com.imsweb.seerdms.web.shared.configuration.ConfigurationServlet.init(ConfigurationServlet.java:158)
                 at javax.servlet.GenericServlet.init(GenericServlet.java:212)
                 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
                 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
                 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4072)
                 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4377)
                 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
                 at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                 at org.apache.catalina.core.StandardContext.init(StandardContext.java:5357)
                 at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:346)
                 at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
                 at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:347)
                 at org.jboss.web.deployers.WebModule.startModule(WebModule.java:89)
                 at org.jboss.web.deployers.WebModule.start(WebModule.java:67)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                 at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:184)
                 at $Proxy5.start(Unknown Source)
                 at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
                 at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
                 at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                 at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                 at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
                 at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:255)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
                 at org.jboss.system.ServiceController.doChange(ServiceController.java:659)
                 at org.jboss.system.ServiceController.start(ServiceController.java:431)
                 at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:150)
                 at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:108)
                 at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                 at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:874)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:906)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
                 at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
                 at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:246)
                 at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:131)
                 at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:408)
                 at org.jboss.Main.boot(Main.java:208)
                 at org.jboss.Main$1.run(Main.java:534)
                 at java.lang.Thread.run(Thread.java:619)
                Caused by: com.imsweb.seerdms.shared.exception.SeerInvalidStateException: Unable to get connection.
                 at com.imsweb.seerdms.app.shared.dao.hibernate.HibernateCommonDataDAO.getDbColumnInfo(HibernateCommonDataDAO.java:125)
                 at com.imsweb.seerdms.app.shared.buslogic.CommonDataApiSessionBean.getDbColumnInfo(CommonDataApiSessionBean.java:143)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                 at com.imsweb.seerdms.app.shared.buslogic.SessionInterceptor.aroundInvoke(SessionInterceptor.java:45)
                 at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                 at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                 at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
                 ... 93 more
                Caused by: javax.naming.NameNotFoundException: app-specific not bound
                 at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
                 at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
                 at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
                 at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
                 at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:776)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
                 at javax.naming.InitialContext.lookup(InitialContext.java:392)
                 at com.imsweb.seerdms.shared.api.ServiceLocator.lookup(ServiceLocator.java:631)
                 at com.imsweb.seerdms.shared.api.ServiceLocator.getConnection(ServiceLocator.java:597)
                 at com.imsweb.seerdms.app.shared.dao.hibernate.HibernateCommonDataDAO.getDbColumnInfo(HibernateCommonDataDAO.java:97)
                 ... 113 more
                15:28:21,635 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.Beta4 (build: SVNTag=JBoss_5_0_0_Beta4 date=200802091115)] Started in 1m:51s:834ms
                




                • 5. Re: Referenced datasource not found with JBoss 5.0 (Beta4)
                  peterj

                  Let me see if I understand this correctly. You have a data source named "java:/app/datasource", and the code to open the data source thinks that it is named "java:comp/env/app-specific/datasource"?

                  Maybe the person who wrote the *-ds.xml file should get together with the person who wrote the Java code and agree to use the same name. ;-)

                  • 6. Re: Referenced datasource not found with JBoss 5.0 (Beta4)
                    jaikiran

                    I think what "depryf" is trying to do is, define a resource-ref named "app-specific/datasource" for the "java:/app/datasource" datasource and then use java:comp/env/app-specific/datasource as the jndi-name for looking up the datasource.

                    depryf,

                    Going by the exception stacktrace, i guess this is what is happening:


                    at $Proxy109.getDbColumnInfo(Unknown Source)
                    at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.jav
                    a:139)
                    at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.jav
                    a:111)
                    at com.imsweb.seerdms.web.shared.configuration.ConfigurationServlet.init(ConfigurationServle
                    t.java:158)
                    at javax.servlet.GenericServlet.init(GenericServlet.java:212)


                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
                    at javax.naming.InitialContext.lookup(InitialContext.java:392)
                    at com.imsweb.seerdms.shared.api.ServiceLocator.lookup(ServiceLocator.java:631)
                    at com.imsweb.seerdms.shared.api.ServiceLocator.getConnection(ServiceLocator.java:597)
                    at com.imsweb.seerdms.app.shared.dao.hibernate.HibernateCommonDataDAO.getDbColumnInfo(Hibern
                    ateCommonDataDAO.java:97)


                    You have a resource-ref defined in your web component, in which you have a startup servlet. This startup servlet will then have access to the java:comp/env/app-specific/datasource datasource. Based on the exception stacktrace, i can see that in the init method of your startup servlet you are looking up an EJB and invoking an method on the EJB. The EJB then (i guess through a DAO) tries to lookup the datasource using java:comp/env/app-specific/datasource jndi-name. This is not going to work because, the EJB has its own java:comp/env namespace. Since you have specified the resource-ref for your web component and not the EJB component, the java:comp/env namespace will be empty for the EJB and hence the lookup fails.

                    Just to verify this, you can lookup the datasource "java:comp/env/app-specific/datasource" directly in the init method of the startup servlet. I believe you should be able to successfully get the datasource.

                    If you want the datasource to be available at java:comp/env namespace of the EJB, then you will have to define a resource-ref through the ejb-jar.xml and jboss.xml for the EJB.



                    • 7. Re: Referenced datasource not found with JBoss 5.0 (Beta4)

                      Thank you very much jaikiran, this is exactly what I was trying to do, but I had a hard time explaining it.

                      The reason why we use a different resource-name for the datasource in our EJB code than what is defined in the -ds file is because our application is customizable and need to be deploy using different databases for different clients. The way we did that is to define a bunch of different datasource JNDI in the -ds file (like app-specific/datasource) but map all of them to the same reference datasource in our code (app/datasource). That way our EJB code remains generic.

                      The explanation about Web environment vs EJB environment makes total sense, although this is not something I would expect to change from 4.X to 5.0 ;-)

                      I will try to add the missing EJB references this week and see if it works.

                      Thanks again for all the comments!

                      • 8. Re: Referenced datasource not found with JBoss 5.0 (Beta4)

                         


                        Just to verify this, you can lookup the datasource "java:comp/env/app-specific/datasource" directly in the init method of the startup servlet. I believe you should be able to successfully get the datasource.


                        I verified this and it worked like you expected it.

                        I am going to try to add the references in the EJB context. This is not very simple because we don't currently have a ejb-jar.xml or jboss.xml file; we only use annotations to define our session beans. I can easily add those files, but I have to define every single EJB since they all access our database (and there are many of them). So it's kind of a pain. But I will work on that soon.

                        Thanks again.

                        • 9. Re: Referenced datasource not found with JBoss 5.0 (Beta4)
                          jaikiran

                           

                          "depryf" wrote:

                          although this is not something I would expect to change from 4.X to 5.0 ;-)



                          I don't know how its working for you on JBoss-4.2.2. On my local setup, this does not work on 4.2.2 nor on 5.0, as expected.


                          • 10. Re: Referenced datasource not found with JBoss 5.0 (Beta4)
                            jaikiran

                             

                            "depryf" wrote:


                            I am going to try to add the references in the EJB context. This is not very simple because we don't currently have a ejb-jar.xml or jboss.xml file; we only use annotations to define our session beans. I can easily add those files, but I have to define every single EJB since they all access our database (and there are many of them). So it's kind of a pain. But I will work on that soon.



                            Since you are using annotations, you need not create those ejb-jar.xml or jboss.xml. In your EJBs you can add this @Resources class level annotation:


                            @Resources( {
                             @Resource(type = DataSource.class, name = "app-specific/datasource", mappedName = "java:/app/datasource")
                             })
                            public class MyBean implements MyInterface {
                            


                            This is equivalent to having the resource-ref defined in the ejb-jar.xml and jboss.xml.