EasyBeans
  1. EasyBeans
  2. EZB-173

Resources defined in context.xml are inaccessible

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EasyBeans 1.0 M6
    • Fix Version/s: EasyBeans 1.0 RC1
    • Component/s: Integration/Tomcat
    • Labels:
      None
    • Environment:
      Windows XP Pro, Tomcat 5.5.23, JDK 1.5.0_12
    • Global Rank:
      1990

      Description

      I have an Easybeans webapp inside Tomcat.
      If I deploy a web application (WAR archive) inside an EAR archive through easybeans-deploy archive, the resources defined in
      context.xml file inside the WAR are inaccessible through InitialContext.

      My context.xml inside WAR archive (META-INF) looks something like this:
      <?xml version="1.0" encoding="UTF-8"?>
      <Context antiJARLocking="false" antiResourceLocking="false">

      <!-- JDO/JPOX database -->
      <Resource name="mywebapp/myDB" type="javax.sql.DataSource"
      factory="org.apache.commons.dbcp.BasicDataSourceFactory"
      url="jdbc:mysql://127.0.0.1:3318/naviexpert"
      driverClassName="com.mysql.jdbc.Driver"
      username="myuser"
      password="mypass"
      maxWait="5000" maxIdle="100" maxActive="50" />

      </Context>

      I used to access it through default InitialContext:
      InitialContext initialContext = new InitialContext();
      DataSource ds = (DataSource) initialContext.lookup("java:comp/env/naviexpert/jdoDB");

      I know the reason it doesn't work now - EasyBeans provides its own naming service which overrides Tomcat's.
      I just need a way to access the resource defined in the context.xml.

        Activity

        Hide
        Paweł Krupiński
        added a comment -

        My application.xml:
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE application PUBLIC
        "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
        "http://java.sun.com/dtd/application_1_3.dtd">

        <application>
        <display-name>Myapp</display-name>
        <module>
        <ejb>myejb.jar</ejb>
        </module>
        <module>
        <web>
        <web-uri>mywebapp.war</web-uri>
        <context-root>mywebapp</context-root>
        </web>
        </module>
        </application>

        Maybe it's something with the context-root?

        Show
        Paweł Krupiński
        added a comment - My application.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd"> <application> <display-name>Myapp</display-name> <module> <ejb>myejb.jar</ejb> </module> <module> <web> <web-uri>mywebapp.war</web-uri> <context-root>mywebapp</context-root> </web> </module> </application> Maybe it's something with the context-root?
        Hide
        Paweł Krupiński
        added a comment -

        In the context I have following objects (path and .toString() output):

        /javax.transaction.UserTransaction org.jacorb.orb.Reference
        /JQCF org.jacorb.orb.Reference
        /TCF org.jacorb.orb.Reference
        /joramActivationSpec org.jacorb.orb.Reference
        /JCF org.jacorb.orb.Reference
        /TMFactory org.jacorb.orb.Reference
        /CF org.jacorb.orb.Reference
        /JTCF org.jacorb.orb.Reference
        /jdbc_1 org.jacorb.orb.Reference
        /jdbc_2 org.jacorb.orb.Reference
        //EasyBeansConnector org.jacorb.orb.Reference
        /com.mypackage.MyBean_com.mypackage.MyInterface@Local org.jacorb.orb.Reference
        /QCF org.jacorb.orb.Reference
        /com.mypackage.MyBean_com.mypackage.MyInterface@Remote org.jacorb.orb.Reference
        /RMI_SERVER_RPC org.jacorb.orb.Reference

        Show
        Paweł Krupiński
        added a comment - In the context I have following objects (path and .toString() output): /javax.transaction.UserTransaction org.jacorb.orb.Reference /JQCF org.jacorb.orb.Reference /TCF org.jacorb.orb.Reference /joramActivationSpec org.jacorb.orb.Reference /JCF org.jacorb.orb.Reference /TMFactory org.jacorb.orb.Reference /CF org.jacorb.orb.Reference /JTCF org.jacorb.orb.Reference /jdbc_1 org.jacorb.orb.Reference /jdbc_2 org.jacorb.orb.Reference //EasyBeansConnector org.jacorb.orb.Reference /com.mypackage.MyBean_com.mypackage.MyInterface@Local org.jacorb.orb.Reference /QCF org.jacorb.orb.Reference /com.mypackage.MyBean_com.mypackage.MyInterface@Remote org.jacorb.orb.Reference /RMI_SERVER_RPC org.jacorb.orb.Reference
        Hide
        Florent Benoit
        added a comment -

        Paweł,

        The fix is present in the current SVN trunk. (it will be available in the next nightly build).

        The file was not analyzed when EasyBeans was given the .war files to Tomcat.
        By default, Tomcat Context is not analyzing the META-INF/context.xml, this order has to be sent by the caller (which is EasyBeans for us) or by Tomcat deployment tools (when used inside Tomcat).

        I will close this issue when you will inform me that it works on your side.

        Show
        Florent Benoit
        added a comment - Paweł, The fix is present in the current SVN trunk. (it will be available in the next nightly build). The file was not analyzed when EasyBeans was given the .war files to Tomcat. By default, Tomcat Context is not analyzing the META-INF/context.xml, this order has to be sent by the caller (which is EasyBeans for us) or by Tomcat deployment tools (when used inside Tomcat). I will close this issue when you will inform me that it works on your side.
        Hide
        Florent Benoit
        added a comment -

        No answer from the reporter but as it is fixed for me, issue is now closed

        Show
        Florent Benoit
        added a comment - No answer from the reporter but as it is fixed for me, issue is now closed
        Hide
        Loïc Albertin
        added a comment -

        Closing old resolved issues

        Show
        Loïc Albertin
        added a comment - Closing old resolved issues

          People

          • Assignee:
            Florent Benoit
            Reporter:
            Paweł Krupiński
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Issue deployment