Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » [Solved]Issue with Gemini - "Object is not a known Entity Type"
[Solved]Issue with Gemini - "Object is not a known Entity Type" [message #948031] Wed, 17 October 2012 13:37 Go to next message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
There is alot of ground to cover, so here it goes.

I currently work on a plugin based architecture utilizing the Equinox Framework. We are trying to get a derby database running with the application. First thing is to create the architecture and get that under unit test with JUNIT. I can get the EntityManagerFactory working as it provides an EntityManager, and the EM and EMF contain the metadata for the list of managed types. The problem is when I try to persist the object, I get the usual "Illegal argument Exception: Object: blah@HEX is not a known entity type".

There are 3 plugins you should concern yourself with (although there are ALOT more).
gov.ornl.nice.nicedatastructures - holds the datastructures with JPA annotations and persistence.xml file.
gov.ornl.nicenicedatastructures.test - unit tests the nicedatastructures. Holds the unit test for database persisting, loading, merging, and deleting plus integration.
gov.ornl.nice.database.test - A plugin that contains a class that provides an EntityManagerFactory via OSGI plugin.

Although there is alot of code in the datastructures, I am going to provide a very simple entity data structure I added for current debugging purposes. Nevertheless, the persistence.xml, the database.test class (DatabaseTestComponent.java), and runtime configurations are set due to spec. Granted, if they seem incorrect or need to be adjusted please make the appropriate suggestions.

Here is the persistence unit file:
<persistence-unit name="gov.ornl.nice.datastructures"
		transaction-type="RESOURCE_LOCAL">
		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
		<class>gov.ornl.nice.nicedatastructures.NiCEObject.NiCEObject</class>
		<class>gov.ornl.nice.nicedatastructures.form.DataComponent</class>
		<class>gov.ornl.nice.nicedatastructures.form.Entry</class>
		<class>gov.ornl.nice.nicedatastructures.form.Form</class>
		<class>gov.ornl.nice.nicedatastructures.form.ResourceComponent</class>
		<class>gov.ornl.nice.nicedatastructures.form.TableComponent</class>
		<class>gov.ornl.nice.nicedatastructures.resource.NiCEResource</class>
		<class>gov.ornl.nice.nicedatastructures.form.MatrixComponent</class>
		<class>gov.ornl.nice.nicedatastructures.form.MasterDetailsPair</class>
		<class>gov.ornl.nice.nicedatastructures.form.MasterDetailsComponent</class>
		<class>gov.ornl.nice.nicedatastructures.form.geometry.AbstractShape</class>
		<class>gov.ornl.nice.nicedatastructures.form.geometry.GeometryComponent</class>
		<class>gov.ornl.nice.nicedatastructures.form.geometry.PrimitiveShape</class>
		<class>gov.ornl.nice.nicedatastructures.form.geometry.ComplexShape</class>
		<class>gov.ornl.nice.nicedatastructures.form.geometry.Transformation</class>
		<class>gov.ornl.nice.nicedatastructures.form.painfullySimpleForm.PainfullySimpleForm</class>
		<class>gov.ornl.nice.nicedatastructures.form.painfullySimpleForm.PainfullySimpleEntry</class>
		<class>gov.ornl.nice.nicedatastructures.form.tempEntitier</class>
		<exclude-unlisted-classes>true</exclude-unlisted-classes>
		<properties>
			<!-- Embedded Derby Login -->
			<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
			<property name="javax.persistence.jdbc.url" value="jdbc:derby:comics;create=true" />
			<property name="javax.persistence.jdbc.user" value="APP" />
			<property name="javax.persistence.jdbc.password" value="APP" />
			<!--  Database Schema Creation -->
			<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
			<property name="eclipselink.ddl-generation.output-mode" value="database"/>
			<property name="eclipselink.weaving" value="false" />
			<!-- Logging Settings -->
		  	<property name="eclipselink.logging.level" value="CONFIG" />
			<property name="eclipselink.logging.thread" value="false" />
			<property name="eclipselink.logging.session" value="true" />
			<property name="eclipselink.logging.exceptions" value="true" />
			<property name="eclipselink.logging.timestamp" value="false" />
		</properties>

	</persistence-unit>



Here is the current DatabaseTestComponent.java file:
/**
 * 
 */
package gov.ornl.nice.database.test;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import javax.persistence.EntityManagerFactory;

/**
 * This class is a component called by the OSGi to supply the
 * gov.ornl.nice.nicedatastructures.test bundle the with EntityManagerFactory.
 * 
 * 
 */
public class DatabaseTestComponent {

	/**
	 * The EntityManagerFactory
	 */
	static volatile EntityManagerFactory factory = null;

	/**
	 * A countdown latch for syncing the database test and the OSGi service
	 * startup.
	 */
	private static volatile CountDownLatch serviceLatch = new CountDownLatch(1);

	/**
	 * Set the EntityManagerFactory
	 */
	public static void setFactory(EntityManagerFactory emFactory) {

		System.out.println("DatabaseTestComponent Message: "
				+ "setFactory() called on thread "
				+ Thread.currentThread().getId());

		if (emFactory != null) {
			factory = emFactory;
			serviceLatch.countDown();
			System.out
					.println("NiCE DatabaseTestComponent Message: EntityManagerFactory set!");
		} else
			throw new RuntimeException(
					"NiCE DatabaseTestComponent Message: EntityManagerFactory can not be null!");

	}

	/**
	 * Get the EntityManagerFactory
	 */
	public static EntityManagerFactory getFactory() {

		try {
			serviceLatch.await(10, TimeUnit.SECONDS);
		} catch (InterruptedException e) {
			System.out
					.println("DatabaseTestComponent Message:"
							+ "Interrupted while obtaining EntityManagerFactory service."
							+ " Aborting!");
			e.printStackTrace();
		}

		return factory;
	}

}


Here is the manifest file for the DatabaseTestComponent:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DatabaseTests
Bundle-SymbolicName: gov.ornl.nice.database.test
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: javax.persistence;version="2.0.3",
 org.osgi.framework;version="1.3.0",
 org.osgi.service.jpa;version="1.0.0",
 org.osgi.util.tracker;version="1.5.0"
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/databaseTestComponent.xml
Export-Package: gov.ornl.nice.database.test


Here is the temporary datastructure in the datastructures package:

package gov.ornl.nice.nicedatastructures.form;

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

@Entity
@Table(name = "tempEntitier")
public class tempEntitier {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "DBID_ID")
	public int id = 0;
}


Here is the manifest file for the datastructure:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NiCEDataStructures
Bundle-SymbolicName: gov.ornl.nice.nicedatastructures
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Meta-Persistence: META-INF/persistence.xml
Export-Package: gov.ornl.nice.nicedatastructures.NiCEObject,
 gov.ornl.nice.nicedatastructures.componentVisitor,
 gov.ornl.nice.nicedatastructures.form,
 gov.ornl.nice.nicedatastructures.form.geometry,
 gov.ornl.nice.nicedatastructures.form.painfullySimpleForm,
 gov.ornl.nice.nicedatastructures.location,
 gov.ornl.nice.nicedatastructures.resource,
 gov.ornl.nice.nicedatastructures.updateableComposite
Import-Package: javax.persistence;jpa="2.0";version="1.1.0",
 org.osgi.framework;version="1.6.0",
 org.osgi.service.jpa;version="1.0.0"
Require-Bundle: javax.persistence
Bundle-ActivationPolicy: lazy


Here is the section of code from the datastructureTester:

		

		
		EntityManager eManager = factory.createEntityManager();
		for(EntityType<?> entity: eManager.getMetamodel().getEntities()) {
			System.err.println(entity.getBindableJavaType().toString());
		}
		
		//Lets try to get the properties of the factory
		System.err.println("Output of map: " + eManager.getProperties());
		
		// Begin a new local transaction so that we can persist a new entity
		eManager.getTransaction().begin();

		// Persist, commit, and close

		// If there is an error, catch and return
		try {
			System.out.println("Trying to persist object!");
			tempEntitier object = new tempEntitier();
			eManager.persist(object);
			System.out.println("Getting ready to commit action!");
			eManager.getTransaction().commit();
		} catch (Exception e) {
			e.printStackTrace();
			eManager.clear();
			fail();
			//return false;
		}


Here is the manifest of the datastructuretest plugin:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NiCEDataStructuresTest
Bundle-SymbolicName: gov.ornl.nice.nicedatastructures.test
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: javax.persistence;bundle-version="2.0.3",
 org.junit;bundle-version="4.8.2"
