[jboss-user] [JNDI/Naming/Network] - JNDI name not bound when	servlet initializes
    jon_french@fws.gov 
    do-not-reply at jboss.com
       
    Wed Aug  2 20:13:11 EDT 2006
    
    
  
JBOSS 4.0.3.SP1
I have a servlet which on initialization (i.e. a call to its init(ServletContext) method) attempts to do a JNDI lookup to a datasource defined in a *-ds.xml file in my deploy directory. This works just fine as long as the servlet is not loaded when the context is loaded (i.e. the servlet's <load-on-startup> element is not defined).
However, when I set <load-on-startup> to a positive integer, the servlet initialization errors with a javax.naming.NameNotFoundException when trying to lookup the JNDI datasource name. To fix the error, all I have to do is touch the application's jboss-service.xml file to re-deploy the application. Presumably since the JNDI datasource is now correctly bound, the servlet initializes without difficulty.
Thus it seems as though my problem is that my sar (and thus the servlet context) is being deployed by JBoss before the Datasource is bound to JNDI. Is there  a way in which to change this deployment ordering? I've tried many     different hacks to try to get JBoss to bind the JNDI name before my context is loaded, all with no luck.
Can anyone help!?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962678#3962678
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962678
    
    
More information about the jboss-user
mailing list