derby persistence.xml - eclipselink

What should be the property statement regarding the derby client driver in the persistence.xml e.g :
<property name="javax.persistence.jdbc.driver" value=" ? " />
When tyring to update the DB from Java I keep getting the exception below.
Actually I need the client driver instead the EmbeddedDriver . Don't know how to name it.
The project has in its java Build path/libraries the Derby Client JDBC driver ( eclipse plugin has the derby plugin).
The program instruction causing the exception is :
factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
EntityManager em = factory.createEntityManager();
[EL Info]: 2012-02-02 10:48:44.805--ServerSession(1434473856)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
[EL Severe]: 2012-02-02 10:48:44.93--ServerSession(1434473856)--Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.EmbeddedDriver] not found.
Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.EmbeddedDriver] not found.

javax.persistence.jdbc.driver defines the protocol that shall be used to access the database.
You need to set it like this, if you want to access a remote/local derby network server:
<property name="javax.persistence.jdbc.driver" value="jdbc:derby://localhost:1527/my_schema " />
Where 1527 is the port of your NetworkServer.
And my_schema is your database schema.
If you don't have schema yet, use ;create=true to create it:
jdbc:derby://localhost:1527/my_schema;create=true
You may want to take a look at the Getting Started Guide.
Side note:
Class [org.apache.derby.jdbc.EmbeddedDriver] not found.
This tells you that not all jars needed by derby are present in the classpath(in your comment you state, that this is the case). If you get any such exception, make sure that all jars are actually in the classpath.

Related

Weblogic Deployment issue due to NameAlreadyBoundException - after upgraded weblogic from 10.3.6 to Weblogic 12cR2

My application currently working under weblogic 10.3 with Java 1.6.
Now we are trying to deploy same application to weblogic 12cR2 & java 1.8, below is the error we are facing.
Unable to bind Business Interface to the JNDI name: Gen4CServlet_warcontact_Home, throw exception javax.naming.NameAlreadyBoundException: [EJB:011224]Unable to bind the interface com.hh.cc.ce.RemoteContactSession to RemoteContactession. Another EJB has already bound an interface to that name.; remaining name 'ejb/Contact#com/ce'. NestedException Message is :[EJB:011224]Unable to bind the interface com.hh.cc.ce.RemoteContactSession to RemoteContactSession. Another EJB has already bound an interface to that name."
weblogic.application.ModuleException: Unable to bind Business Interface to the JNDI name: iLinqGen4CGEServlet_warcontactge_Home, throw exception javax.naming.NameAlreadyBoundException: [EJB:011224]Unable to bind the interface com.hh.cc.ce.RemoteContactGESession to RemoteContactGESession. Another EJB has already bound an interface to that name.; remaining name 'ejb/Contact#com/hh/cc/ce'. NestedException Message is :[EJB:011224]Unable to bind the interface com.hh.cc.ce.RemoteContactSession to RemoteContactSession. Another EJB has already bound an interface to that name.
at weblogic.application.internal.ExtensibleModuleWrapper.activate(ExtensibleModuleWrapper.java:123)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:114)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:212)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:207)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
According to Oracle KM Unable To Bind Business Interface To The JNDI Name javax.naming.NameAlreadyBoundException: [EJB:011224]Unable to bind (Doc ID 2254400.1), this can be due to Class-Path entry in MANIFESF.MF file. Try to remove the same redeploy the application.

Load JDBC resource

I trying to configure Glassfish 5 with this datasource JNDI name: jdbc/DefaultD
Exception attempting to inject Res-Ref-Env-Property: jdbc/DefaultDB#javax.sql.DataSource# resolved as: jndi: java:comp/DefaultDataSource#res principal: null#mail: null No Runtime properties Database Vendor : null Create Tables at Deploy : false Delete Tables at Undeploy : false into class com.crm.web.authentication.LoginController: Lookup failed for 'java:comp/env/jdbc/DefaultDB' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
I created datasource pool and and JDBC resource but when I run the wen application I get above error. Is there any solution for this problem?
before creating data source JNDI you need to place the database related Jar file in the glass fish domain lib folder.
ex: if you are creating JNDI for MySQL database in default glass fish domain domain1, then you need to place the "mysql-connector-java-5.1.23-bin.jar" in lib folder. then restart the server then it will work

Predeployment of PersistenceUnit [appcenterdb-oracle] failed

