geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Genc, Ömer <Oemer.G...@iais.fraunhofer.de>
Subject AW: Postgres/postgis problem: java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast to org.postgis.PGgeometry
Date Sun, 02 Feb 2014 00:14:56 GMT
Hey there,

unfortunately i am still having trouble in setting up the postgres JDBC driver in geronimo.
As described I need postgres with the extension postgis.
To register the postgis extension on the postgresql JDBC driver one had to register a special
JDBC driver and use a special JDBC ConnectionURL. The postgis driver is org.postgis.DriverWrapper
and wraps around the default org.postgres.Driver, the ConnectionURL looks similar to this:
jdbc:postgresql_postGIS://host/postgis_db.

The only place to specify those parameters in Geronimo I found are in the Geromino database
wizard when selecting "Other" as Database type.

Here are the steps I am going through in more detail:

- Fresh Geromino 3.0.1 installation.
- install postgres jar (postgres-9.1.903.jdbc4.jar) using the repository file upload (repository/postgres/postgres-jdbc/9.1.903/jar)
- install postgis (postgis-jdbc-2.0.1.jar) jar using the repository file upload (repository/postgres/postgis-jdbc/2.0.1/jar)
- In the admin console select 'Datasources' and then 'Create a new database pool' with the
'Using the Geromino database wizard'.
- Enter 'Name of Database Pool', e.g. ims_db
- Select 'Database Type' 'Other' (I need to select this one, since I need to specify the JDBC
driver and the JDBC ConnectionURL for postgis to work)
- Click 'Next'
- Select postgresql/postgresql-jdbc/9.1.903/jar
- Control click to Select postgresql/postgis-jdbc/2.0.1.jar
- Enter DB name, e.g. 'IMS'
- Enter User Name
- Enter password (2x)
- Enter JDBC ConnectionURL including default host and port
- Click 'Deploy'

Unfortunately this does not work. It seems that the Geronimo classloader cannot find the postgres-9.1.903.jdbc4.jar.
I am absolutely clueless and any help would be greatly appreciated.

Here is the error message that appears:

2014-02-01 17:54:20,085 WARN  [DatabaseDriverExtender] Failed to load driver org.postgresql.Driver
java.lang.ClassNotFoundException: org.postgresql.Driver
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:467)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
        at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
        at org.apache.geronimo.jdbc.DatabaseDriverExtender.loadDrivers(DatabaseDriverExtender.java:76)
        at org.apache.geronimo.jdbc.DatabaseDriverExtender.access$100(DatabaseDriverExtender.java:43)
        at org.apache.geronimo.jdbc.DatabaseDriverExtender$DriverBundleTrackerCustomizer.addingBundle(DatabaseDriverExtender.java:108)
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:482)
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:234)
        at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:457)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1523)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:391)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
        at org.apache.geronimo.system.configuration.DependencyManager.starting(DependencyManager.java:517)
        at org.apache.geronimo.system.configuration.DependencyManager.bundleChanged(DependencyManager.java:120)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1523)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459)
        at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:367)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
        at org.apache.geronimo.deployment.DeploymentContext.createTempConfiguration(DeploymentContext.java:204)
        at org.apache.geronimo.deployment.DeploymentContext.initializeConfiguration(DeploymentContext.java:192)
        at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:662)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:281)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:145)
        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:597)
        at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
        at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
        at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
        at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
        at org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61)
        at java.lang.Thread.run(Thread.java:662)
2014-02-01 17:54:20,112 ERROR [Deployer] Deployment failed due to
java.lang.NoClassDefFoundError: org/postgresql/Driver
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.defineClass(GeronimoClassLoader.java:213)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:478)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:458)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.findLocalClass(GeronimoClassLoader.java:237)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
        at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:483)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
        at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.checkClass(ConnectorModuleBuilder.java:1329)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.addOutboundGBeans(ConnectorModuleBuilder.java:1276)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.addConnectorGBeans(ConnectorModuleBuilder.java:921)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.initContext(ConnectorModuleBuilder.java:555)
        at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:686)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:281)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:145)
        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:597)
        at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
        at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
        at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
        at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
        at org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 38 more
Deployer operation failed: org/postgresql/Driver
java.lang.NoClassDefFoundError: org/postgresql/Driver
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.defineClass(GeronimoClassLoader.java:213)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:478)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:458)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.findLocalClass(GeronimoClassLoader.java:237)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
        at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:483)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
        at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.checkClass(ConnectorModuleBuilder.java:1329)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.addOutboundGBeans(ConnectorModuleBuilder.java:1276)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.addConnectorGBeans(ConnectorModuleBuilder.java:921)
        at org.apache.geronimo.connector.deployment.ConnectorModuleBuilder.initContext(ConnectorModuleBuilder.java:555)
        at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:686)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:281)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:145)
        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:597)
        at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
        at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
        at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
        at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
        at org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 38 more

-----Ursprüngliche Nachricht-----
Von: Genc, Ömer [mailto:Oemer.Genc@iais.fraunhofer.de]
Gesendet: Montag, 27. Januar 2014 09:44
An: user@geronimo.apache.org
Betreff: AW: Postgres/postgis problem: java.lang.ClassCastException: org.postgresql.util.PGobject
cannot be cast to org.postgis.PGgeometry

Hey,

thanks for your help.

I tried that, unfortunately the error still exists. It's the same as before.
Is there anything else, you can think about?
Is there a way to make sure, Geronimo classloader loads this classes?
How can I check that?

What about the <import-packages> declaration inside the deployment descriptor?
Do I need this in Geronimo 3.0.1 when trying to load 3rd party libraries?


Thanks in advance,
Ömer

-----Ursprüngliche Nachricht-----
Von: frank pientka [mailto:frank.pientka@gmail.com]
Gesendet: Montag, 27. Januar 2014 08:53
An: user@geronimo.apache.org
Betreff: Re: Postgres/postgis problem: java.lang.ClassCastException: org.postgresql.util.PGobject
cannot be cast to org.postgis.PGgeometry

because of changed classloading in Geronimo 3.0 I would recommend th following step Create
a datasource with webconsole, download PostgreSQL-JDBC there and test it at the end It's better
to install the jdbc-driver separately from the application as a system module in the respository
good luck Frank

2014-01-26, Genc, Ömer <Oemer.Genc@iais.fraunhofer.de>:
> Hey there,
>
> I am having trouble in getting postgresql with extension postgis
> running under Geronimo 3.0.1.
> I have an application which worked fine under Geronimo 2.2.1. This
> application uses postgresql and postgis. With Geronimo 2.2.1
> everything works as expected.
>
> However, migrating towards Geronimo 3.0.1 yields a ClassCastException,
> although  it is the exact same module.
>
> I have installed the postgres jdbc driver in Geronimo. I am able to
> run queries against my database from the webconsole of Geronimo.
> In my EAR module I have included the Postgres-9.1-903.jdbc.jar and the
> postgis-2.0.1.jar in the Class-Path entry of the modules MANIFEST.MF file.
> Everything is the same, as it was with Geronimo 2.2.1.
>
> However, it seems that these jars are not found during runtime. The
> deployment however succeeds.
>
> Anyone an idea, what else I could check?
>
> Thanks for any suggestions,
>
> Cheers,
>

Mime
View raw message