java - Using Texo in Play 2 -
i using eclipse texo project domain classes, have moved across play 2.3.8.
i configured according https://www.playframework.com/documentation/2.3.8/javajpa adding
<non-jta-data-source>pssh2</non-jta-data-source>
to existing persistance.xml
i added globalsettings subclass initialize daoregistry so:
public void beforestart(application app) { logger.info("application has started"); properties prop = getproperties(); parcelsystemsimulationmodelpackage.initialize(); entitymanagerfactory emf = persistence.createentitymanagerfactory(prop.getproperty("persistname")); entitymanager em = emf.createentitymanager(); entitymanagerprovider.getinstance().setentitymanagerfactory(emf); entitymanagerprovider.getinstance().setcurrententitymanager(em); entitymanagerprovider.getinstance().setusecurrententitymanagerpattern(true);
after moving ecore file jar , putting in lib directory. initializes texo generated modelpackage. cannot find datasource required in createentitymanager line inthe source above. get:
caused by: javax.persistence.persistenceexception: exception [eclipselink-7060] (eclipse persistence services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.validationexception exception description: cannot acquire data source [pssh2]. internal exception: javax.naming.namenotfoundexception: pssh2 not found @ org.eclipse.persistence.internal.jpa.entitymanagersetupimpl.deploy(entitymanagersetupimpl.java:762) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b] @ org.eclipse.persistence.internal.jpa.entitymanagerfactorydelegate.getabstractsession(entitymanagerfactorydelegate.java:204) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b] @ org.eclipse.persistence.internal.jpa.entitymanagerfactorydelegate.createentitymanagerimpl(entitymanagerfactorydelegate.java:304) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b] @ org.eclipse.persistence.internal.jpa.entitymanagerfactoryimpl.createentitymanagerimpl(entitymanagerfactoryimpl.java:336) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b] @ org.eclipse.persistence.internal.jpa.entitymanagerfactoryimpl.createentitymanager(entitymanagerfactoryimpl.java:302) ~[eclipselink-2.5.0.jar:2.5.0.v20130507-3faac2b] @ com.example.pss.global.beforestart(global.java:44) ~[na:na]
i have setup datasource in application.conf file so:
db.default.driver=org.h2.driver db.default.url="jdbc:h2:file://c:/users/david.wynter/git/pss/db/pss_db; db_close_on_exit=false;auto_server=true" db.default.user="sa" db.default.password="*******" # # can expose datasource via jndi if needed (useful jpa) db.default.jndiname=pssh2 jpa.default=pssh2
Comments
Post a Comment