7 Replies Latest reply on Sep 27, 2002 12:33 PM by dkelsey

    Deployment attempts to access package private methods

    dkelsey

      I have a resource adapter which contains package private methods in it's managed connection factory. JBOSS 3.02 fails to deploy this resource adapter saying it failed to access the package private method.

      I don't understand why JBOSS would want or need to do this ? Can someone shed any light. I wouldn't say this type of activity is required by the JCA specification

      regards

        • 1. Re: Deployment attempts to access package private methods
          davidjencks

          More info please. JBoss only calls jca interface methods and getter/setters for an attribute you are trying to set.

          There are some circumstances where you can get an IllegalAccessError if you have 2 copies of a class deployed at once, and some versions of jboss that deployed most packages twice, encouraging this problem. This was fixed before 3.0.2 however.

          • 2. Re: Deployment attempts to access package private methods
            dkelsey

            I have an abstract class EISManagedConnectionFactory which defines and implements a package private method getLogHelper(). My real SysManagedConnectionFactory (defined in the deployment descriptor) inherits this and provides the concrete implementation. All the classes are in the same package and I know the resource adapter works as I have deployed and used successfully in other J2EE Servers.
            None of the XML used for deployment or creation of connection factories refer to this property. However when I try to deploy into JBOSS 3.02 I get the message FAILED unable to access getLogHelper() defined in EISManagedConnectionFactory, class was SysManagedConnectionFactory.

            It may be that it is a package private getter method that is causing the problem ?

            • 3. Re: Deployment attempts to access package private methods
              davidjencks

              This is odd. I have only seen this error if the classes are loaded twice, either because there are 2 deployed jars containing them or because of a bug in the jboss classloaders.

              I'd be interested in:

              a stack trace

              what happens if you make the method public

              can you print out the classloaders for the EISManagedConnectionFactory and the SysManagedConnectionFactory and see if they are the same (and report what they are)?

              thanks
              david jencks

              • 4. Re: Deployment attempts to access package private methods
                dkelsey

                It turns out that an IllegalAccessError is generated when a ConnectionFactory is being created. The createConnectionFactory in SysManagedConnectionFactory calls a method in the super class, getLogHelper in EISManagedConnectionFactory which is package private and it get's the illegal access error when it tries to do this.

                EISManagedConnectionFactory is packaged in one jar file in the RAR file, by SysManagedConnectionFactory is packaged in a different RAR file.

                If I package them in the same jar file, then deployment works ok. We would prefer not to change our packaging process as it will affect other things we build.

                It seems to me to be a strange class loader issue. I don't know how to get the classloader information you requested, but for your info the stack trace follows

                org.jboss.deployment.DeploymentException: Could not create deployment: file:/C:/products/jboss-3.0.2/server/default/deploy/EISSys.rar; - nested throwable: (java.lang.IllegalAccessError: try to access method com.ibm.connector2.EIS.EISManagedConnectionFactory.getLogHelper()Lcom/ibm/connector2/EIS/EISLogHelper; from class com.ibm.connector2.EIS.SysManagedConnectionFactory)
                at org.jboss.deployment.MainDeployer.start(MainDeployer.java:822)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
                at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                at $Proxy4.deploy(Unknown Source)
                at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
                at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:648)
                at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
                at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:261)
                at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
                at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
                at $Proxy0.start(Unknown Source)
                at org.jboss.system.ServiceController.start(ServiceController.java:396)
                at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                at $Proxy3.start(Unknown Source)
                at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
                at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:564)
                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:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
                at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
                at org.jboss.Main.boot(Main.java:142)
                at org.jboss.Main$1.run(Main.java:375)
                at java.lang.Thread.run(Thread.java:536)
                Caused by: java.lang.IllegalAccessError: try to access method com.ibm.connector2.EIS.EISManagedConnectionFactory.getLogHelper()Lcom/ibm/connector2/EIS/EISLogHelper; from class com.ibm.connector2.EIS.SysManagedConnectionFactory
                at com.ibm.connector2.EIS.SysManagedConnectionFactory.createConnectionFactory(SysManagedConnectionFactory.java:119)
                at org.jboss.resource.connectionmanager.RARDeployment.startManagedConnectionFactory(RARDeployment.java:578)
                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:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.startService(BaseConnectionManager2.java:382)
                at org.jboss.resource.connectionmanager.LocalTxConnectionManager.startService(LocalTxConnectionManager.java:179)
                at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
                at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
                at $Proxy5.start(Unknown Source)
                at org.jboss.system.ServiceController.start(ServiceController.java:396)
                at org.jboss.system.ServiceController.start(ServiceController.java:416)
                at org.jboss.system.ServiceController.start(ServiceController.java:416)
                at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                at $Proxy9.start(Unknown Source)
                at org.jboss.resource.RARDeployer.start(RARDeployer.java:212)
                at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
                ... 45 more




                • 5. Re: Deployment attempts to access package private methods
                  davidjencks

                  It certainly looks like a classloader issue. How proprietary is the adapter? Is there any chance you could send it to me to experiment with? If not, would you be willing to try deploying on jboss 3.2?

                  thanks
                  david jencks

                  davidjencks@directvinternet.com

                  • 6. Re: Deployment attempts to access package private methods
                    dkelsey

                    I am afraid it is proprietry, but I will certainly try JBOSS 3.2 for you.

                    • 7. Re: Deployment attempts to access package private methods
                      dkelsey

                      I am afraid it is proprietry, but I will certainly give JBOSS 3.2 a try.