Get NPE using JNDI with Jboss AS7
goldwater Sep 30, 2013 2:09 AMI checked on everything and seems well configured, this is a Spring application and no explicitly calling @Resource or Ctx anywhere within the application
this is the error message from console
00:55:37,867 INFO [org.jboss.as.server] (HttpManagementService-threads - 3) JBA
S015870: Deploy of deployment "MyApp.war" was rolled back with
failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"
MyApp.war\".INSTALL" => "org.jboss.msc.service.StartException in se
rvice jboss.deployment.unit.\"MyApp.war\".INSTALL: JBAS018733:
Failed to process phase INSTALL of deployment \"MyApp.war\"
Caused by: java.lang.NullPointerException"}}
Error message from log
00:55:37,852 WARN [org.jboss.as.ee] (MSC service thread 1-4) JBAS011006: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.springframework.web.context.request.async.StandardServletAsyncWebRequest
at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606) [jboss-as-ee-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:83) [jboss-as-ee-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
00:55:37,862 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."MyApp.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyApp.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "MyApp.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
Caused by: java.lang.NullPointerException
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:261)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:118)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]
... 5 more
This is the JNDI data source setup in standalone.xml
<datasource jndi-name="java:/MyDS" pool-name="pool_oc" enabled="true" use-java-context="true"> <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url> <driver>oracle_driver</driver> <pool> <min-pool-size>1</min-pool-size> <max-pool-size>2</max-pool-size> <use-strict-min>false</use-strict-min> </pool> <security> <user-name>username</user-name> <password>password</password> </security> <validation> <validate-on-match>false</validate-on-match> <background-validation>false</background-validation> </validation> <statement> <share-prepared-statements>false</share-prepared-statements> </statement> </datasource> <driver name="oracle_driver" module="oracle"> <driver-class>oracle.jdbc.pool.OracleConnectionPoolDataSource</driver-class> </driver>
And this is the jndi configuration in web.xml
<resource-ref> <description>JNDI Oracle Datasource</description> <res-ref-name>java:/MyDS</res-ref-name> <jndi-name>jdbc/MyDS</jndi-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Through all the application, the JNDI data source is named as jbdc/MyDS. But I guess that's not the issue.
Then I really cannot think anything else might produce above error.
Current Jboss core is: 7.1.2 Final, please help thanks.