Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink error 3002
Eclipselink error 3002 [message #1754707] Tue, 21 February 2017 17:14 Go to next message
Graham Stephenson is currently offline Graham StephensonFriend
Messages: 4
Registered: February 2017
Junior Member
I am doing a simple migration from Toplink 10g to native Eclipselink v2.6.4 by following the instructions to do so, namely using the renaming utility to update my package import statements and begin using eclipselink.jar (built in to Weblogic 12.2.1) instead of toplink.jar in my WEB-INF\lib folder.

Everything compiles ok but when I try to run my app I get the error below.

I tried using the old deployment mapping file as well as a new one generated from Eclipselink workbench by importing my old Toplink workbench project. Both cause the same error.

Note that I'm only doing a migration from Toplink to native Eclispelink. There is no JPA involved.

Any ideas on what`s wrong? It seems like it's trying to improperly use String instead of my actual class, but not sure.

Also, I know it says classNotFoundException but I haven't moved anything. The main difference is that Eclipselink is in the container now instead of Toplink in my web-inf\lib folder.

Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [ca.ncams.wisor.refdata.AccessTandem], of class [class java.lang.String], from mapping [org.eclipse.persistence.oxm.mappings.XMLDirectMapping[javaClass-->class/text()]] with descriptor [XMLDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor --> [DatabaseTable(class-mapping-descriptor)])], could not be converted to [class java.lang.Class].
Internal Exception: java.lang.ClassNotFoundException: ca.ncams.wisor.refdata.AccessTandem
                at org.eclipse.persistence.exceptions.ConversionException.couldNotBeConvertedToClass(ConversionException.java:98)
                at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToClass(ConversionManager.java:451)
                at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:146)
                at org.eclipse.persistence.internal.oxm.XMLConversionManager.convertObject(XMLConversionManager.java:197)
                at org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.convertObject(DatasourcePlatform.java:179)
                at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.getAttributeValue(XMLDirectMapping.java:301)
                at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow(XMLDirectMapping.java:364)
                at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1539)
                at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:462)
                at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildAttributesIntoObject(XMLObjectBuilder.java:378)
                at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildObject(XMLObjectBuilder.java:291)
                at org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.buildCompositeObject(XMLCompositeCollectionMapping.java:380)
                at org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.buildObjectFromNestedRow(XMLCompositeCollectionMapping.java:587)
                at org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping.valueFromRow(XMLCompositeCollectionMapping.java:511)
                at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1539)
                at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:462)
                at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildAttributesIntoObject(XMLObjectBuilder.java:378)
                at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildObject(XMLObjectBuilder.java:291)
                at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.xmlToObject(DOMUnmarshaller.java:469)
                at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.unmarshal(DOMUnmarshaller.java:267)
                at org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller.unmarshal(DOMUnmarshaller.java:246)
                at org.eclipse.persistence.internal.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:530)
                at org.eclipse.persistence.sessions.factories.XMLProjectReader.readObjectPersistenceRuntimeFormat(XMLProjectReader.java:293)
                at org.eclipse.persistence.sessions.factories.XMLProjectReader.read(XMLProjectReader.java:186)
                at org.eclipse.persistence.sessions.factories.XMLProjectReader.read(XMLProjectReader.java:242)
                at org.eclipse.persistence.sessions.factories.XMLProjectReader.read(XMLProjectReader.java:100)
                at ca.ncams.wisor.persistence.toplink.PersistenceManager.initializeTopLink(PersistenceManager.java:491)
                at ca.ncams.wisor.persistence.toplink.PersistenceManager.<init>(PersistenceManager.java:83)
                at ca.ncams.wisor.persistence.toplink.PersistenceManager.getInstance(PersistenceManager.java:96)
                at ca.ncams.wisor.persistence.toplink.AutoRollbackFilter.doFilter(AutoRollbackFilter.java:57)
                at ca.ncams.wisor.filter.FilterChainImpl.doFilter(FilterChainImpl.java:124)
                at ca.ncams.wisor.presentation.filters.CatchAllFilter.doFilter(CatchAllFilter.java:60)
                at ca.ncams.wisor.filter.FilterChainImpl.doFilter(FilterChainImpl.java:124)
                at ca.ncams.wisor.presentation.filters.NoCacheFilter.doFilter(NoCacheFilter.java:47)
                at ca.ncams.wisor.filter.FilterChainImpl.doFilter(FilterChainImpl.java:124)
                at ca.ncams.wisor.filter.FilterJspBase.service(FilterJspBase.java:111)
                at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
                at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
                at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
                at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
                at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:489)
                at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:376)
                at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
                at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3679)
                at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.__run(WebAppServletContext.java:3649)
                at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java)
                at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
                at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
                at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
                at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
                at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)
                at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)
                at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)
                at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
                at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
                at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
                at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
                at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
                at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
                at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
                at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
                at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
                at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused by: java.lang.ClassNotFoundException: ca.ncams.wisor.refdata.AccessTandem
                at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                at java.lang.Class.forName0(Native Method)
                at java.lang.Class.forName(Class.java:348)
                at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToClass(ConversionManager.java:448)
                ... 61 more

[Updated on: Wed, 22 February 2017 22:36]

Report message to a moderator

Re: Eclipselink error 3002 [message #1754889 is a reply to message #1754707] Thu, 23 February 2017 15:38 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1272
Registered: July 2009
Senior Member
The inner exception shows that it is trying to load the ca.ncams.wisor.refdata.AccessTandem class but it isn't found by the classloader. Check that you are passing in the proper classloader to the XMLProjectReader method. If one isn't passed in, it will use the same classloader that loaded the Eclipselink classes, which might not have visibility to your project classes.
Re: Eclipselink error 3002 [message #1754899 is a reply to message #1754889] Thu, 23 February 2017 17:09 Go to previous messageGo to next message
Graham Stephenson is currently offline Graham StephensonFriend
Messages: 4
Registered: February 2017
Junior Member
Thanks Chris. I will have a look from that angle and post again when I find out a little bit more.
Re: Eclipselink error 3002 [message #1754911 is a reply to message #1754899] Thu, 23 February 2017 21:22 Go to previous messageGo to next message
Graham Stephenson is currently offline Graham StephensonFriend
Messages: 4
Registered: February 2017
Junior Member
Here's how Toplink 10g is being initialized. What do I need to modify for Eclipselink?
I see that the XMLProjectReader.read() method is not passing in a classloader (using the default). Should I be passing one in and where do I get one?
My app also has a ClassloaderServlet which loads classes specified in web.xml at startup, but none of those are what the XMLProjectReader seems to need.

private void initializeTopLink() {
		Config config = Config.getInstance();
		
		Project project = XMLProjectReader.read( config.getProperty( "TopLinkMappingFile" ) );
		
		// Override the database URL, user id and password specified in the 
		// TopLink project with values from config.properties.
		DatabaseLogin login = project.getLogin();
		
		// Overwrite any database URLs, userids and passwords that may be present
		// in the TopLink project file.  Who knows where they're pointing...
		login.setDatabaseURL("");
		login.setUserName("");
		login.setPassword("");

		// Tell TopLink that we're using another connection pool (WebLogic's).
		login.useExternalConnectionPooling();

		// set Toplink to use batch writing, bulks mutiple SQL updates into 1 DB network call
		// This only works if the database being used and the jdbc driver support batching  
		login.useBatchWriting();

		// Connect to the WebLogic connection pool using a data source.
		try {
			javax.naming.Context context = new javax.naming.InitialContext();
			Connector connector = new JNDIConnector( context, DATASOURCE_NAME );
			login.setConnector( connector );
		}
		catch ( javax.naming.NamingException e ) {
			throw new PersistenceException( e, "Unable to connect to connection pool datasource" );
		}

		serverSession = project.createServerSession();
		serverSession.login();
	}
Re: Eclipselink error 3002 [message #1754921 is a reply to message #1754911] Fri, 24 February 2017 02:46 Go to previous messageGo to next message
Graham Stephenson is currently offline Graham StephensonFriend
Messages: 4
Registered: February 2017
Junior Member
Ok, here's what I ended up doing:

1. Add Eclipselink 2.6.4 dependency to my pom (compile instead of provided)
2. Add to weblogic.xml:

<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.eclipse.persistence</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>

Now Eclipselink finds my classes and boots up.

If there is another way though (per my previous reply above) I'd still be curious to know how.
Re: Eclipselink error 3002 [message #1755694 is a reply to message #1754921] Mon, 06 March 2017 20:22 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1272
Registered: July 2009
Senior Member
XMLProjectReader.read should be passed in the application's classloader. Try
XMLProjectReader.read( config.getProperty( "TopLinkMappingFile" ), this.getClass().getClassLoader()  );
this should work assuming the class can be loaded using the same loader that is loading the initializeTopLink class/method.
Previous Topic:Wildfly 10.0.0.Final - Sample War App - Using Eclipselink 2.6.4 - jar-file paths not properly handle
Next Topic:Connection does not get closed after entityManager.getTransaction().commit(); call
Goto Forum:
  


Current Time: Sat Nov 18 19:53:04 GMT 2017

Powered by FUDForum. Page generated in 0.02162 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software