Bug 310329

Summary: ValidationException is thrown when deploy jpa 2.0 cacheable test model on Server
Product: z_Archived Reporter: Yiping Zhao <yiping.zhao>
Component: EclipselinkAssignee: Yiping Zhao <yiping.zhao>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.orm-inbox, kevin.yuan, michael.f.obrien, tom.ware
Version: unspecifiedKeywords: test
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Yiping Zhao CLA 2010-04-23 15:11:14 EDT
The problem appears with GlassFish V3. The persistence.xml of server side has not checked in SVN yet, it looks like:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">

<persistence-unit name="DISABLE_SELECTIVE" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/EclipseLinkDS</jta-data-source>
        <mapping-file>META-INF/cacheable-entity-mappings.xml</mapping-file>
        <class>org.eclipse.persistence.testing.models.jpa.cacheable.CacheableFalseEntity</class>
        <class>org.eclipse.persistence.testing.models.jpa.cacheable.CacheableTrueEntity</class>
        <class>org.eclipse.persistence.testing.models.jpa.cacheable.ChildCacheableFalseEntity</class>
        <class>org.eclipse.persistence.testing.models.jpa.cacheable.CacheableTrueMappedSuperclass</class>
        <class>org.eclipse.persistence.testing.models.jpa.cacheable.SubCacheableFalseEntity</class>
        <class>org.eclipse.persistence.testing.models.jpa.cacheable.SubCacheableNoneEntity</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode>
        <properties>
            <property name="eclipselink.target-server" value="weblogic"/>
            <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.oracle.Oracle11Platform"/>
            <property name="eclipselink.validate-existence" value="true"/>
            <property name="eclipselink.weaving" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

The error is from deployment as following:

[#|2010-04-23T15:07:36.468-0400|SEVERE|glassfishv3.0|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=24;_ThreadName=Thread-1;|Exception while preparing the app
org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.0.qualifier): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [DISABLE_SELECTIVE] failed.
Internal Exception: Exception [EclipseLink-7215] (Eclipse Persistence Services - 2.1.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Could not load the field named [id] on the class [class org.eclipse.persistence.testing.models.jpa.xml.cacheable.CacheableTrueEntity]. Ensure there is a corresponding field with that name defined on the class.
	at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:148)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:296)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
	at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
	at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
	at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
	at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
	at java.lang.Thread.run(Thread.java:619)

Note:
the problem appears with latest weblogic as well
Comment 1 Tom Ware CLA 2010-06-02 14:48:41 EDT
Reassigning to QA.   The Ear that gets build contains classes that do not match the classes in the mapping xml.
Comment 2 Yiping Zhao CLA 2010-06-02 16:02:03 EDT
check in the fix in trunk as revision 7344. The following changes include the fix and other updates, the changes are:

1. in <trunk>/jpa/eclipselink.jpa.test/build.xml
(1). update model dir to be "org/eclipse/persistence/testing/models/jpa/xml/cacheable" in jpa/eclipselink.jpa.test/build.xml
(2). enable the tests on server

2. change trunk\jpa\eclipselink.jpa.test\src\org\eclipse\persistence\testing\tests\jpa\cacheable\CacheableModelJunitTest
(1). exclude the tests which have nested entity managers because that's not allowed on server.
(2). put em.refresh() statements inside transaction, since it's needed on server

code is reviewed by Kevin Yuan.
Comment 3 Kevin Yuan CLA 2010-06-03 13:34:50 EDT
Already fixed on 2.1.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:10:38 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink