JBoss AS 6 EAR issues with library directory
rherrick Mar 8, 2011 1:11 PMI have a project that we've been successfully deploying onto JBoss AS 5.1.0.GA for a while. It's in the EAR format and is pretty simple. It consists of a WAR file for the actual application, a PostgreSQL data source definition, and the PostgreSQL JDBC driver jar file. The layout of the application is like this:
- productweb.war
- lib/postgresql-9.0-801.jdbc4.jar
- META-INF/application.xml
- META-INF/jboss-app.xml
- META-INF/MANIFEST.MF
- META-INF/maven/com.mycompany/productear/pom.properties
- META-INF/maven/com.mycompany/productear/pom.xml
- postgres-ds.xml
The application.xml looks like this (I've snipped the namespace jazz in the <application> element for brevity):
<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="5" ...>
<display-name>Product</display-name>
<module>
<web>
<web-uri>productweb.war</web-uri>
<context-root>/productweb</context-root>
</web>
</module>
<library-directory>/lib</library-directory>
</application>
The jboss-app.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD Java EE Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd">
<jboss-app>
<module>
<service>postgres-ds.xml</service>
</module>
</jboss-app>
Like I said, in JBoss AS 5.1.0.GA, this works fine. The server starts up, the JNDI data source in the postgres-ds.xml file is properly loaded, and the application can access the database through that.
With JBoss AS 6, though, I get an error when the server tries to create the data source:
16:31:11,389 INFO [Version] Hibernate Validator 3.0.0.GA
16:31:11,784 INFO [AnnotationSessionFactoryBean] Building new Hibernate SessionFactory
16:31:12,007 INFO [ConnectionProviderFactory] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
16:31:12,382 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: org.postgresql.Driver, url: jdbc:postgresql://localhost:5432/product_db)
I can easily fix this by removing the jar from the EAR file and plopping it into the server/default/lib folder. When I do that, the data source is created smoothly (I run into some other errors after that, but I'm not certain it's related to this one), so it appears that the issue is that the PostgreSQL JDBC jar file is not getting picked up on the classpath of the application server.
I tried removing the <library-directory> element entirely and putting the JDBC jar file in the root of the EAR archive but that gave me the same results. Ditto with changing the <library-directory> value to '/' with the jar at the root.
Now, this construct worked previously, so why is it NOT working any more? I haven't been able to find anything in the JBoss AS 6 docs that speaks about the EAR packaging at all, so the operative docs still appear to be the JBoss AS 5 docs. I've attached a sanitized version of the boot.log that's generated (the server.log contains literally nothing of interest: one thing I've really noticed that's a big change is that a lot of stuff that used to go into the server.log now goes into the boot.log).
Any help or information on this would be great.
-
boot.log.zip 14.9 KB