Reputation: 113
I am learning JPA with Eclipselink, the standalone program runs correctly and connect to Mysql database when i created a dynamic web project to use it with JSF the console show this:
[EL Info]: 2015-08-27 15:04:26.29--ServerSession(887216477)--Thread(Thread[http-bio-8080-exec-3,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.4.2.v20130514-5956486
[EL Fine]: 2015-08-27 15:04:26.824--Thread(Thread[http-bio-8080-exec-3,5,main])--Detected database platform: org.eclipse.persistence.platform.database.HSQLPlatform
[EL Config]: 2015-08-27 15:04:26.84--ServerSession(887216477)--Connection(23748817)--Thread(Thread[http-bio-8080-exec-3,5,main])--connecting(DatabaseLogin(
platform=>DatabasePlatform
user name=> ""
connector=>JNDIConnector datasource name=>null))
[EL Config]: 2015-08-27 15:04:26.841--ServerSession(887216477)--Connection(1638515369)--Thread(Thread[http-bio-8080-exec-3,5,main])--Connected: jdbc:hsqldb:file:D:\Projects\luna workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\data\hsqldb\hsqldb
User: SA
Database: HSQL Database Engine Version: 2.3.2
Driver: HSQL Database Engine Driver Version: 2.3.2
[EL Config]: 2015-08-27 15:04:26.842--ServerSession(887216477)--Connection(134525464)--Thread(Thread[http-bio-8080-exec-3,5,main])--connecting(DatabaseLogin(
platform=>HSQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>null))
[EL Config]: 2015-08-27 15:04:26.852--ServerSession(887216477)--Connection(239793705)--Thread(Thread[http-bio-8080-exec-3,5,main])--Connected: jdbc:hsqldb:file:D:\Projects\luna workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\data\hsqldb\hsqldb
User: SA
Database: HSQL Database Engine Version: 2.3.2
Driver: HSQL Database Engine Driver Version: 2.3.2
[EL Info]: 2015-08-27 15:04:27.137--ServerSession(887216477)--Thread(Thread[http-bio-8080-exec-3,5,main])--file:/D:/Projects/luna workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/fulltech/_fulltech login successful
[EL Warning]: 2015-08-27 15:04:27.14--ServerSession(887216477)--Thread(Thread[http-bio-8080-exec-3,5,main])--Problem while registering MBean: java.lang.NullPointerException
[EL Fine]: 2015-08-27 15:04:27.193--ServerSession(887216477)--Connection(1441030751)--Thread(Thread[http-bio-8080-exec-3,5,main])--SELECT ID, ACTIVATED, ACTIVATIONCODE, COUNTRY, EMAIL, PASSWORD FROM users
[EL Fine]: 2015-08-27 15:08:51.595--ServerSession(887216477)--Connection(840127246)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT ID, ACTIVATED, ACTIVATIONCODE, COUNTRY, EMAIL, PASSWORD FROM users
it connects to HSQL may be this is the default of Eclipselink, this is the persistence.xml i configuered the connection
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="fulltech" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>fulltech.entity.User</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/db"/>
<property name="javax.persistence.jdbc.user" value="user"/>
<property name="javax.persistence.jdbc.password" value="pass"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="eclipselink.logging.level" value="FINE"/>
</properties>
</persistence-unit>
</persistence>
i use TomEE.
Upvotes: 1
Views: 465
Reputation: 603
Since you are using JTA, the connection properties in persistence.xml are ignored.
You need to set up a data source in your application server and provide that in <jta-data-source>
.
Upvotes: 2