5 Replies Latest reply on Feb 17, 2012 5:22 AM by Wilson.T-Oracle

    NoPermissionException when deploying a RAR inside a Shared library EAR.


      I have a deployment issue concerning a resource adapter in shared library.
      I have an EAR containing a RAR. and an EJB jar with a stateless session EJB in charge of invoking the Resource Adapater (by lookup).

      If I deploy this EAR as an application, it works.
      But If I deploy this EAR as shared library and I link it to another EAR deployed as an application, I have the following deployment issue:
      javax.naming.NoPermissionException: A Resource Adapter may only be accessed from within the same application from which it was deployed.
              at weblogic.connector.outbound.RAOutboundManager.getConnectionFactory(RAOutboundManager.java:765)
              at weblogic.connector.deploy.JNDIHandler.getConnectionFactory(JNDIHandler.java:1015)
              at weblogic.connector.deploy.JNDIHandler.lookupObject(JNDIHandler.java:869)
              at weblogic.connector.deploy.JNDIHandler.getObjectInstance(JNDIHandler.java:843)
              at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
              at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:255)
              at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
              at javax.naming.InitialContext.lookup(InitialContext.java:392)
              at com.mycompany.myEJB.initContext(myEJB.java:100)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.invokeLifecycleMethod(Jsr250Metadata.java:332)
              at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.invokeLifecycleMethod(Jsr250Metadata.java:326)
      What I don't understand is: even if my application name change (in one case, the name of the EAR containing the RAR, in the other case, the classical EAR name) my packaginig is still the same: the myEJB lookup a Resource adapter which is inside the same EAR and the same application.

      What is wrong ? Do you think it is a potential weblogic bug related to sharedlib deployment ?

      Thank you for helping,
      Best Regards,
        • 1. Re: NoPermissionException when deploying a RAR inside a Shared library EAR.
          René van Wijk
          You edit the weblogic-ra.xml of your resource adapter and set enable-access-outside-app to true.

          The default value is false, which means you cannot access the resource outside of the application.

          Look here (http://docs.oracle.com/cd/E17904_01/web.1111/e13732/weblogic_ra_xml.htm) for more information:

          "enable-access-outside-app - As stated by the J2CA 1.5 Specification, if the resource adapter is packaged within an application (in other words, within an EAR),
          only components within the application should have access to the resource adapter. This element allows you to override this functionality."
          • 2. Re: NoPermissionException when deploying a RAR inside a Shared library EAR.

            Thank you for answering,
            The problem with this solution, is if you set "enable-access-outside-app" to true, you will not be able to use production redeployment.

            As my application should be hot patchable, I need to manage production redeployment.

            In order to manage production redeployment, if an Enterprise Application includes a JCA resource adapter module, the module:
            - Must be JCA 1.5 compliant
            - Must implement the weblogic.connector.extensions.Suspendable interface
            - Must be used in an application-scoped manner, having enable-access-outside-app set to false (the default value).

            I've tried and I have a deployment exception because of versioning..

            In any case, I can't understand why I need to that as i'm in the same application.

            Best Regards,
            • 3. Re: NoPermissionException when deploying a RAR inside a Shared library EAR.
              how did you define shared lib ear and refer it in another ear? can you post the MANIFEST.MF, application.xml and weblogic-application .xml of your 2 ear files (or only relative snippet)?
              • 4. Re: NoPermissionException when deploying a RAR inside a Shared library EAR.

                I've defined my Shared lib EAR using its MANFIEST.MF file just like that :
                Manifest-Version: 1.0
                Ant-Version: Apache Ant 1.8.1
                Created-By: 1.6.0_22-b04 (Sun Microsystems Inc.)
                Implementation-Version: 1.1.3
                Implementation-Vendor: XXXXXXX Software
                Specification-Version: 1.1
                Specification-Title: xxxx
                Copyright: Copyright (c) 2012 XXXXXXX 
                Weblogic-Application-Version: 1.1.3
                And I reference it from my plain EAR using deployment plan (for dynamic configuration of my solution)
                    <module-descriptor external="false">
                  <config-root xsi:nil="true"></config-root>
                I use this mechanism for more than 20 EAR shared lib linked to my classical EAR. it works well, everything seems to be well deployed but the lookup from EAJ to Adaptor raised this permission Exception...

                Thank you if you can help.

                Best Regards,
                • 5. Re: NoPermissionException when deploying a RAR inside a Shared library EAR.
                  I went though WLS doc again and my understanding is that WLS does NOT officially support embedded RAR in shared lib EAR.
                  A shared Java EE library can be any of the following:
                  * standalone EJB module
                  * standalone Web application module
                  * multiple EJB modules packaged in an enterprise application
                  * multiple Web application modules package in an enterprise application
                  * single plain JAR file