views:

277

answers:

1

Hi everyone,

I'm new to persevere, I did the helloWorld tutorial, very impressive btw but I'm now trying to connect to a real postgres database and find myself struggling having the driver recognized when I have the feeling it should be dead simple.

I dropped all the jdbc driver for postgres I had to the persevere/lib folder:

  • postgresql-8.3-603.jdbc2ee.jar
  • postgresql-8.3-603.jdbc2.jar
  • postgresql-8.3-603.jdbc3.jar
  • postgresql-8.3-603.jdbc4.jar

And yet when I start persevere with the command "persvr" with no argument from my project folder I get the following error message:

java.lang.ClassNotFoundException: org.postgresql.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:379)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:341)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.persvr.datasource.DatabaseDataSource.initParameters(Unknown Source)
    at org.persvr.datasource.DatabaseTableDataSource.initParameters(Unknown Source)
    at org.persvr.data.DataSourceManager.initSource(Unknown Source)
    at org.persvr.data.DataSourceManager.<clinit>(Unknown Source)
    at org.persvr.data.Identification.idForString(Unknown Source)
    at org.persvr.Persevere.load(Unknown Source)
    at org.persvr.job.SampleData.execute(Unknown Source)
    at org.persvr.job.Upgrade.execute(Unknown Source)
    at org.persvr.remote.PersevereFilter.init(Unknown Source)
    at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:620)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1234)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:460)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.persvr.util.JettyStart.main(Unknown Source)

I'm actually trying to expand the helloWorld project as an exercize, so I've added a postgres.json file in my helloWorld/WEB-INF/config folder. Here is the content of that file:

    {"id":"postgres.json",
"sources":[
        {"name":"addressTable",
                "sourceClass":"org.persvr.datasource.DatabaseTableDataSource",
                "connection":"jdbc:postgresql://hostname:5432/pnp?user=user1&pass=mypassword",
                "driver":"org.postgresql.Driver",
                "camelCaseColumnNames": false,
                "table":"addr",
                "idColumn":"addr_id",
                "dataColumns":["addr_stat_cd","addr1","addr2","city","state","zip","zip_ext","cntry_cd","last_upd_uid","last_upd_dttm","create_uid","create_dt
tm"],
        "schema":{
                "data":{"$ref":"../addressTable/"}
        }
}]
}

Could anyone tell me why persevere can't find that postgres driver please?

Thanks, Lancelot.

A: 

Figured it out. The postgres driver jar should actually go into the folder: persevere/WEB-INF/lib instead of the persevere/lib.

Lancelot