Kousik Rajendran [
http://community.jboss.org/people/kousikraj] created the discussion
"Re: JNDI Lookup fails in JBoss AS 7 [java.naming.CommunicationException]"
To view the discussion, visit:
http://community.jboss.org/message/638867#638867
--------------------------------------------------------------
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
[
http://community.jboss.org/message/638867#638867]
Start a new discussion in JNDI and Naming at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]