Cannot get DBD::JDBC working -- any suggestions?

Discussion in 'Perl Misc' started by rob, Feb 25, 2013.

  1. rob

    rob Guest

    I am trying to get the DBD::JDBC package working under Cygwin on Windows.
    However I am running into what seems to be a Java-related issue.

    The JAR file (dbd_jdbc.jar) from CPAN (http://search.cpan.org/~vizdom/DBD-JDBC-0.71/JDBC.pod) is supposed to contain a class com.vizdom.dbd.jdbc.Server. Yet when I try to run that as per the instructions I get an error that this class is not found (see below). It looks as if this JAR just doesn't contain that class, which would be odd.

    Did anyone come across this, and got it working somehow?
    Any suggestions greatly appreciated!

    # java -D$DRIVERS -Ddbd.port=9001 -classpath .:/home/dbd/dbd_jdbc.jar:/home/dbd/log4j-1.2.13.jar:/home/dbd/hsqldb-1.8.0.2.jar com.vizdom.dbd.jdbc.Server
    Exception in thread "main" java.lang.NoClassDefFoundError: com/vizdom/dbd/jdbc/Server
    Caused by: java.lang.ClassNotFoundException: com.vizdom.dbd.jdbc.Server
    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)
    Could not find the main class: com.vizdom.dbd.jdbc.Server. Program will exit.


    Rob V.
     
    rob, Feb 25, 2013
    #1
    1. Advertisements

  2. rob

    Jim Gibson Guest

    What does the following produce:

    jar tvf /home/dbd/dbd_jdbc.jar | grep com.vizdom.dbd.jdbc.Server.class
     
    Jim Gibson, Feb 25, 2013
    #2
    1. Advertisements

  3. rob

    rob Guest


    As you would expect, it show the class being there:

    # jar tvf dbd_jdbc.jar | grep com.vizdom.dbd.jdbc.Server.class
    5783 Wed Feb 04 17:01:02 CET 2009 com/vizdom/dbd/jdbc/Server.class

    Yet somehow I cannot figure out how to get it running. Since Google turns up preciously little I suppose that means others got it working with ease. SO my best guess is I'm overlooking something trivial...

    Thanks in advance,

    Rob V.
     
    rob, Feb 25, 2013
    #3
  4. I downloaded the jar file and tried to run it with

    java -classpath /tmp/dbd_jdbc.jar com.vizdom.dbd.jdbc.Server

    The error I got was

    Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.log4j.Logger
    at com.vizdom.dbd.jdbc.Server.<clinit>(Server.java:76)
    at java.lang.Class.initializeClass(libgcj.so.90)

    This means it found the class and aborted because I didn't bother to
    get log4j as well.
     
    Rainer Weikusat, Feb 25, 2013
    #4
  5. rob

    rob Guest


    I got that too, but as soon as I include log4j it says it cannot find com.vizdom.dbd.jdbc.Server:

    # java -classpath dbd_jdbc.jar:log4j-1.2.13.jar com.vizdom.dbd.jdbc.Server
    Error: Could not find or load main class com.vizdom.dbd.jdbc.Server

    R.
     
    rob, Feb 25, 2013
    #5
  6. I copied a log4j.jar out of a 'random jboss installation'
    (6.1.0.Final) and after adding that to classpath (and setting
    dbd.port), it started.

    NB: This has preciously little relation to perl.
     
    Rainer Weikusat, Feb 25, 2013
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.