JPA+ Hibernate+ Maven + NetBeans = HTTP Status 500












-1















I have been trying to figure it out for a few days but today I gave up. I got the HTTP Status Error when I try to create Entity Manager Factory.



Full Stack Trace:



Type Exception Report

Message Error processing webservice request

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error processing webservice request
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

<openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@393fa2d".
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:71)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:850)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1520)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:533)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:458)
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:122)
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1035)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1026)
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:643)
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58)
dao.Dao.getUser(Dao.java:15)
tk.spartan.controller.GetUser.list(GetUser.java:35)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


So it's a little weird that I get openjpa error when in persistance.xml I've got :



<persistence 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_2_0.xsd"
version="2.0">

<persistence-unit name="baza" transaction-type="RESOURCE_LOCAL">

<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>beans.User</class>


<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="javax.persistence.jdbc.user" value="bd2a4c789dfa24" />
<property name="javax.persistence.jdbc.password" value="xxxx" />
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://eu-cdbr-west-02.cleardb.net/heroku_48a75ca44077046?reconnect=true" />
<!-- <property name="hibernate.hbm2ddl.auto" value="update"/> -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>

<property name="hibernate.cache.use_second_level_cache" value="false"/>

<property name="hibernate.archive.autodetection" value="true"/>

</properties>

</persistence-unit>

</persistence>


and my Entity class looks like:



package beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")

public class User {

@Column(name = "iduser")
@Id
private Integer iduser;

@Column(name = "user")
private String user;

@Column(name = "password")
private String password;

@Column(name = "role")
private String role;

public User() {
}

public User(int iduser, String user, String pass, String role) {
this.iduser = iduser;
this.user = user;
this.password = password;
this.role = role;
}

public User(Integer iduser) {
this.iduser = iduser;
}

public Integer getIduser() {
return iduser;
}

public void setIduser(Integer iduser) {
this.iduser = iduser;
}

public String getUser() {
return user;
}

public void setUser(String user) {
this.user = user;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

}


So I'm a little bit confused right now. I've been searching for that kind of error but i didn't find a solution for that.



What it could be?



Added:



@Path("user")
public class GetUser
{
@GET
@Produces(MediaType.TEXT_PLAIN)


public List<User> list ()
{

Dao dao = new Dao();
User user = new User();


List<User> userListed = dao.getUser(user);


return userListed;
}


and structure:










share|improve this question

























  • stackoverflow.com/questions/6237314/… might help you.

    – Alien
    Nov 19 '18 at 4:07











  • You post a persistence unit for Hibernate yet you are using OpenJPA (in the exception), so perhaps you are actually pointing to the wrong persistence unit (define HOW you are invoking the persistence unit, where the persistence.xml is stored, etc ... start from tk.spartan.controller.GetUser.list(GetUser.java:35)). Kindly post consistent information.

    – Billy Frost
    Nov 19 '18 at 8:27











  • I've added class GetUser and project's structure

    – Klose
    Nov 19 '18 at 20:47
















-1















I have been trying to figure it out for a few days but today I gave up. I got the HTTP Status Error when I try to create Entity Manager Factory.



Full Stack Trace:



Type Exception Report

Message Error processing webservice request

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error processing webservice request
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

<openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@393fa2d".
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:71)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:850)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1520)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:533)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:458)
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:122)
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1035)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1026)
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:643)
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58)
dao.Dao.getUser(Dao.java:15)
tk.spartan.controller.GetUser.list(GetUser.java:35)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


So it's a little weird that I get openjpa error when in persistance.xml I've got :



<persistence 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_2_0.xsd"
version="2.0">

<persistence-unit name="baza" transaction-type="RESOURCE_LOCAL">

<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>beans.User</class>


<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="javax.persistence.jdbc.user" value="bd2a4c789dfa24" />
<property name="javax.persistence.jdbc.password" value="xxxx" />
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://eu-cdbr-west-02.cleardb.net/heroku_48a75ca44077046?reconnect=true" />
<!-- <property name="hibernate.hbm2ddl.auto" value="update"/> -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>

<property name="hibernate.cache.use_second_level_cache" value="false"/>

<property name="hibernate.archive.autodetection" value="true"/>

</properties>

</persistence-unit>

</persistence>


and my Entity class looks like:



package beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")

