java ee - JPA Entities and GlassFish server -
hello i'm creating simple javaee application. i've started creating ejb module has create databases jpa. problem cannot create these databases glassfish server (without maven project works)
here 1 of entity classes:
package task.jpa.dto; import java.io.serializable; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.table; /** * * @author ml */ @entity @table(name = "model", schema = "komis") public class modeldto implements serializable { @id @generatedvalue(strategy = generationtype.identity) private int id; @column(name = "marka", nullable = false, length = 30) private string marka; @column(name = "nazwa_modelu", nullable = false, length = 30) private string nazwamodelu; public int getid() { return id; } public void setid(int id) { this.id = id; } public string getmarka() { return marka; } public void setmarka(string marka) { this.marka = marka; } public string getnazwamodelu() { return nazwamodelu; } public void setnazwamodelu(string nazwamodelu) { this.nazwamodelu = nazwamodelu; } @override public string tostring() { return "modeldto{" + "id=" + id + ", marka=" + marka + ", nazwamodelu=" + nazwamodelu + '}'; } }
my persistance.xml
<?xml version="1.0" encoding="utf-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="pu" transaction-type="jta"> <jta-data-source>komis</jta-data-source> <properties> <property name="javax.persistence.schema-generation.database.action" value="create"/> </properties> </persistence-unit> </persistence>
and error have when run it:
cze 13, 2015 6:46:27 pm org.hibernate.validator.internal.util.version <clinit> info: hv000001: hibernate validator 5.0.0.final [el info]: 2015-06-13 18:46:27.755--serversession(660017404)--eclipselink, version: eclipse persistence services - 2.5.2.v20140319-9ad6abd cze 13, 2015 6:46:47 pm com.sun.enterprise.connectors.activerafactory createactiveresourceadapter severe: rar6001 : class not found : com.sun.gjc.spi.resourceadapterimpl cze 13, 2015 6:46:47 pm com.sun.enterprise.connectors.activerafactory createactiveresourceadapter severe: com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar @ com.sun.enterprise.connectors.activerafactory.createactiveresourceadapter(activerafactory.java:111) @ com.sun.enterprise.connectors.service.resourceadapteradminserviceimpl.createactiveresourceadapter(resourceadapteradminserviceimpl.java:210) @ com.sun.enterprise.connectors.connectorruntime.createactiveresourceadapter(connectorruntime.java:427) @ com.sun.enterprise.resource.naming.connectorobjectfactory.getobjectinstance(connectorobjectfactory.java:107) @ javax.naming.spi.namingmanager.getobjectinstance(namingmanager.java:321) @ com.sun.enterprise.naming.impl.serialcontext.getobjectinstance(serialcontext.java:527) @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:487) @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:438) @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:622) [el severe]: ejb: 2015-06-13 18:46:47.286--serversession(660017404)--exception [eclipselink-7060] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.validationexception exception description: cannot acquire data source [komis]. internal exception: javax.naming.namingexception: lookup failed 'komis' in serialcontext[myenv={java.naming.factory.initial=com.sun.enterprise.naming.impl.serialinitcontextfactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.jndistatefactoryimpl} [root exception javax.naming.namingexception: failed connectordescriptor jndi [root exception com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar]] @ javax.naming.initialcontext.lookup(initialcontext.java:421) @ org.eclipse.persistence.sessions.jndiconnector.connect(jndiconnector.java:103) @ org.eclipse.persistence.sessions.datasourcelogin.connecttodatasource(datasourcelogin.java:162) @ org.eclipse.persistence.internal.sessions.databasesessionimpl.setordetectdatasource(databasesessionimpl.java:204) @ org.eclipse.persistence.internal.sessions.databasesessionimpl.loginanddetectdatasource(databasesessionimpl.java:741) @ org.eclipse.persistence.internal.jpa.entitymanagerfactoryprovider.login(entitymanagerfactoryprovider.java:239) @ org.eclipse.persistence.internal.jpa.entitymanagersetupimpl.deploy(entitymanagersetupimpl.java:685) @ org.eclipse.persistence.internal.jpa.entitymanagerfactorydelegate.getabstractsession(entitymanagerfactorydelegate.java:204) @ org.eclipse.persistence.internal.jpa.entitymanagerfactorydelegate.getdatabasesession(entitymanagerfactorydelegate.java:182) @ org.eclipse.persistence.internal.jpa.entitymanagerfactoryimpl.getdatabasesession(entitymanagerfactoryimpl.java:527) @ org.eclipse.persistence.jpa.persistenceprovider.createentitymanagerfactoryimpl(persistenceprovider.java:140) @ org.eclipse.persistence.jpa.persistenceprovider.createentitymanagerfactory(persistenceprovider.java:177) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:79) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:54) @ task.jpa.util.jpafactory.<init>(jpafactory.java:21) @ task.jpa.util.jpafactory.getinstanance(jpafactory.java:26) @ task.jpa.util.jpafactory.getentitymanager(jpafactory.java:32) @ task.jpa.dao.genericjpadao.getentitymanager(genericjpadao.java:68) @ task.jpa.dao.genericjpadao.save(genericjpadao.java:33) @ task.jpa.base.generatorbazy.main(generatorbazy.java:34) caused by: java.lang.classnotfoundexception: com.sun.gjc.spi.resourceadapterimpl @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) @ java.lang.classloader.loadclass(classloader.java:357) @ com.sun.enterprise.connectors.activerafactory.createactiveresourceadapter(activerafactory.java:102) ... 28 more exception in thread "main" javax.persistence.persistenceexception: exception [eclipselink-7060] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.validationexception exception description: cannot acquire data source [komis]. internal exception: javax.naming.namingexception: lookup failed 'komis' in serialcontext[myenv={java.naming.factory.initial=com.sun.enterprise.naming.impl.serialinitcontextfactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.jndistatefactoryimpl} [root exception javax.naming.namingexception: failed connectordescriptor jndi [root exception com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar]] @ org.eclipse.persistence.internal.jpa.entitymanagersetupimpl.deploy(entitymanagersetupimpl.java:766) @ org.eclipse.persistence.internal.jpa.entitymanagerfactorydelegate.getabstractsession(entitymanagerfactorydelegate.java:204) @ org.eclipse.persistence.internal.jpa.entitymanagerfactorydelegate.getdatabasesession(entitymanagerfactorydelegate.java:182) @ org.eclipse.persistence.internal.jpa.entitymanagerfactoryimpl.getdatabasesession(entitymanagerfactoryimpl.java:527) @ org.eclipse.persistence.jpa.persistenceprovider.createentitymanagerfactoryimpl(persistenceprovider.java:140) @ org.eclipse.persistence.jpa.persistenceprovider.createentitymanagerfactory(persistenceprovider.java:177) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:79) @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:54) @ task.jpa.util.jpafactory.<init>(jpafactory.java:21) @ task.jpa.util.jpafactory.getinstanance(jpafactory.java:26) @ task.jpa.util.jpafactory.getentitymanager(jpafactory.java:32) @ task.jpa.dao.genericjpadao.getentitymanager(genericjpadao.java:68) @ task.jpa.dao.genericjpadao.save(genericjpadao.java:33) @ task.jpa.base.generatorbazy.main(generatorbazy.java:34) caused by: exception [eclipselink-7060] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.validationexception exception description: cannot acquire data source [komis]. internal exception: javax.naming.namingexception: lookup failed 'komis' in serialcontext[myenv={java.naming.factory.initial=com.sun.enterprise.naming.impl.serialinitcontextfactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.jndistatefactoryimpl} [root exception javax.naming.namingexception: failed connectordescriptor jndi [root exception com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar]] @ org.eclipse.persistence.exceptions.validationexception.cannotacquiredatasource(validationexception.java:520) @ org.eclipse.persistence.sessions.jndiconnector.connect(jndiconnector.java:109) @ org.eclipse.persistence.sessions.datasourcelogin.connecttodatasource(datasourcelogin.java:162) @ org.eclipse.persistence.internal.sessions.databasesessionimpl.setordetectdatasource(databasesessionimpl.java:204) @ org.eclipse.persistence.internal.sessions.databasesessionimpl.loginanddetectdatasource(databasesessionimpl.java:741) @ org.eclipse.persistence.internal.jpa.entitymanagerfactoryprovider.login(entitymanagerfactoryprovider.java:239) @ org.eclipse.persistence.internal.jpa.entitymanagersetupimpl.deploy(entitymanagersetupimpl.java:685) ... 13 more caused by: javax.naming.namingexception: lookup failed 'komis' in serialcontext[myenv={java.naming.factory.initial=com.sun.enterprise.naming.impl.serialinitcontextfactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.jndistatefactoryimpl} [root exception javax.naming.namingexception: failed connectordescriptor jndi [root exception com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar]] @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:491) @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:438) @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:622) @ javax.naming.initialcontext.lookup(initialcontext.java:421) @ org.eclipse.persistence.sessions.jndiconnector.connect(jndiconnector.java:103) ... 18 more caused by: javax.naming.namingexception: failed connectordescriptor jndi [root exception com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar] @ com.sun.enterprise.resource.naming.connectorobjectfactory.getobjectinstance(connectorobjectfactory.java:114) @ javax.naming.spi.namingmanager.getobjectinstance(namingmanager.java:321) @ com.sun.enterprise.naming.impl.serialcontext.getobjectinstance(serialcontext.java:527) @ com.sun.enterprise.naming.impl.serialcontext.lookup(serialcontext.java:487) ... 22 more caused by: com.sun.appserv.connectors.internal.api.connectorruntimeexception: error in creating active rar @ com.sun.enterprise.connectors.activerafactory.createactiveresourceadapter(activerafactory.java:111) @ com.sun.enterprise.connectors.service.resourceadapteradminserviceimpl.createactiveresourceadapter(resourceadapteradminserviceimpl.java:210) @ com.sun.enterprise.connectors.connectorruntime.createactiveresourceadapter(connectorruntime.java:427) @ com.sun.enterprise.resource.naming.connectorobjectfactory.getobjectinstance(connectorobjectfactory.java:107) ... 25 more caused by: java.lang.classnotfoundexception: com.sun.gjc.spi.resourceadapterimpl @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) @ java.lang.classloader.loadclass(classloader.java:357) @ com.sun.enterprise.connectors.activerafactory.createactiveresourceadapter(activerafactory.java:102) ... 28 more java result: 1
first had error exception description: cannot acquire data source [komis]. - added jdbc resource named 'komis' in glassfish configuration. might have not configured properly, i'll thankful if guide me answer wrong.
Comments
Post a Comment