-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgreSQL Driver not loaded from WAR or Uber JAR #1584
Comments
Hi Pedro! I attempted to recreate your issue by downloading the Payara Examples project here. Here's a link to my changes. This project then loaded the postgresql driver correctly. Is there any way you could make a small project to recreate the issue? Alternatively, does the same project fail for other Payara Micro versions or database providers? |
I've tested this on Wildfly and Tomee 7. Definitely is a issue with payara connection pool. @MattGill98 your example uses an Application DataSource not an Application Server DataSource [1] [2]. The application server code (our war) should use the cc/ @smillidge @OndrejM [1] https://jdbc.postgresql.org/documentation/head/datasource.html |
We still need a test case those links don't really help us. |
Just put
|
Hi @gilbertoca, I've found the error you're referring to and I believe it is an issue. I've made internal issue PAYARA-2328 to look into this. |
Thanks @MattGill98! I hope we can use the payara-micro in our project. |
I don't believe this is a bug org.postgresql.Driver does not implement DataSource, XADataSource or ConnectionPoolDataSource the javaee schema definition explicitly states that classname should be an implementation of one of those interfaces. @MattGill98 original example used org.postgresql.ds.PGSimpleDataSource which works. Postgres documentation recommends |
Maybe I misunderstood this
And this one as well
Even better
Even their tomcat example follow their own docs. @smillidge don't get me wrong! I don't want to start a discussion (I can not express myself in English very well, I try my best not offend anyone) |
I agree with below
The implementation of ConnectionPoolDataSource you should use is The Tomcat example is not the definition of a JavaEE datasource used within a war file. It is an example of how to create a datasource in Tomcat using Tomcat proprietary Resource syntax and the parameter required is the Driver. Are you saying that using |
No, I was using We used Wildfly :
Tomee:
|
Are you deploying your datasource using a web.xml defined datasource in both Tomcat and WildFly? Please provide the web.xml snippet. |
Finally I've had time to dig into this! But before, wasted two day trying to deploy in the Wildfly - without success. We use eclipselink extension and Wildfly makes it practically impossible to deploy to.
using the data-source defined in web.xml:
The web-app uses that setup in java code with @resource(name = "java:app/gace/gaceDS") and in persisten.xml Now, I will report the issue to TomEE project - it only works with org.postgresql.Driver. [1] https://stackoverflow.com/q/12826191/269514 |
Good to know it works. Are you happy to close the issue? |
I have not objection! @pedrovieirasilva do you have (any objection)? |
@smillidge @mikecroft can you help me with post/discussion[1] ? I could not explain/show that TomEE is not working like the java EE 7 expect. [1] http://tomee-openejb.979440.n4.nabble.com/web-xml-data-source-definition-td4683131.html |
Description
When including PostgreSQL driver as a dependency and starting Payara Micro with a WAR or from a Uber JAR , the driver fails to load.
Expected Outcome
I currently have a maven project generating a WAR that has a declared dependency on PostgresSQL
When I build it it puts the driver jar inside tha WAR's WEB-INF/lib directory. So when the application is started it should have the driver in the classpath and load it correctly.
Current Outcome
However when I start my application with the command:
I always get the exception:
Even if I produce an Uber JarI get the same error.
I have verified that the PostgreSQL jar is being placed inside the War's WEB-INF\lib directory.
The only way I have managed to startup the application successfully is if I create a root dir with the driver jar inside the lib folder:
and start the application with following command:
Steps to reproduce (Only for bug reports)
Declare a dependency on PostgreSQL driver for an application to be run with payara micro.
Define the data source in the web.xml
Make sure you inject the persistence unit onto an EJB or similar so that a connection is made to the database
Build the app and verifiy that the drive is placed inside the WEB-INF/lib directory
Try to run the appilication as a WAR or as an Uber JAR.
Environment
The text was updated successfully, but these errors were encountered: