Class loader issue with PostgreSQL jdbc driver
kc7bfi Feb 7, 2012 6:28 PMI have deployed a PostgreSQL jdbc driver as a jar file. I also have a SAR that needs to reference some of the classes in the jdbc driver. I have setup my jboss-deployment-structure as:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.DGListener"/>
<module name="deployment.postgresql-9.1-901.jdbc4.jar"/>
<module name="org.apache.commons.codec"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.log4j"/>
<module name="org.dom4j"/>
<module name="org.hibernate"/>
<module name="org.infinispan"/>
<module name="org.jboss.as.clustering.api"/>
<module name="org.jboss.as.clustering.impl"/>
<module name="org.jboss.as.clustering.infinispan"/>
<module name="org.jboss.as.clustering.service"/>
<module name="org.jboss.as.clustering.singleton"/>
<module name="org.jboss.as.jpa.hibernate" slot="4"/>
<module name="org.jboss.as.server"/>
<module name="org.jboss.msc"/>
<module name="org.slf4j"/>
</dependencies>
</deployment>
<module name="deployment.DGListener">
<resources>
<resource-root path="aopalliance-1.0.jar"/>
<resource-root path="activation-1.1.1.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
<resource-root path="concurrent-1.3.4.jar"/>
<resource-root path="DataGateway-ClientKit-2.0.jar"/>
<resource-root path="DataGateway-EDXL-1.0.jar"/>
<resource-root path="DataGateway-Toolkit-1.0.jar"/>
<resource-root path="dom4j-1.6.1.jar"/>
<resource-root path="hsqldb-1.8.0.7.jar"/>
<resource-root path="guice-3.0.jar"/>
<resource-root path="jts-1.7.1.jar"/>
<resource-root path="jzlib-1.0.7.jar"/>
<resource-root path="log4j-1.2.16.jar"/>
<resource-root path="orci1512v4-1.2.1.1.jar"/>
<resource-root path="postgis-2.0.0SVN.jar"/>
<resource-root path="slf4j-api-1.6.1.jar"/>
<resource-root path="slf4j-log4j12-1.6.1.jar"/>
</resources>
</module>
</jboss-deployment-structure>
It was my assumption that declaring the dependency on "deployment.postgresql-9.1-901.jdbc4.jar" would put those clases on my classpath for my SAR, but I am getting ClassNotFoundExceptions. The reason I need the PostgreSQL classes is because I am using a PostGIS database and I need to convert the geometries to PGobjects. Is there something I'm doing wrong? When I place the PostgreSQL jdbc in my SAR then I get an error saying I cannot cast PGonject to PGobject. Any thoughts? David