Import-Package: gov.ornl.nice.database.test,
 gov.ornl.nice.nicedatastructures.NiCEObject,
 gov.ornl.nice.nicedatastructures.componentVisitor,
 gov.ornl.nice.nicedatastructures.form,
 gov.ornl.nice.nicedatastructures.form.geometry,
 gov.ornl.nice.nicedatastructures.form.painfullySimpleForm,
 gov.ornl.nice.nicedatastructures.location,
 gov.ornl.nice.nicedatastructures.resource,
 gov.ornl.nice.nicedatastructures.updateableComposite,
 javax.persistence;version="2.0.3",
 org.osgi.framework;version="1.6.0",
 org.osgi.service.jpa;version="1.0.0",
 org.osgi.util.tracker;version="1.5.0"
Bundle-ActivationPolicy: lazy


Here is the run configuration for JUnit tests (only start levels):

<stringAttribute key="selected_target_plugins" value="javax.servlet@default:default,org.junit4@default:default,org.eclipse.equinox.registry@default:default,
org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.core.jobs@default:default,
org.eclipse.persistence.jpa.jpql*1.0.0.v20110604-r9504@default:default,org.eclipse.equinox.frameworkadmin@default:default,
org.eclipse.persistence.core*2.3.2.v20111125-r10461@3:true,
org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.persistence.jpa.jpql*1.0.1.v20111125-r10461@default:default,javax.xml@default:default,org.eclipse.net4j.jms.api@default:default,
org.eclipse.persistence.moxy@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.ant.core@default:default,org.eclipse.osgi@-1:true,org.eclipse.core.filesystem@default:default,org.eclipse.equinox.ds@default:true,
org.eclipse.equinox.app@default:default,
org.eclipse.persistence.jpa.equinox*2.3.0.v20110604-r9504@default:false,org.eclipse.persistence.jpa*2.3.0.v20110604-r9504@3:default,
org.eclipse.persistence.asm*2.3.0.v20110604-r9504@3:true,
org.eclipse.persistence.jpa.equinox.weaving*2.3.2.v20111125-r10461@default:false,
org.eclipse.osgi.services@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,
org.eclipse.equinox.preferences@default:default,org.eclipse.update.configurator@3:true,org.eclipse.persistence.jpa.osgi*2.3.0.v20110604-r9504@3:true,
org.eclipse.core.variables@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.persistence.core*2.3.0.v20110604-r9504@3:true,javax.persistence@1:true,com.jcraft.jsch@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,
org.eclipse.equinox.util@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,
org.eclipse.core.runtime.compatibility.auth@default:default,javax.activation@default:default,javax.mail@default:default,org.eclipse.persistence.antlr@3:true,
org.apache.derby@2:true,javax.xml.bind@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.transforms.hook@default:false,
org.eclipse.gemini.jpa@2:true,org.eclipse.osgi.util@default:default,org.hamcrest.core@default:default,
org.apache.ant@default:default,
org.eclipse.equinox.common@2:true,javax.xml.stream@default:default,
javax.transaction@default:false,osgi.enterprise@2:true,
org.eclipse.core.runtime.compatibility@default:default,
org.eclipse.core.runtime@default:true,org.eclipse.persistence.jpa.equinox.weaving*2.3.0.v20110604-r9504@default:false,org.eclipse.gemini.dbaccess.derby@2:true"/>
<stringAttribute key="selected_workspace_plugins" value="gov.ornl.nice.nicedatastructures@default:default,
gov.ornl.nice.nicedatastructures.test@default:default,gov.ornl.nice.database.test@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>


Here is what is outputted (plus stack trace):


osgi> Gemini DBAccess Derby starting
!SESSION 2012-10-17 14:11:01.253 -----------------------------------------------
eclipse.buildId=unknown
java.fullversion=JRE 1.6.0 IBM J9 2.4 Linux amd64-64 jvmxa6460sr9-20110324_78506 (JIT enabled, AOT enabled)
J9VM - 20110324_078506
JIT  - r9_20101028_17488ifx3
GC   - 20101027_AA
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -version 3 -port 60323 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -test gov.ornl.nice.nicedatastructures.test.nicedatastructurestests.FormDatabaseTester:testPersistToDatabase -application org.eclipse.pde.junit.runtime.coretestapplication -testpluginname gov.ornl.nice.nicedatastructures.test
Command-line arguments:  -os linux -ws gtk -arch x86_64 -consoleLog -console -version 3 -port 60323 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -test gov.ornl.nice.nicedatastructures.test.nicedatastructurestests.FormDatabaseTester:testPersistToDatabase -application org.eclipse.pde.junit.runtime.coretestapplication -data /home/s4h/IBM/rationalsdp/workspace/../junit-workspace -dev file:/home/s4h/IBM/rationalsdp/workspace/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog -console -testpluginname gov.ornl.nice.nicedatastructures.test

