Wstrzykiwanie entityManager

0

Zerknijcie na kod coś tu mocno nie gra ponieważ dostaję poniższy błąd
A poniżej tego błedu wrzucę dla jasności klasy i persistence.xml


HTTP Status 500 - pl.konrad.daoTest.ServiceUzytkownik$$LocalBeanProxy; unable to create instance

type Exception report

message pl.konrad.daoTest.ServiceUzytkownik$$LocalBeanProxy; unable to create instance

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.io.InvalidClassException: pl.konrad.daoTest.ServiceUzytkownik$$LocalBeanProxy; unable to create instance
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readArray(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:231)
    com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:192)
    com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
    com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
    com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
    com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
    javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:284)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.reflect.InvocationTargetException
    sun.reflect.GeneratedSerializationConstructorAccessor13.newInstance(Unknown Source)
    java.lang.reflect.Constructor.newInstance(Unknown Source)
    java.io.ObjectStreamClass.newInstance(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readArray(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:231)
    com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:192)
    com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
    com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
    com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
    com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
    javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:284)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

<openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/bazahealthhelper".  You may have specified an invalid URL.
    at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
    at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:123)
    at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:849)
    at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:732)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
    at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:650)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:202)
    at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
    at pl.konrad.daoTest.ServiceUzytkownik.<init>(ServiceUzytkownik.java:21)
    at sun.reflect.GeneratedSerializationConstructorAccessor13.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.io.ObjectStreamClass.newInstance(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.HashMap.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readArray(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.HashMap.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:231)
    at com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:192)
    at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
    at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:284)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:85)
    ... 86 more

    org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:217)
    org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
    org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
    org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
    org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
    pl.konrad.daoTest.ServiceUzytkownik.<init>(ServiceUzytkownik.java:21)
    sun.reflect.GeneratedSerializationConstructorAccessor13.newInstance(Unknown Source)
    java.lang.reflect.Constructor.newInstance(Unknown Source)
    java.io.ObjectStreamClass.newInstance(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readArray(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:231)
    com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:192)
    com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
    com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
    com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
    com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
    javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:284)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.RuntimeException: There were errors initializing your configuration: <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/bazahealthhelper".  You may have specified an invalid URL.
    at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
    at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:123)
    at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:849)
    at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:732)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:310)
    at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:650)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:202)
    at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
    at pl.konrad.daoTest.ServiceUzytkownik.<init>(ServiceUzytkownik.java:21)
    at sun.reflect.GeneratedSerializationConstructorAccessor13.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.io.ObjectStreamClass.newInstance(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.HashMap.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readArray(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.util.HashMap.readObject(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:231)
    at com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:192)
    at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
    at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:284)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:85)
    ... 86 more

    org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:324)
    org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1670)
    org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:650)
    org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:202)
    org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
    org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
    org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
    org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
    pl.konrad.daoTest.ServiceUzytkownik.<init>(ServiceUzytkownik.java:21)
    sun.reflect.GeneratedSerializationConstructorAccessor13.newInstance(Unknown Source)
    java.lang.reflect.Constructor.newInstance(Unknown Source)
    java.io.ObjectStreamClass.newInstance(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readArray(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    java.util.HashMap.readObject(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    java.io.ObjectInputStream.readSerialData(Unknown Source)
    java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    java.io.ObjectInputStream.readObject0(Unknown Source)
    java.io.ObjectInputStream.readObject(Unknown Source)
    com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:231)
    com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:192)
    com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:97)
    com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:217)
    com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
    com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
    javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:284)
    com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Klasa servis:


@Stateless
public class ServiceUzytkownik {

    @PersistenceUnit(unitName="AplikacjaWebowaHealthHelper")
    private EntityManagerFactory emf = Persistence.createEntityManagerFactory("AplikacjaWebowaHealthHelper");
    @PersistenceContext(unitName = "AplikacjaWebowaHealthHelper")
    private EntityManager em = emf.createEntityManager();   

    public ServiceUzytkownik() {
        super();
        // TODO Auto-generated constructor stub
    }

    public void dodaj(Uzytkownik uzytkownik){
        em.getTransaction().begin();
        em.persist(uzytkownik);
        em.getTransaction().commit();
        em.close();
        emf.close();
    }

}

Klasa Bean:


@ManagedBean(name = "uzytkownikBean")
@ViewScoped

public class UzytkownikBean implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private Uzytkownik uzytkownik;
    private DataModel<Uzytkownik> modelUzytkownicy; 
    @EJB
    private ServiceUzytkownik serviceUzytkownik;

    private int indeksUsuniecia;

    public Uzytkownik getUzytkownik() {
        return uzytkownik;
    }

    public void setUzytkownik(Uzytkownik uzytkownik) {
        this.uzytkownik = uzytkownik;
    }

    public DataModel<Uzytkownik> getModelUzytkownicy() {
        return modelUzytkownicy;
    }

    public void setModelUzytkownicy(ArrayDataModel<Uzytkownik> modelUzytkownicy) {
        this.modelUzytkownicy = modelUzytkownicy;
    }

    public int getIndeksUsuniecia() {
        return indeksUsuniecia;
    }

    public void setIndeksUsuniecia(int indeksUsuniecia) {
        this.indeksUsuniecia = indeksUsuniecia;
    }

    @PostConstruct
    public void init() {
        uzytkownik = new Uzytkownik();

    }

    public void dodajUzytkownika()
    {
        serviceUzytkownik.dodaj(uzytkownik);
    }

oraz plik persistence.xml


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
    <persistence-unit name="AplikacjaWebowaHealthHelper" transaction-type="RESOURCE_LOCAL">
        <class>pl.konrad.klasy.Cwiczenie</class>
        <class>pl.konrad.klasy.Uzytkownik</class>

        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.user" value="konrad" />
            <property name="javax.persistence.jdbc.password" value="konrad" />
            <property name="javax.persistence.jdbc.url"
                value="jdbc:mysql://localhost:3306/bazahealthhelper" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
            <property name="hibernate.hbm2ddl.auto" value="create" />

        </properties>

    </persistence-unit>
</persistence>
1

No nie rób jaj
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Serio, czytanie stacktraceów zwykle pomaga bardziej niż wróżenie z fusów albo z kuli...

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0