7 Replies Latest reply on Feb 11, 2012 1:28 PM by fabrizio.benedetti

    Frustration has set in.  Need assistance.

    cbroussard

      Hello All,

       

      I was hoping somebody could point me in a direction of sanity

       

      I've been a jboss 2,3,4 user.  After taking a few years off of development I'm getting back into jboss 6 and hitting some roadblocks (Either cause I don't remember or the behavior has changed).

       

      This is what I'm trying to do.

       

      I have written a custom valve that I have chained in the tomcat jboss-web.sar.  I'm able to access/execute that fine.  During that invocation I attempt to make a jmx call into an mbean.  I'm getting a class not found exception for the jnp name factory during this

       

      MBeanServerConnection server = (MBeanServerConnection)new InitialContext().lookup("jmx/rmi/RMIAdaptor");

       

      I've attempted to copy the client/jnp-client.jar in literally every directory location I could find to attempt to add it to the classpath.  But I haven't been able to find it.  I've even tried to copy the entire client/*.jar files around that just causes havoc.  What's the easiest way to get this to work?  I will also be doing EJB3 remote calls from Web to Ear and from Ear to Ear.  I'm getting concerned that I won't be able to do lookups on that either.

       

      I was able to write a lot of business code in a short period of time, but have completely hit this roadblock for a couple days.   Can somebody please assist?

       

      Thanks In Advance!


      Chris

        • 1. Re: Frustration has set in.  Need assistance.
          jaikiran

          Please post the entire exception stacktrace. Also which exact version of JBoss AS6 are you using?

           

          P.S: AS6 and previous versions of JBoss AS are no longer in development. AS7 is the latest version available and actively developed. 7.1.0.Final is being released very soon.

          • 2. Re: Frustration has set in.  Need assistance.
            cbroussard

            Hi Jaikiran,

             

            Thank you for taking the time to respond.  Here's the information you requested:

             

            02:12:19,154 ERROR [STDERR] javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

            02:12:19,155 ERROR [STDERR]     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)

            02:12:19,155 ERROR [STDERR]     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

            02:12:19,155 ERROR [STDERR]     at javax.naming.InitialContext.init(InitialContext.java:223)

            02:12:19,155 ERROR [STDERR]     at javax.naming.InitialContext.<init>(InitialContext.java:175)

            02:12:19,155 ERROR [STDERR]     at com.frostylabs.es.jmx.jboss.bindings.client.impl.LocalClientImpl.getContext(LocalClientImpl.java:23)

             

            in

             

            server/%name%/conf/jboss-service.xml i have

             

               <classpath codebase="${jboss.server.lib.url}" archives="*"/>

               <classpath codebase="${jboss.common.lib.url}" archives="*"/>

               <classpath codebase="${jboss.server.lib.url}/lightedworks" archives="*"/>

             

            inside lightedworks folder i have a couple jars i've created that house the Valve Code and jmx bindings code.  This is the location that I attempted to put all the client jars.

             

            Any ideas?

             

            Thanks,

             

            Chris

             

            [edit]

             

            ps.. forgot to say.. i'm on JBossAS [6.0.0.Final "Neo"]

            • 3. Re: Frustration has set in.  Need assistance.
              jaikiran

              Chris Broussard wrote:

               

               

              02:12:19,154 ERROR [STDERR] javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

              02:12:19,155 ERROR [STDERR]     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)

              02:12:19,155 ERROR [STDERR]     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

              02:12:19,155 ERROR [STDERR]     at javax.naming.InitialContext.init(InitialContext.java:223)

              02:12:19,155 ERROR [STDERR]     at javax.naming.InitialContext.<init>(InitialContext.java:175)

              02:12:19,155 ERROR [STDERR]     at com.frostylabs.es.jmx.jboss.bindings.client.impl.LocalClientImpl.getContext(LocalClientImpl.java:23)

               

              in

               

              Is that exception on the server side? Also, I think that's not the complete stacktrace, can you please post the full one.

               

               

               

              Chris Broussard wrote:

              server/%name%/conf/jboss-service.xml i have

               

                 <classpath codebase="${jboss.server.lib.url}" archives="*"/>

                 <classpath codebase="${jboss.common.lib.url}" archives="*"/>

                 <classpath codebase="${jboss.server.lib.url}/lightedworks" archives="*"/>

               

              inside lightedworks folder i have a couple jars i've created that house the Valve Code and jmx bindings code.  This is the location that I attempted to put all the client jars.

               

              I don't think you would need all that. I would recommend that you not change the jboss-service.xml and instead just place your jars in the JBOSS_HOME/server/<servername>/lib folder directly or maybe in JBOSS_HOME/common/lib depending on how you want to distribute it.

              • 4. Re: Frustration has set in.  Need assistance.
                cbroussard

                Hi Jaikiran,

                 

                Just got home from work.. Sorry I didn't include the entire stack originally.  Here it is:

                 

                17:38:56,283 INFO  [STDOUT] com.lightedworks.sso.agent.SimpleSessionCatalinaValve DEBUG begin invoked.

                17:38:56,303 ERROR [STDERR] javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

                17:38:56,304 ERROR [STDERR]     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)

                17:38:56,304 ERROR [STDERR]     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

                17:38:56,304 ERROR [STDERR]     at javax.naming.InitialContext.init(InitialContext.java:223)

                17:38:56,305 ERROR [STDERR]     at javax.naming.InitialContext.<init>(InitialContext.java:175)

                17:38:56,305 ERROR [STDERR]     at com.frostylabs.es.jmx.jboss.bindings.client.impl.ProtectionRuleClientImpl.getRule(ProtectionRuleClientImpl.java:42)

                17:38:56,305 ERROR [STDERR]     at com.lightedworks.sso.agent.ProtectionRulesProcessor.initialize(ProtectionRulesProcessor.java:39)

                17:38:56,305 ERROR [STDERR]     at com.lightedworks.sso.agent.SimpleSessionCatalinaValve.initialize(SimpleSessionCatalinaValve.java:207)

                17:38:56,305 ERROR [STDERR]     at com.lightedworks.sso.agent.SimpleSessionCatalinaValve.invoke(SimpleSessionCatalinaValve.java:142)

                17:38:56,306 ERROR [STDERR]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                17:38:56,306 ERROR [STDERR]     at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)

                17:38:56,306 ERROR [STDERR]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)

                17:38:56,306 ERROR [STDERR]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                17:38:56,306 ERROR [STDERR]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)

                17:38:56,307 ERROR [STDERR]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)

                17:38:56,307 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:680)

                17:38:56,307 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory

                17:38:56,307 ERROR [STDERR]     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

                17:38:56,307 ERROR [STDERR]     at java.security.AccessController.doPrivileged(Native Method)

                17:38:56,308 ERROR [STDERR]     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

                17:38:56,308 ERROR [STDERR]     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

                17:38:56,308 ERROR [STDERR]     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

                17:38:56,308 ERROR [STDERR]     at java.lang.Class.forName0(Native Method)

                17:38:56,308 ERROR [STDERR]     at java.lang.Class.forName(Class.java:247)

                17:38:56,309 ERROR [STDERR]     at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)

                17:38:56,309 ERROR [STDERR]     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)

                17:38:56,309 ERROR [STDERR]     ... 14 more

                17:38:56,315 INFO  [STDOUT] initialize

                 

                The exception happens from the catalina valve.  I'm trying to make jmx call to retrieve some configuration data out of the management bean.

                 

                any ideas?

                 

                again much appreciation for your time and effort on this.

                 

                Chris

                • 5. Re: Frustration has set in.  Need assistance.
                  fabrizio.benedetti

                  It is a strange behaviour.

                   

                  Anyway I think you don't need to make a JNDI lookup to get local MBeanServerConnection.

                  Try this:

                   

                  MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();
                  

                   

                  Regards

                  /Fabrizio

                  • 6. Re: Frustration has set in.  Need assistance.
                    cbroussard

                    Hi Fabrizio!

                     

                    That worked!!  I got further... Still trying to isolate the container error... But when you said 'It is a strange behavior' you are talking about ClassNotFoundException or something else?

                     

                    Thanks!

                     

                    Chris

                    • 7. Re: Frustration has set in.  Need assistance.
                      fabrizio.benedetti

                      Happy for you.

                       

                      Yes, about ClassNotFoundException. Class org.jnp.interfaces.NamingContextFactory should be always available, also for tomcat valves. Problably your valve runs in a different classloader.

                      I would follow Jaikiran's advice,  with a clean jboss installation and putting your jars only in JBOSS_HOME/server/<servername>/lib folder.

                       

                      Anyway JNDI lookup is needed only when you want to retrieve remote MBeanServerConnection.

                       

                      Regards

                      /Fabrizio