0 Replies Latest reply on Sep 3, 2008 9:27 AM by Paul Curran

    jboss-service.xml classpath element using HTTP protocol

    Paul Curran Newbie

      Hi All,

      I've been searching around, but I can't find anywhere that shows me the correct format for including an external JAR file using the HTTP protocol.

      In the jboss-service DTD, it reads:

      <!-- The codebase attribute specifies the base URL from which the jars or classes
      are loaded from. If the codebase is '.' then it is equal to the mbean deployment URL.
      Otherwise, it is resolved as a path spec relative to the serverHomeURL (e.g., file:/jboss-3.2.0)
      using the URL ctor URL(serverHomeURL, codebase)
      
      Examples:
      
       <classpath codebase='.' archives='util.jar' />
       <classpath codebase='http://classloader.dot.com' archives='*' />
       <classpath codebase="lib" archives="*"/>
      -->


      So, I've set up two jboss servers on my machine, and the both start without issue without including this extra classpath entry in the conf/jboss-service.xml file.

      The second jboss instance (or the "external" one in relation to my main instance) has a deployed WAR containg the JAR file. When I enter the URL in my browser, the save dialog pops up asking me if I want to save the JAR file to the file system, therefore indicating the context is propely deployed, and the JAR is available:

      http://localhost:9080/mycontext/my-external-jar.jar


      However, when I add this element to jboss-service.xml:

      <classpath codebase="http://localhost:9080/mycontext" archives="my-external-jar.jar"/>
      



      I get this exception almost immediately:

      12:57:41,382 ERROR [MainDeployer] Could not initialise deployment: file:/C:/JBoss/jboss-4.0.5/server/default/conf/jboss-service.xml
      java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpException
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
       at java.lang.Class.getConstructor0(Class.java:2671)
       at java.lang.Class.newInstance0(Class.java:321)
       at java.lang.Class.newInstance(Class.java:303)
       at org.jboss.net.protocol.URLListerFactory.createURLLister(URLListerFactory.java:70)
       at org.jboss.net.protocol.URLListerFactory.createURLLister(URLListerFactory.java:53)
       at org.jboss.deployment.SARDeployer.parseXMLClasspath(SARDeployer.java:556)
       at org.jboss.deployment.SARDeployer.init(SARDeployer.java:193)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:872)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:809)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
       at org.jboss.Main.boot(Main.java:200)
       at org.jboss.Main$1.run(Main.java:490)
       at java.lang.Thread.run(Thread.java:595)
      Failed to boot JBoss:
      org.jboss.deployment.DeploymentException: Could not initialise deployment: file:/C:/JBoss/jboss-4.0.5/server/default/conf/jboss-service.xml;
      - nested throwable: (java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpException)
       at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:814)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
       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:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
       at org.jboss.Main.boot(Main.java:200)
       at org.jboss.Main$1.run(Main.java:490)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpException
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
       at java.lang.Class.getConstructor0(Class.java:2671)
       at java.lang.Class.newInstance0(Class.java:321)
       at java.lang.Class.newInstance(Class.java:303)
       at org.jboss.net.protocol.URLListerFactory.createURLLister(URLListerFactory.java:70)
       at org.jboss.net.protocol.URLListerFactory.createURLLister(URLListerFactory.java:53)
       at org.jboss.deployment.SARDeployer.parseXMLClasspath(SARDeployer.java:556)
       at org.jboss.deployment.SARDeployer.init(SARDeployer.java:193)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:872)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:809)
       ... 21 more
      12:57:41,397 INFO [Server] Runtime shutdown hook called, forceHalt: true
      12:57:41,397 INFO [Server] JBoss SHUTDOWN: Undeploying all packages
      12:57:41,413 INFO [Server] Shutdown complete
      Shutdown complete
      Halting VM
      Press any key to continue . . .
      



      I've had a look in the "server/default/lib" directory, and the commons httpclient JAR is present, and does contain the HttpException class, so anyone know why I might be getting this, or if I have the correct format in the classpath XML element?

      Do I need to re-order the deployment items? (JAR, WAR, etc...)