I installed the following on my RHEL 6
(1) MFP63
(2) MySQL56
(3) WAS 8.5.5.6
and trying to set up my first mobile first project but 'messages.log' has the following errors
I FFDC1015I: An FFDC Incident has been created: "javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.WAS-v20150513-26196d2): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [appcenterdb-oracle] failed.
Internal Exception: Exception [EclipseLink-7157] (Eclipse Persistence Services - 2.6.0.WAS-v20150513-26196d2): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class com.ibm.puremeap.jpa.entity.PushBatchDeviceEntity] must use a #JoinColumn instead of #Column to map its relationship attribute [device]. com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory 759" at ffdc_15.07.27_21.00.27.0.log
[7/27/15 21:00:27:238 IST] 00000068 com.ibm.ws.jpa.management.JPAPUnitInfo E CWWJP0015E: An error occurred in the org.eclipse.persistence.jpa.PersistenceProvider persistence provider when it attempted to create the container entity manager factory for the appcenterdb-oracle persistence unit. The following error occurred: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.WAS-v20150513-26196d2): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [appcenterdb-oracle] failed.
Internal Exception: Exception [EclipseLink-7157] (Eclipse Persistence Services - 2.6.0.WAS-v20150513-26196d2): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class com.ibm.puremeap.jpa.entity.PushBatchDeviceEntity] must use a #JoinColumn instead of #Column to map its relationship attribute [device].
Message says 'Predeployment of PersistenceUnit [appcenterdb-oracle] failed' but I am using 'MySQL' instead of 'oracle' which is bit confusing to me
I am using Java 8 (with JDK6 and 7 I was facing other issues)
http://pastebin.com/WcWBUjVn (server.xml)
http://pastebin.com/QzByZ63T (messages.log)
Thanks
Sathish Kumar
There are three issues in total:
You are using Java 8 with a MobileFirst Foundation version that does not support it. The system requirements of MobileFirst Foundation 7.0 state that only Java 6 and Java 7 are supported. The symptom is seen in your first messages.log: It is the exception java.lang.IllegalStateException: Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher
Your server.xml contains two elements <application id="worklightconsole" name="worklightconsole" location="worklightconsole.war" type="war">. That is, you have two web applications with the same id, the same name, and the same context root. This can never work. The cause is apparently that you passed worklightconsole.war as argument to <configureApplicationServer>. Instead, as documented in Deploying the project WAR file, the WAR file that you specify should be a MobileFirst project WAR file, built through MobileFirst Studio or through the <war-builder> Ant task.
The second messages.log file contains the log messagesFWLSE2008I: MBean registration succeeded for: com.worklight.common.server.jmx.api:type=WorklightAdmin,qualifier=worklightadmin
FWLSE2008I: MBean registration succeeded for: com.worklight.common.server.jmx.api:type=ProjectManagement_simpleServer,qualifier=worklightconsole [project worklightconsole]
The first one shows an empty environment id, whereas the second one shows an environment id "simpleServer". This environment id is also visible in the server.xml file:<jndiEntry jndiName="worklightconsole/ibm.worklight.admin.environmentid" value='"simpleServer"'/>
But according to the documentation of <configureApplicationServer>, you should pass the same environment id value in both cases.
#Sathish, In the server.xml you have uploaded, I can see those features
<feature>javaee-7.0</feature>
<feature>servlet-3.1</feature>
<feature>jdbc-4.1</feature>
The last two features are not installed by MobileFirst Ant tasks or the Server Configuration Tool.
This let me think you changed them manually after the installation process because you are using an unsupported Liberty profile flavour like
WAS Liberty V8.5.5.6 with Java EE 7 Web Profile or WAS Liberty V8.5.5.6 with Java EE 7 Full Platform
which does not provide the expected features servlet-3.0 and jdbc-4.0 but instead servlet-3.1 and jdbc-4.1.
Actually, MFP 6.3 only supports MFP 6.3 only supports WebSphere Application Server Liberty Core
http://www-969.ibm.com/software/reports/compatibility/clarity-reports/report/html/prereqsForProduct?deliverableId=1404132386734#!
which contains
You may get it from the FixCentral website
http://www-933.ibm.com/support/fixcentral/
On Select product tab, choose
Product Group : WebSphere
Select from WebSphere : WebSphere Application Server
Installed Version : 8.5.5.6
Platform : All
Then select
Individual fix IDs : wlp-core-runtime-8.5.5.6
As 'slowhand' suggested the issue was with 'server.xml' because of multiple 'application id' with the same name
It appears 'ant' tasks does not generate all the tags correctly and I made little corrections to make it work
Thanks
Sathish Kumar

