JBoss Community

Re: JNDI Lookup fails in JBoss AS 7 [java.naming.CommunicationException]

created by Kousik Rajendran in JNDI and Naming - View the full discussion

Abiya,

 

I am not seeing your datasource loaded before the deployment of your servlet. Are you sure that your datasource is loaded before your web app?

because, in my case its working for startup servlets too. Checkout my output. Here, the datasource is loaded way back this web app is loaded.

 

18:15:52,229 INFO  [org.jboss.web] (MSC service thread 1-2) registering web context: /core

18:15:52,560 INFO  [stdout] (MSC service thread 1-15) Success getting DS : class org.jboss.jca.adapters.jdbc.WrapperDataSource

18:15:52,562 INFO  [org.jboss.web] (MSC service thread 1-15) registering web context: /test

18:15:52,584 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Replaced deployment "test.ear" with deployment "test.ear"

 

And for your basic question, you can have it anywhere. Normally, I will not suggest you to have DB activities in servlet, use MVC implemetation.

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community