How do I install PostgreSQL on a Payara Docker container? - java

I'm trying to install create a container that runs a Payaraserver with my JAX-RS application. Getting the server running wasn't too hard, I simply used the official image. However, when I create the Connection Pool I was not able to ping, and I got this error message:
Ping Connection Pool failed for PostgreSQLPool.
Class name is wrong or classpath is not set for :
org.postgresql.ds.PGConnectionPoolDataSource Please check the server.log for more details.
Also, when i tried to upload the .war file (after I had created the DataSource) I got this error message:
Error occurred during deployment: Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.7.7.payara-p3): org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
java.sql.SQLException: Error in allocating a connection. Cause:
org.postgresql.ds.PGConnectionPoolDataSource cannot be cast to javax.sql.DataSource Error Code:
0. Please see server.log for more details.
After a bit of digging I thought that the problem was that I did not have the postgre jdbc driver in the container. I created this Dockerfile:
FROM payara/server-full
COPY postgresql-42.2.18.jar /opt/payara41/glassfish/domains/domain1/lib
, which I thought would add the .jar file to the container. Unfortunately, no change was made. I have the exact same configurations on a local installation of Payara and everything works just fine there.
Is there something that I'm missing? I'm quite new to dockers, so if someone would be able to pint me in the right direction, I would really appreciate it.

Related

UnknownHostException in Grails application using liberty server

I am getting below error in my Liberty message log file when I am trying to use Log4j in my Grails application. When I am run my application as locally, everything is working correctly but when I upload my application on to Liberty Server then I am seeing below error on log file. Please give me suggestion how I can resolve this issue. Thanks
[WARNING ] CWOBJ0210W: The transport type of the remote server on tvma1222.server.xxx.net:4809,tvma1223.server.xxx.net:4809,tvma1224.server.xxx.net:4809 cannot be determined. The following exception occurred while determining the transport type: java.net.UnknownHostException: tvma1224.server.xxx.net
at java.net.InetAddress.getAllByName0(InetAddress.java:1412)
at java.net.InetAddress.getAllByName(InetAddress.java:1316)
at java.net.InetAddress.getAllByName(InetAddress.java:1239)
at java.net.InetAddress.getByName(InetAddress.java:1189)
at com.ibm.ws.objectgrid.naming.DetermineTransport$1.run(DetermineTransport.java:292)
at com.ibm.ws.objectgrid.naming.DetermineTransport$1.run(DetermineTransport.java:288)
at java.security.AccessController.doPrivileged(AccessController.java:452)
at com.ibm.ws.objectgrid.naming.DetermineTransport.probe(DetermineTransport.java:288)
at com.ibm.ws.objectgrid.naming.LocationServiceFactory$1.call(LocationServiceFactory.java:1451)
at com.ibm.ws.objectgrid.naming.LocationServiceFactory$1.call(LocationServiceFactory.java:1447)
at java.util.concurrent.FutureTask.run(FutureTask.java:274)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1157)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:627)
at java.lang.Thread.run(Thread.java:809)
java.net.UnknownHostException: tvma1224.server.xxx.net
Seems pretty clear that the server where the code is running can't lookup tvma1224.server.xxx.net w/ the system resolver. If you can't fix DNS, add an entry to /etc/hosts or the equivalent.

Confluence Error 500 while setup

I've got an Error 500 while trying to setup Confluence saying the bean i18NBean was not found.
I'am running a debian Jessie and I try to install confluence in a docker container following this turotial
This error occurs always when I hit the "database setup step" while confluence trys to setup the database. The weird thing is, this happens also when I try to use the embedded database...

Updating ConnectionPool in Glassfish when derby is upgraded

I was using Glassfish4 with Eclipse and derby-10.6 with JEE. Everything was working fine. Then for some tutorials I switched to Netbeans8.1 which had Glassfish4.1.1 and derby-10.12. Now I am back to Eclipse and want to start from where I left. Meanwhile database created by derby-10.6 is upgraded by 10.12. How can I change settings in Glassfish4 so that it can connect to the database? I am guessing I need to change something with ConnectionPool.
The error I am getting is:
Error occurred during deployment: Exception while deploying the app [ejb] : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: DERBY SQL error: ERRORCODE: 0, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'EmployeeDB' with class loader sun.misc.Launcher$AppClassLoader#61bbe9ba, see the next exception for details.::SQLSTATE: XSLANDatabase at C:...\db-derby-10.6.2.1-bin\bin\EmployeeDB has an incompatible format with the current version of the software. The database was created by or upgraded by version 10.9. Error Code: 0. Please see server.log for more details.
Note that, I don't have derby-10.9.

What are the __pm and __nontx suffixes?

My java EE application is giving following error when i try to run the application on glassfish server. It says "Invalid resource : jdbc/busservice__nontx". Where should i look to fix this error? Previously it was giving error with "jdbc/busservice__pm". Once I created JDBC resource and connected with connection pool, error disappeared. However i'm still getting error with "jdbc/busservice__nontx"
Info: PER02100: Could not load Toplink Essentials. Assuming this is an upgrade from V2. Switching Persistence Unit [BusReservationPU] to use [org.eclipse.persistence.jpa.PersistenceProvider] as JPA provider. If you intend to use Toplink Essentials, please ensure that it is visible to your application."
Severe: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
Severe: java.lang.RuntimeException: Invalid resource : jdbc/busservice__nontx
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupNonTxResource(ConnectorRuntime.java:559)
at org.glassfish.persistence.common.PersistenceHelper.lookupNonTxResource(PersistenceHelper.java:59)
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupNonTxDataSource(ProviderContainerContractInfoBase.java:76)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:109)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)
Do not add "jdbc/busservice__pm" to your Glassfish JDBC Resources, just add it as "jdbc/busservice". It looks like the __pm and __nontx are some internal names that it adds to the end of your jdbc name internally, and when you specifically add it will mess it up and throw that error.

Error deploying a mybatis-truts application

We have a Java application that we deploy using .war files on tomcat server. The war is copied on the webapp directory (tomcat stopped) and then we start the server. We have several scripts that automate the process and we have deploying on development-backup and production servers without problems until two days ago... Then we were able to deploy on development machines, but in backup and production (ovh machines) we received an exception starting tomcat:
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: java.io.IOException: Stream closed
org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: java.io.IOException: Stream closed
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:51)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:39)
Redeploying old .war works fine, but new .war produces all the time this exception. We have spend lot of hours trying to figure out what is wrong, but the same .war that does not work on production work on a development machine and (this is incredible) if we deploy using another name for the war (just renaming the .war file) the application works.. But we need the application to work using this specific context name.
Please... help!
Finaly solved...
The main reason was the checking url from haproxy that in this version uses database, so, while the context are deploying haproxy try to load this url and causes several initializations on mybatis...
Changing the url haproxy query solves the problem, but I'm not sure the good way to avoid the initialization problem under load.

Categories