jbpm audit log always looking for jta transaction

Am trying to pull records from JBPM AuditLog but am getting
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/dms] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Unable to find JTA transaction.] with root cause
java.lang.IllegalStateException: Unable to find JTA transaction.
at org.jbpm.process.audit.strategy.StandaloneJtaStrategy.joinTransaction(StandaloneJtaStrategy.java:45)
at org.jbpm.process.audit.JPAAuditLogService.joinTransaction(JPAAuditLogService.java:319)
at org.jbpm.process.audit.JPAAuditLogService.executeQuery(JPAAuditLogService.java:327)
at org.jbpm.process.audit.JPAAuditLogService.findVariableInstancesByNameAndValue(JPAAuditLogService.java:280)
at com.softech.dms.workflow.WorkflowUtil.getAuditLog(WorkflowUtil.java:237)
at com.softech.dms.workflow.WorkflowUtil$$FastClassBySpringCGLIB$$73d95f1.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
looking at trace it is still using the JTA strategy instead of local transaction strategy
am using jbpm v6.2.0.CR2 and my persistence.xml is as follows
<persistence-unit name="dms-jbpm" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<mapping-file>META-INF/TaskAuditorm.xml</mapping-file>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<class>org.jbpm.process.audit.VariableInstanceLog</class>
<class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>
<class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</class>
<class>org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo</class>
<class>org.jbpm.services.task.impl.model.AttachmentImpl</class>
<class>org.jbpm.services.task.impl.model.ContentImpl</class>
<class>org.jbpm.services.task.impl.model.BooleanExpressionImpl</class>
<class>org.jbpm.services.task.impl.model.CommentImpl</class>
<class>org.jbpm.services.task.impl.model.DeadlineImpl</class>
<class>org.jbpm.services.task.impl.model.DelegationImpl</class>
<class>org.jbpm.services.task.impl.model.EscalationImpl</class>
<class>org.jbpm.services.task.impl.model.GroupImpl</class>
<class>org.jbpm.services.task.impl.model.I18NTextImpl</class>
<class>org.jbpm.services.task.impl.model.NotificationImpl</class>
<class>org.jbpm.services.task.impl.model.EmailNotificationImpl</class>
<class>org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl</class>
<class>org.jbpm.services.task.impl.model.PeopleAssignmentsImpl</class>
<class>org.jbpm.services.task.impl.model.ReassignmentImpl</class>
<class>org.jbpm.services.task.impl.model.TaskImpl</class>
<class>org.jbpm.services.task.impl.model.TaskDataImpl</class>
<class>org.jbpm.services.task.impl.model.UserImpl</class>
<class>org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl</class>
<class>org.jbpm.services.task.audit.impl.model.TaskEventImpl</class>
<class>org.jbpm.services.task.audit.impl.model.AuditTaskImpl</class>
<properties>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.BitronixJtaPlatform" />
</properties>
</persistence-unit>
jBPM persistence is using JTA to manage the transaction. As a result, you should use JTA as transaction type in your persistence.xml and use a JTA data source. The only exception is Spring, where we also integrate with the Spring transaction manager to support local transactions as well.

TomEE ignores resource configuration when it can't find MySQL driver classes

I made reference to Configuring data source - tomee.xml, persistence.xml. My persistence.xml is exactly as in the above except for the persistence unit name and jta datasource name
My tomee.xml is also similar
<Resource id="****DB" type="javax.sql.DataSource">
UserName ××××
Password ××××
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://localhost/××××
JtaManaged true
connectionProperties zeroDateTimeBehavior=convertToNull;useUnicode=yes;characterEncoding=UTF-8
</Resource>
I also verified by enumerating em.getEntityManagerFactory().getProperties() and found that Platform:OpenJPA JDBC Edition: MySQL Database.
But when I tried doing em.createNamedQuery... I got org.hsqldb.HsqlException: user lacks privilege or object not found. So it seems OpenJPA uses the default hsqldb in spite of the settings.
The sql statement in the server log was copy-and-pasted to phpmyadmin and worked. I even deleted the connectionProperties in tomee.xml but still did not work. Why?
My fault: mysql-connector-java.jar is not in tomee/lib folder. But I think tomee should complain instead of falling back to using hsqldb.