!ENTRY org.eclipse.osgi 2 0 2012-10-17 14:11:03.458
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-10-17 14:11:03.458
!MESSAGE Bundle reference:file:/home/s4h/IBM/rationalsdp/workspace/com.rcpvision.rcpmailsample/ was not resolved.
!SUBENTRY 2 com.rcpvision.rcpmailsample 2 0 2012-10-17 14:11:03.459
!MESSAGE Missing required bundle org.eclipse.ui_0.0.0.

!ENTRY org.eclipse.osgi 2 0 2012-10-17 14:11:03.460
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-10-17 14:11:03.461
!MESSAGE Bundle com.rcpvision.rcpmailsample_1.0.0.qualifier [4] was not resolved.
!SUBENTRY 2 com.rcpvision.rcpmailsample 2 0 2012-10-17 14:11:03.461
!MESSAGE Missing required bundle org.eclipse.ui_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2012-10-17 14:11:03.462
!MESSAGE Bundle org.eclipse.persistence.jpa.equinox.weaving_2.3.0.v20110604-r9504 [55] was not resolved.
[b]A BUNCH OF EL CONFIG CALLS HERE!  I REMOVED THEM BECAUSE OF CHARACTER LIMIT!![/b]

[EL Config]: ServerSession(939145210)--Connection(766520752)--connecting(DatabaseLogin(
	platform=>JavaDBPlatform
	user name=> "APP"
	connector=>JNDIConnector datasource name=>null
))
[EL Config]: ServerSession(939145210)--Connection(1068646322)--Connected: jdbc:derby:comics
	User: APP
	Database: Apache Derby  Version: 10.5.1.1 - (764942)
	Driver: Apache Derby Embedded JDBC Driver  Version: 10.5.1.1 - (764942)
[EL Config]: ServerSession(939145210)--Connection(1395479341)--connecting(DatabaseLogin(
	platform=>JavaDBPlatform
	user name=> "APP"
	connector=>JNDIConnector datasource name=>null
))
[EL Config]: ServerSession(939145210)--Connection(1613324329)--Connected: jdbc:derby:comics
	User: APP
	Database: Apache Derby  Version: 10.5.1.1 - (764942)
	Driver: Apache Derby Embedded JDBC Driver  Version: 10.5.1.1 - (764942)