public class User {

@Column(name = "iduser")
@Id
private Integer iduser;

@Column(name = "user")
private String user;

@Column(name = "password")
private String password;

@Column(name = "role")
private String role;

public User() {
}

public User(int iduser, String user, String pass, String role) {
this.iduser = iduser;
this.user = user;
this.password = password;
this.role = role;
}

public User(Integer iduser) {
this.iduser = iduser;
}

public Integer getIduser() {
return iduser;
}

public void setIduser(Integer iduser) {
this.iduser = iduser;
}

public String getUser() {
return user;
}

public void setUser(String user) {
this.user = user;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

}


So I'm a little bit confused right now. I've been searching for that kind of error but i didn't find a solution for that.



What it could be?



Added:



@Path("user")
public class GetUser
{
@GET
@Produces(MediaType.TEXT_PLAIN)


public List<User> list ()
{

Dao dao = new Dao();
User user = new User();


List<User> userListed = dao.getUser(user);


return userListed;
}


and structure:










share|improve this question

























  • stackoverflow.com/questions/6237314/… might help you.

    – Alien
    Nov 19 '18 at 4:07











  • You post a persistence unit for Hibernate yet you are using OpenJPA (in the exception), so perhaps you are actually pointing to the wrong persistence unit (define HOW you are invoking the persistence unit, where the persistence.xml is stored, etc ... start from tk.spartan.controller.GetUser.list(GetUser.java:35)). Kindly post consistent information.

    – Billy Frost
    Nov 19 '18 at 8:27











  • I've added class GetUser and project's structure

    – Klose
    Nov 19 '18 at 20:47














-1












-1








-1








I have been trying to figure it out for a few days but today I gave up. I got the HTTP Status Error when I try to create Entity Manager Factory.



Full Stack Trace:



Type Exception Report

Message Error processing webservice request

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error processing webservice request
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

<openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@393fa2d".
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:71)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:850)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1520)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:533)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:458)
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:122)
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1035)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1026)
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:643)
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58)
dao.Dao.getUser(Dao.java:15)
tk.spartan.controller.GetUser.list(GetUser.java:35)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


So it's a little weird that I get openjpa error when in persistance.xml I've got :



<persistence 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_2_0.xsd"
version="2.0">

<persistence-unit name="baza" transaction-type="RESOURCE_LOCAL">

<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>beans.User</class>


<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="javax.persistence.jdbc.user" value="bd2a4c789dfa24" />
<property name="javax.persistence.jdbc.password" value="xxxx" />
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://eu-cdbr-west-02.cleardb.net/heroku_48a75ca44077046?reconnect=true" />
<!-- <property name="hibernate.hbm2ddl.auto" value="update"/> -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>

<property name="hibernate.cache.use_second_level_cache" value="false"/>

<property name="hibernate.archive.autodetection" value="true"/>

</properties>

</persistence-unit>

</persistence>


and my Entity class looks like:



package beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")

public class User {

@Column(name = "iduser")
@Id
private Integer iduser;

@Column(name = "user")
private String user;

@Column(name = "password")
private String password;

@Column(name = "role")
private String role;

public User() {
}

public User(int iduser, String user, String pass, String role) {
this.iduser = iduser;
this.user = user;
this.password = password;
this.role = role;
}

public User(Integer iduser) {
this.iduser = iduser;
}

public Integer getIduser() {
return iduser;
}

public void setIduser(Integer iduser) {
this.iduser = iduser;
}

public String getUser() {
return user;
}

public void setUser(String user) {
this.user = user;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

}


So I'm a little bit confused right now. I've been searching for that kind of error but i didn't find a solution for that.



What it could be?



Added:



@Path("user")
public class GetUser
{
@GET
@Produces(MediaType.TEXT_PLAIN)


public List<User> list ()
{

Dao dao = new Dao();
User user = new User();


List<User> userListed = dao.getUser(user);


return userListed;
}


and structure:










share|improve this question
















I have been trying to figure it out for a few days but today I gave up. I got the HTTP Status Error when I try to create Entity Manager Factory.



Full Stack Trace:



Type Exception Report

Message Error processing webservice request

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error processing webservice request
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

<openjpa-3.0.0-r422266:1833209 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@393fa2d".
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:71)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:850)
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1520)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:533)
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:458)
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:122)
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1035)
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:1026)
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:643)
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:154)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:246)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:162)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152)
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:58)
dao.Dao.getUser(Dao.java:15)
tk.spartan.controller.GetUser.list(GetUser.java:35)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


So it's a little weird that I get openjpa error when in persistance.xml I've got :



<persistence 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_2_0.xsd"
version="2.0">

<persistence-unit name="baza" transaction-type="RESOURCE_LOCAL">

<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>beans.User</class>


<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="javax.persistence.jdbc.user" value="bd2a4c789dfa24" />
<property name="javax.persistence.jdbc.password" value="xxxx" />
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://eu-cdbr-west-02.cleardb.net/heroku_48a75ca44077046?reconnect=true" />
<!-- <property name="hibernate.hbm2ddl.auto" value="update"/> -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>

