Eclipselink错误3002

时间:2017-02-21 16:47:43

标签: java jpa eclipselink toplink

按照here的说明(特别是任务3和4),我正在从Toplink 10g迁移到本机Eclipselink v2.6.4。一切都编译好,但当我尝试运行我的应用程序时,我得到以下错误。

我尝试使用旧的映射文件(仍然兼容)以及通过导入旧的Toplink工作台项目从Eclipselink工作台生成的新映射文件。

请注意,我只是从Toplink迁移到本机Eclispelink。没有涉及JPA。

关于什么错误的任何想法?似乎它试图不正确地使用String而不是我的实际类,但不确定。

此外,我的应用程序从未有过persistence.xml文件。我现在需要一个吗?

2017-02-20 14:55:52 ERROR - Presentation - Local Exception Stack: 
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

1 个答案:

答案 0 :(得分:0)

这是我最终做的事情:

  1. 将Eclipselink 2.6.4依赖项添加到pom(编译而不是提供)
  2. 添加到weblogic.xml:
  3. <wls:container-descriptor>
        <wls:prefer-application-packages>
             <wls:package-name>org.eclipse.persistence</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
    

    现在Eclipselink找到了我的课程并启动了。

    请注意,我的代码只是传递给映射文件,而不是传递给XMLProjectReader.read();的类加载器,所以我想使用的是默认的类加载器。

    如果有人知道如何传入类加载器,我仍然很想知道(我从哪里得到它?)。