[EL Info]: ServerSession(939145210)--gov.ornl.nice.datastructures_nonJtaDataSource=140445791 login successful
[EL Warning]: ServerSession(939145210)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ALTER TABLE failed. There is no constraint 'APP.MSTRDTLSCMPNNTDBDD' on table '"APP"."MASTERDETAILSCOMPONENT_NICEOBJECT"'. 
Error Code: 30000
Call: ALTER TABLE MasterDetailsComponent_NiCEObject DROP CONSTRAINT MstrDtlsCmpnntDBDD
Query: DataModifyQuery(sql="ALTER TABLE MasterDetailsComponent_NiCEObject DROP CONSTRAINT MstrDtlsCmpnntDBDD")
[EL Warning]: ServerSession(939145210)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ALTER TABLE failed. There is no constraint 'APP.MSTRDTLSCMPNNTDBDD' on table '"APP"."MASTERDETAILSCOMPONENT_MASTERDETAILSPAIR"'. 
Error Code: 30000
Call: ALTER TABLE MasterDetailsComponent_MasterDetailsPair DROP CONSTRAINT MstrDtlsCmpnntDBDD
Query: DataModifyQuery(sql="ALTER TABLE MasterDetailsComponent_MasterDetailsPair DROP CONSTRAINT MstrDtlsCmpnntDBDD")
[EL Warning]: ServerSession(939145210)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Constraint 'MSTRDTLSCMPNNTDBDD' already exists in Schema 'APP'.
Error Code: 30000
Call: ALTER TABLE MasterDetailsComponent_NiCEObject ADD CONSTRAINT MstrDtlsCmpnntDBDD FOREIGN KEY (MasterDetailsComponent_DBID_ID) REFERENCES NiCEObject (DBID_ID)
Query: DataModifyQuery(sql="ALTER TABLE MasterDetailsComponent_NiCEObject ADD CONSTRAINT MstrDtlsCmpnntDBDD FOREIGN KEY (MasterDetailsComponent_DBID_ID) REFERENCES NiCEObject (DBID_ID)")
[EL Warning]: ServerSession(939145210)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Constraint 'MSTRDTLSCMPNNTDBDD' already exists in Schema 'APP'.
Error Code: 30000
Call: ALTER TABLE MasterDetailsComponent_MasterDetailsPair ADD CONSTRAINT MstrDtlsCmpnntDBDD FOREIGN KEY (MasterDetailsComponent_DBID_ID) REFERENCES NiCEObject (DBID_ID)
Query: DataModifyQuery(sql="ALTER TABLE MasterDetailsComponent_MasterDetailsPair ADD CONSTRAINT MstrDtlsCmpnntDBDD FOREIGN KEY (MasterDetailsComponent_DBID_ID) REFERENCES NiCEObject (DBID_ID)")
[EL Warning]: ServerSession(939145210)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'APP'.
Error Code: 30000
Call: CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))
Query: DataModifyQuery(sql="CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))")
class gov.ornl.nice.nicedatastructures.form.TableComponent
class gov.ornl.nice.nicedatastructures.form.geometry.GeometryComponent
Factory's managed types: org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler@79f979f9
class gov.ornl.nice.nicedatastructures.form.geometry.Transformation
class gov.ornl.nice.nicedatastructures.form.geometry.PrimitiveShape
class gov.ornl.nice.nicedatastructures.form.painfullySimpleForm.PainfullySimpleEntry
class gov.ornl.nice.nicedatastructures.form.MatrixComponent
class gov.ornl.nice.nicedatastructures.NiCEObject.NiCEObject
class gov.ornl.nice.nicedatastructures.form.MasterDetailsPair
class gov.ornl.nice.nicedatastructures.form.DataComponent
class gov.ornl.nice.nicedatastructures.form.MasterDetailsComponent
class gov.ornl.nice.nicedatastructures.form.geometry.AbstractShape
class gov.ornl.nice.nicedatastructures.form.ResourceComponent
class gov.ornl.nice.nicedatastructures.form.painfullySimpleForm.PainfullySimpleForm
class gov.ornl.nice.nicedatastructures.form.Entry
class gov.ornl.nice.nicedatastructures.form.Form
class gov.ornl.nice.nicedatastructures.form.tempEntitier
class gov.ornl.nice.nicedatastructures.resource.NiCEResource
class gov.ornl.nice.nicedatastructures.form.geometry.ComplexShape
Output of map: {eclipselink.logging.exceptions=true, javax.persistence.jdbc.url=jdbc:derby:comics;create=true, eclipselink.persistencexml=META-INF/persistence.xml, eclipselink.logging.thread=false, eclipselink.ddl-generation=drop-and-create-tables, eclipselink.ddl-generation.output-mode=database, javax.persistence.jdbc.password=APP, eclipselink.logging.level=CONFIG, eclipselink.weaving=false, javax.persistence.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver, javax.persistence.nonJtaDataSource=org.eclipse.gemini.jpa.PlainDriverDataSource@85f085f, javax.persistence.jdbc.user=APP, eclipselink.logging.session=true, eclipselink.logging.timestamp=false, org.eclipse.gemini.jpa.bundle=gov.ornl.nice.nicedatastructures_2.0.0 [6], eclipselink.classloader=org.eclipse.gemini.jpa.classloader.CompositeClassLoader@138d138d}
Trying to persist object!
java.lang.IllegalArgumentException: Object: gov.ornl.nice.nicedatastructures.form.tempEntitier@1f921f92 is not a known entity type.
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4169)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:440)
	at gov.ornl.nice.nicedatastructures.test.nicedatastructurestests.FormDatabaseTester.testPersistToDatabase(FormDatabaseTester.java:245)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
[EL Config]: ServerSession(939145210)--Connection(1392595713)--disconnect
[EL Info]: ServerSession(939145210)--gov.ornl.nice.datastructures_nonJtaDataSource=140445791 logout successful




Overall, I hope this is a good starting point. I would create a simpler case if I could, but this is about as stripped down as I can get within a plugin-based architecture.

Something to note, I did remove a whole mess of debug calls on the database for the tester. There seems to be a character limit on each posting, and I had to cut that down to size. There were no exceptions or errors called in them, tho.


Here are some things I have tried already (but do not currently reflect on the stuff above):
1.) Tried to add javax.persistence version=1.0.0;jpa=2.0 across all the references of javax.persistence, but that did not seem to work. Granted, I do believe I have at least 2.0.3.
2.) I have tried to call the EntityManagerFactory in the same plugin as the datastructure.test plugin (instead of the separate, database.test plugin) but that did not work either.
3.)I have tried to add JPA-Persistence tag to the manifest file of the datastructure's plugin. Did not work either (And caused alot of bugs to pop up).

