I'm trying to put my web site on line. For that, I've a debian and a jetty server. When I try to go on my web site, it show my the homepage, so, this is ok.
But, when I try to log in, it put me an error message.
It's working on my local machine with this configuration :
<?xml version="1.0" encoding="utf-8"?>
<domain project-version="6">
<map name="datamap"/>
<node name="datanode"
factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
>
<map-ref name="datamap"/>
<data-source>
<driver value="com.mysql.jdbc.Driver"/>
<url value="jdbc:mysql://127.0.0.1:3306/database"/>
<connectionPool min="1" max="10"/>
<login userName="username" password="password"/>
</data-source>
</node>
</domain>
So,I verified the username and password are ok. I tried to execute my web site on my own machine with the new configuration :
<url value="jdbc:mysql://serverip:3306/database"/>
What did I miss?
The error message is :
(I'm sorry, I'm trying to find where I can find the jetty log on the server, I will update it with the full stack)
I supposed I forget one information? I'm sure about my password and login for the mysql on the server. I'm using SSH, the configuration is in my workbench :
I'm using maven, so I add mysql in the pom.xml :
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
I read that can be because we didn't put the mysql in the classpath. But, that should works, shouldn't it?
EDIT : I tried : <url value="jdbc:mysql://serverusername@serverpwd/serverip:3306/database"/>
, without success...
EDIT 2 : This configuration is working :
<node name="datanode"
factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy">
<map-ref name="datamap" />
<data-source>
<driver value="com.mysql.jdbc.Driver" />
<url value="jdbc:mysql://127.0.0.1/database" />
<connectionPool min="1" max="1" />
<autoReconnect> true</autoReconnect>
<failOverReadOnly> false</failOverReadOnly>
<login userName="userName" password="password" />
</data-source>
</node>
The connection may be timing out. Try adding this to the URL:
?connectTimeout=0&autoReconnect=true
. For an even more reliable result, try using an external connection pool, e.g. Hikari, with appropriate reconnect properties. Cayenne can be instructed to use an external connection pool on startup via ServerRuntime.builder(..).dataSource(dataSource)..