2 Replies Latest reply on Jul 11, 2002 4:09 PM by atorres

    JBoss 3.0.0RC3: How to get java:comp/env/jdbc/myDS accessabl

    ikestrel

      I'm trying to get this code:

      context.lookup("java:comp/env/jdbc/myDS");

      to work from a servlet. If I change it to:

      context.lookup("java:/jdbc/myDS");

      Then it works. However, for certain reason, I don't want to change that. I want the java:comp namespace to work. How can I make that happen?

      I'm using an expanded Ear directory structure with expanded War dirs.

        • 1. Re: JBoss 3.0.0RC3: How to get java:comp/env/jdbc/myDS acces
          mefesto78

          did you include a jboss-web.xml file in your web application's WEB-INF folder? You can specifiy jndi mappings within that file like this:

          <jboss-web>
            <resource-ref>
              <res-ref-name>jdbc/myDS</res-ref-name>
              <jndi-name>java:/jdbc/myDS</jndi-name>
            </resource-ref>
          </jboss-web>

          That way you will not have to edit source code no matter where the resource is really located on you jndi server. Which also makes moving your app from one environment to another simple.

          • 2. Re: JBoss 3.0.0RC3: How to get java:comp/env/jdbc/myDS acces

            I have similiar problem. I will not use any proprietary XML conf file. My EAR HAVE to be app server independent. But as long as I have seen, every App server is trying to sabotage plataform independence...
            It´s IMPOSSIBLE to build an EAR that works in JBOss and Sun´s J2EE. That´s my opinion. And it happens becouse of this comp/env incompatibility. If you get any closed EAR that access DB from Sun it will not work unchanged on Jboss.
            I´d like to see an EAR that works unchanged and only with sun´s default XML configuration, with Entity beans,session beans, servlets, jsp and DB access that work on JBoss and J2ee. As I doubt that it will work unchanged in other Web App Servers ...