What I assume (granted you can refute):
1.)All my jar files and referenced libraries are in tact.
2.)This is possible with the listed datastructures. I have had it working before in a different scenario.
3.)That my "persistence unit" is in one plugin, as required by Gemini architecture.



Feel free to post thoughts or suggestions. I have tried a few tricks already, but I am open for more ideas.

[Updated on: Mon, 22 October 2012 08:40]

Report message to a moderator

Re: Issue with Gemini - "Object is not a known Entity Type" [message #948064 is a reply to message #948031] Wed, 17 October 2012 14:22 Go to previous messageGo to next message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
-Reserved-

[Updated on: Wed, 17 October 2012 14:26]

Report message to a moderator

Re: Issue with Gemini - "Object is not a known Entity Type" [message #948934 is a reply to message #948064] Thu, 18 October 2012 10:27 Go to previous messageGo to next message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
An update. Looks like I needed to add " DREFRESH_BUNDLES=FALSE" to my VM arguments under eclipse. I am working out the kinks in my testing code, but looks like this is helping to solve the issue.

In other words, its the old fashioned REFRESHING issue, a common problem in the GEMINI package. More to follow.

[Updated on: Thu, 18 October 2012 10:28]

Report message to a moderator

Re: Issue with Gemini - "Object is not a known Entity Type" [message #949102 is a reply to message #948031] Thu, 18 October 2012 13:39 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
Hi Scott,

I'm not sure I get all of what the plugin that "provides an EntityManagerFactory via OSGI plugin" is doing, but it looks like it is assuming to get injected, and I saw further down that you are using DS, so are you expecting DS to inject it?

Assuming you are getting an EMF injected as you expect then the output log should show the entity classes that are getting processed. Set the eclipselink.logging.level to FINEST to get all of the config info, and set the GEMINI_DEBUG property described here and then please post that output. If it is too big then just attach it as a file.

A couple things to fix:

- The examples from the EclipseLink wiki are for using the obsolete native EclipseLink OSGi support. They should be ignored.

- org.eclipse.persistence.jpa.equinox, org.eclipse.persistence.jpa.equinox.weaving, and org.eclipse.persistence.jpa.osgi JARs should not be installed or used with Gemini. They were for the obsolete OSGi support and are no longer used.

A couple of style suggestions:

- Don't ever initialize an id variable in place, particularly one that is supposed to be auto-generated.

- You should not include both a Require-Bundle as well as an Import-Package for the same packages. It is confusing and error-prone.

-Mike
Re: Issue with Gemini - "Object is not a known Entity Type" [message #950417 is a reply to message #948031] Fri, 19 October 2012 18:10 Go to previous messageGo to next message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
Keith,

Thanks for your reply! Setting that configuration did solve my problem with the run configuration file for JUnit tests.

And yes, you are correct. I am using the DS, but here is the output right after the first set of EL Config calls (which are setting up the database compared to the datstructures listed in my files).

<Up here, setting up parameters for database, EL Config calls, etc>
[EL Config]:Using OSGi initializer: [org.eclipse.persistence.internal.jpa.deployment.osgi.equinox.EquinoxInitializer]
-I believe this statement calls my database.test class.


Now this leads me to a sort of outside the box question. We use Maven tycho to run the JUNIT tests. The problem with Tycho is that, like the run configuration, you have to setup the run levels and autostarts of the files. If anyone uses maven to run their JUNIt tests on the database and utilizes database.test functionality, I need help configuring the run configurations for the factory setter (its not calling NiCEDatabaseTestComponent to set the factory).

Thanks!
Re: Issue with Gemini - "Object is not a known Entity Type" [message #953671 is a reply to message #948031] Mon, 22 October 2012 08:40 Go to previous message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
Looks like I got it figured out. It was not start order issue, but an export issue on the OSGI-INF file for the gov.ornl.nice.database.test. The OSGI-INF contains a component file that the OSGI reads in during startup for the tests and for the build in order to configure the database correctly. Spending several hours with a run config and a pom did not seem to solve the issue. The fix was to check a box in eclipse.

For those of you who need the start levels, google for mediawiki start levels jpa NiCE.

I am marking this as solved.
Previous Topic:Blueprint: Namespace trouble
Next Topic:[Solved]Recalibrate EMF or EM during runtime - database location
Goto Forum:
  


Current Time: Sat Jul 26 05:27:04 EDT 2014

Powered by FUDForum. Page generated in 0.02465 seconds