<property name="hibernate.cache.use_second_level_cache" value="false"/>

<property name="hibernate.archive.autodetection" value="true"/>

</properties>

</persistence-unit>

</persistence>


and my Entity class looks like:



package beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")

public class User {

@Column(name = "iduser")
@Id
private Integer iduser;

@Column(name = "user")
private String user;

@Column(name = "password")
private String password;

@Column(name = "role")
private String role;

public User() {
}

public User(int iduser, String user, String pass, String role) {
this.iduser = iduser;
this.user = user;
this.password = password;
this.role = role;
}

public User(Integer iduser) {
this.iduser = iduser;
}

public Integer getIduser() {
return iduser;
}

public void setIduser(Integer iduser) {
this.iduser = iduser;
}

public String getUser() {
return user;
}

public void setUser(String user) {
this.user = user;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

}


So I'm a little bit confused right now. I've been searching for that kind of error but i didn't find a solution for that.



What it could be?



Added:



@Path("user")
public class GetUser
{
@GET
@Produces(MediaType.TEXT_PLAIN)


public List<User> list ()
{

Dao dao = new Dao();
User user = new User();


List<User> userListed = dao.getUser(user);


return userListed;
}


and structure:







java hibernate maven jpa netbeans






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 20:46







Klose

















asked Nov 18 '18 at 22:27









KloseKlose

42




42













  • stackoverflow.com/questions/6237314/… might help you.

    – Alien
    Nov 19 '18 at 4:07











  • You post a persistence unit for Hibernate yet you are using OpenJPA (in the exception), so perhaps you are actually pointing to the wrong persistence unit (define HOW you are invoking the persistence unit, where the persistence.xml is stored, etc ... start from tk.spartan.controller.GetUser.list(GetUser.java:35)). Kindly post consistent information.

    – Billy Frost
    Nov 19 '18 at 8:27











  • I've added class GetUser and project's structure

    – Klose
    Nov 19 '18 at 20:47



















  • stackoverflow.com/questions/6237314/… might help you.

    – Alien
    Nov 19 '18 at 4:07











  • You post a persistence unit for Hibernate yet you are using OpenJPA (in the exception), so perhaps you are actually pointing to the wrong persistence unit (define HOW you are invoking the persistence unit, where the persistence.xml is stored, etc ... start from tk.spartan.controller.GetUser.list(GetUser.java:35)). Kindly post consistent information.

    – Billy Frost
    Nov 19 '18 at 8:27











  • I've added class GetUser and project's structure

    – Klose
    Nov 19 '18 at 20:47

















stackoverflow.com/questions/6237314/… might help you.

– Alien
Nov 19 '18 at 4:07





stackoverflow.com/questions/6237314/… might help you.

– Alien
Nov 19 '18 at 4:07













You post a persistence unit for Hibernate yet you are using OpenJPA (in the exception), so perhaps you are actually pointing to the wrong persistence unit (define HOW you are invoking the persistence unit, where the persistence.xml is stored, etc ... start from tk.spartan.controller.GetUser.list(GetUser.java:35)). Kindly post consistent information.

– Billy Frost
Nov 19 '18 at 8:27





You post a persistence unit for Hibernate yet you are using OpenJPA (in the exception), so perhaps you are actually pointing to the wrong persistence unit (define HOW you are invoking the persistence unit, where the persistence.xml is stored, etc ... start from tk.spartan.controller.GetUser.list(GetUser.java:35)). Kindly post consistent information.

– Billy Frost
Nov 19 '18 at 8:27













I've added class GetUser and project's structure

– Klose
Nov 19 '18 at 20:47





I've added class GetUser and project's structure

– Klose
Nov 19 '18 at 20:47












1 Answer
1






active

oldest

votes


















0














I think you should include mysql driver to your jar dependency(pom.xml).
The error message said: The driver is unknown.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53366064%2fjpa-hibernate-maven-netbeans-http-status-500%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I think you should include mysql driver to your jar dependency(pom.xml).
    The error message said: The driver is unknown.






    share|improve this answer




























      0














      I think you should include mysql driver to your jar dependency(pom.xml).
      The error message said: The driver is unknown.






      share|improve this answer


























        0












        0








        0







        I think you should include mysql driver to your jar dependency(pom.xml).
        The error message said: The driver is unknown.






        share|improve this answer













        I think you should include mysql driver to your jar dependency(pom.xml).
        The error message said: The driver is unknown.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 22:05









        László TóthLászló Tóth

        765




        765






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53366064%2fjpa-hibernate-maven-netbeans-http-status-500%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?