5 Replies Latest reply on Jan 7, 2003 4:19 PM by pgarvie

    javax.resource.ResourceException: Apparently wrong driver cl

    rsfeir

      This is the strangest problem I've run into. I have an app which runs fine on my laptop (OS X 10.2.1). Today I tried deploying a new install to a new OS X machine, also 10.2.1, and for some reason I get the error below! it's basically telling me that org.postgresql.Driver is not the right class to connect to postgresql... what? how is this possible?

      I've already checked with the Jetty people since it looked like it was on their end, they checked and it's not and I concurr since I am using JNDI and that piece is a JBoss piece. If anyone has seen this and solved it before on ANY platform, would you be so kind to reply and let me know what the heck the magic trick is???

      Running JBoss 3.0.2 OR JBoss 3.0.3 (Error happens on both, did not test JBoss 3.2)

      The uglyness:

      10:20:19,828 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@920b9998{ url=file:/Volumes/ClassicLleaping/usr/local/jboss-3.0.2/server/default/ deploy/rex.war/, deployedLastModified=0 }
      org.jboss.deployment.DeploymentException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgresql://localhost:5432/rex; - nested throwable: (javax.resource.ResourceException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgresql://localhost:5432/rex); - nested throwable: (javax.servlet.ServletException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgresql://localhost:5432/rex; - nested throwable: (javax.resource.ResourceException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgresql://localhost:5432/rex))
      at org.jboss.jetty.Jetty.deploy(Jetty.java:427)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
      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 java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi spatcher.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(URLDeploymentSc anner.java:427)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeplo ymentScanner.java:648)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScan ner.java:499)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(Abst ractDeploymentScanner.java:261)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi spatcher.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 java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi spatcher.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 java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi spatcher.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:491)

        • 1. Re: javax.resource.ResourceException: Apparently wrong drive
          davidjencks

          you get this when the driver class can be loaded, a driver instance instantiated, but

          DriverManager.getDriver(url);

          throws an exception.

          Maybe the db is not on the new machine.

          • 2. Re: javax.resource.ResourceException: Apparently wrong drive
            rsfeir

            it is I installed it myself. I can connect from my laptop where the install is working, to the remote db on the machine where the instance fails to deploy, and everything is fine. However when I do the same thing, with the same config on the machine itself it fails. Further, I installed a clean OS on an external drive and tried the same thing and it fails with the same error too. So I can actually reproduce this!

            • 3. Re: javax.resource.ResourceException: Apparently wrong drive
              rsfeir

              Well it's resolved for me, but there is still an issue, and it might be that I either don't completely understand war files yet, or JBoss is not doing something right?

              Anyway, after much tweaking around, I decided to try jboss 3.2beta (hey nothing to lose). It turns out that the beta has a bit more intelligent info on what broke. The error I kept getting in the beta was the the Class org.postgresql.Driver was not found.

              The way my directory before waring it was setup is

              webroot
              WEB-INF
              lib
              postgresql.jar

              for some reason after I jared the file into a war file it didn't like that and simply could not load the driver not matter what.
              So after I saw the error in JBoss 3.2 on a hunch I removed the driver from that location and put it under the jboss/server/default/lib directory which gets loaded first before any deployment takes place, and that solved the problem.

              So to try things a bit further, I even tried to unjar the whole postgresql.jar file and put its contents in the class directory under WEB-INF and it still didn't work.

              At this point things are working, even under 3.0.2 and 3.0.3 since it seems the problem was the same, but I am not entirely sure why this would have failed in JBoss. My GUESS right now is that the DB service gets started before the application is deployed, and therefore the driver is never loaded with it, which is causing JBoss to completely choke.

              I also don't quite understand why it works on my laptop and not on the other machines.

              I am going to do a bit more reading about war files. I was wondering if anyone on here knew if there was a way to put the db service xml files in the war files somewhere to get them deployed with the app, and perhaps that will solve the issue? Of course this is a JBoss question, but folks on here are pretty darn helpful about things, so I thought I'd ask. I will also post this on the JBoss forum.

              Thanks
              R

              • 4. Re: javax.resource.ResourceException: Apparently wrong drive
                gayathri

                I am getting the same error as this. Would you tell me how you solved the problem. I have the classes12.jar in my jboss/server/default/lib directory.

                • 5. Re: javax.resource.ResourceException: Apparently wrong drive
                  pgarvie

                  Thank you rsfeir. After spending the last six hours trying to get Connection Pooling to work with a simple webapp, your solution put it over the top. Finally. Not like JBoss isn't cool, but when you figure doing exactly the same thing took about ten minutes to do in Tomcat and about five minutes with Resin, well, go figure.