3 Replies Latest reply on Jul 3, 2012 10:42 AM by ctomc

    Issue with reflections

    johnwasmat

      Hello,

       

      I have a JBoss server running with a certain JAVA_HOME. I have a pub sub JMS application running in eclipse. I do some looks using reflections in the JMS application. The JMS application doesnt throw any error while looking up with reflections but when the server is running it fails to retrieve the class name. The following is the reflection error.

       

      java.lang.reflect.InvocationTargetException

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

                at java.lang.reflect.Constructor.newInstance(Unknown Source)

       

      Is this an issue with the JVM? I`m assuming tht whenever I run an application from eclipse its using a different JVM. Also if not is it tht JBoss and the application from ecipse are referring to the same jdk which is causing the problem? Thanks for reading this post. Any help is appreciated.

        • 1. Re: Issue with reflections
          ctomc

          Hi,

           

          what is the exact jdk your are using?

          what is the full stacktrace you get? i.e.

          how does your code that "dies" look like?

           

           

          --

          tomaz

          • 2. Re: Issue with reflections
            johnwasmat

            Hello Tomaz,

             

            I have jdk 1.7 installed. Can i have multiple instances of jdk 1.7 installed on the same machine? Following is the stacktrace

             

            SEVERE: Exception in SetupEventTypes()null

            java.lang.reflect.InvocationTargetException

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

                      at java.lang.reflect.Constructor.newInstance(Unknown Source)

                      at com.test.Engine.Init(Engine.java:78)

                      at com.test.Engine.<init>(Engine.java:34)

                      at com.test.Engine.getInstance(Engine.java:42)

                      at com.test.JMSRecvClient.<init>(JMSRecvClient.java:50)

                      at com.test.JMSRecvClient.main(JMSRecvClient.java:165)

            Caused by: java.lang.NoClassDefFoundError: org/antlr/runtime/tree/TreeNodeStream

                      at com.test.EPAdministratorImpl.createEPLStmt(EPAdministratorImpl.java:117)

                      at com.test.EPAdministratorImpl.createEPL(EPAdministratorImpl.java:67)

                      at com.test<init>(EPLStatements.java:24)

                      ... 9 more

            Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.tree.TreeNodeStream

                      at java.net.URLClassLoader$1.run(Unknown Source)

                      at java.net.URLClassLoader$1.run(Unknown Source)

                      at java.security.AccessController.doPrivileged(Native Method)

                      at java.net.URLClassLoader.findClass(Unknown Source)

                      at java.lang.ClassLoader.loadClass(Unknown Source)

                      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                      at java.lang.ClassLoader.loadClass(Unknown Source)

            • 3. Re: Issue with reflections
              ctomc

              Hi,

               

              you problem is right there there is antlr missing from your classpath

               

              you can add it by adding dependancy to module org.antrl via manifest.mf or jboss-deployment-structure.xml

               

               

              --

              tomaz