Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Can't deploy when using LAZY, can deply when using EAGER

Hi Michael,

I am not sure if there are any issues with the way GlassFish handles this, but I can try to help you from an EclipseLink point of view.

  The first thing to do is to see if static weaving helps:

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#How_to_Configure_Static_Weaving_for_JPA_Entities

This will help us to isolate whether you are seeing an issue related to classloaders or an issue related to persistence unit configuration.

-Tom

Michael Bar-Sinai wrote:
Hello All,

I develop a large JEE app, with eclipselink as the JPA provider. I switched from Toplink Essentials, where the application had no problem deploying; with eclipselink I get all kinds of Null Pointer Exceptions when I deploy the app. The problem seems to boil down to three relationships between objects. When I make them EAGER, the application deploys. When they're LAZY, it doesn't. I followed this thread <http://www.nabble.com/OneToOne-Mapping-works-with-FetchType.EAGER-but-not-with-FetchType.LAZY--%3E-Exception-when-deploying-%28SGES-2.1%29-p21711849.html>, but they did not come to any conclusions. I did find more info in the logs, though.

The setup:

(Please view in a fixed-width font such as Courier. Some other classes are omitted.)
                 E +-------------------+ P
        +----------|EMailResourceBundle|---------------+
       *|P       1 +-------------------+ *             |
+-------------+      ^1                                |L1
|EMailResource|      |                           L1 +------------------+
+-------------+      |               +--------------|                  |
                     |               |              |BeeriprintCustomer|
                     |               |              |                  |
                     |              L|*             +------------------+
L Lazy               |   L +-------------+              P|*
E Eager              +-----|EMailTemplate|---------------+
P Problem -              * +-------------+L1
   Should be lazy,
   Works only when eager
1/* multiplicity

Whenever I turn any of the links marked "P" to LAZY, I get an NPE while deploying. Here's a sample, where I turned the link between EMailResource and EMailResourceBundle to LAZY:

[#|2009-09-14T08:32:38.562+0300|CONFIG|sun-appserver2.1|org.eclipse.persistence.session.file:/C:/glassfish/AppServer/domains/ebill-dev/applications/j2ee-apps/eBill/eBill-ejb_jar/-eBill-PU-JTA.connection|_ThreadID=16;_ThreadName=Thread-639;|Connected: jdbc:sqlserver://localhost:1433;responseBuffering=full;encrypt=false;databaseName=eBIll;selectMethod=direct;trustServerCertificate=false;lastUpdateCount=true;
	User: glassfish
	Database: Microsoft SQL Server  Version: 9.00.3042
	Driver: Microsoft SQL Server 2005 JDBC Driver  Version: 1.2.2828.100|#]

[#|2009-09-14T08:32:38.640+0300|SEVERE|sun-appserver2.1|org.eclipse.persistence.session.file:/C:/glassfish/AppServer/domains/ebill-dev/applications/j2ee-apps/eBill/eBill-ejb_jar/-eBill-PU-JTA|_ThreadID=16;_ThreadName=Thread-639;_RequestID=faa6e914-cf3b-4c99-a1ed-8f29f110e9f8;|
Local Exception Stack: Exception [EclipseLink-0] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.IntegrityException Descriptor Exceptions: ---------------------------------------------------------

Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setparentBundle_vh] or [_persistence_getparentBundle_vh] is not defined in the object [il.co.beeriprint.ebill.email.templates.EMailResource].
Internal Exception: java.lang.NoSuchMethodException: il.co.beeriprint.ebill.email.templates.EMailResource._persistence_getparentBundle_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[parentBundle]
Descriptor: RelationalDescriptor(il.co.beeriprint.ebill.email.templates.EMailResource --> [DatabaseTable(EMAILRESOURCE)])

Runtime Exceptions: ---------------------------------------------------------

java.lang.NullPointerException

	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:477)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:666)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:630)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:229)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:111)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:163)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:573)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:421)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:287)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:189)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
	at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
	at com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:401)
	at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:260)
	at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
	at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
	at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
	at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
	at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)

Descriptor Exceptions: ---------------------------------------------------------


Local Exception Stack: Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setparentBundle_vh] or [_persistence_getparentBundle_vh] is not defined in the object [il.co.beeriprint.ebill.email.templates.EMailResource].
Internal Exception: java.lang.NoSuchMethodException: il.co.beeriprint.ebill.email.templates.EMailResource._persistence_getparentBundle_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[parentBundle]
Descriptor: RelationalDescriptor(il.co.beeriprint.ebill.email.templates.EMailResource --> [DatabaseTable(EMAILRESOURCE)])
	at org.eclipse.persistence.exceptions.DescriptorException.noSuchMethodWhileInitializingAttributesInMethodAccessor(DescriptorException.java:1143)
	at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.initializeAttributes(MethodAttributeAccessor.java:151)
	at org.eclipse.persistence.mappings.DatabaseMapping.preInitialize(DatabaseMapping.java:1094)
	at org.eclipse.persistence.mappings.ForeignReferenceMapping.preInitialize(ForeignReferenceMapping.java:744)
	at org.eclipse.persistence.mappings.ObjectReferenceMapping.preInitialize(ObjectReferenceMapping.java:863)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3192)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:429)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:666)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:630)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:229)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:111)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:163)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:573)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:421)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:287)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:189)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
	at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
	at com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:401)
	at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:260)
	at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
	at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
	at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
	at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
	at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)
Caused by: java.lang.NoSuchMethodException: il.co.beeriprint.ebill.email.templates.EMailResource._persistence_getparentBundle_vh()
	at java.lang.Class.getDeclaredMethod(Class.java:1937)
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.findMethod(PrivilegedAccessHelper.java:59)
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethod(PrivilegedAccessHelper.java:226)
	at org.eclipse.persistence.internal.helper.Helper.getDeclaredMethod(Helper.java:965)
	at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.initializeAttributes(MethodAttributeAccessor.java:144)
	... 31 more

Runtime Exceptions: ---------------------------------------------------------


java.lang.NullPointerException
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethodReturnType(PrivilegedAccessHelper.java:300)
	at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.getGetMethodReturnType(MethodAttributeAccessor.java:104)
	at org.eclipse.persistence.mappings.ForeignReferenceMapping.validateBeforeInitialization(ForeignReferenceMapping.java:1373)
	at org.eclipse.persistence.descriptors.ClassDescriptor.validateBeforeInitialization(ClassDescriptor.java:5123)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3198)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:429)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:666)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:630)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:229)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:111)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:163)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:573)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:421)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:287)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:189)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
	at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
	at com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:401)
	at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:260)
	at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
	at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
	at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
	at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
	at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)
|#]

[#|2009-09-14T08:32:38.640+0300|SEVERE|sun-appserver2.1|org.eclipse.persistence.session.file:/C:/glassfish/AppServer/domains/ebill-dev/applications/j2ee-apps/eBill/eBill-ejb_jar/-eBill-PU-JTA.ejb|_ThreadID=16;_ThreadName=Thread-639;_RequestID=faa6e914-cf3b-4c99-a1ed-8f29f110e9f8;|
Local Exception Stack: Exception [EclipseLink-0] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.IntegrityException Descriptor Exceptions: ---------------------------------------------------------

Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setparentBundle_vh] or [_persistence_getparentBundle_vh] is not defined in the object [il.co.beeriprint.ebill.email.templates.EMailResource].
Internal Exception: java.lang.NoSuchMethodException: il.co.beeriprint.ebill.email.templates.EMailResource._persistence_getparentBundle_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[parentBundle]
Descriptor: RelationalDescriptor(il.co.beeriprint.ebill.email.templates.EMailResource --> [DatabaseTable(EMAILRESOURCE)])

Runtime Exceptions: ---------------------------------------------------------

java.lang.NullPointerException

	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:477)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:666)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:630)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:229)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:111)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:163)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:150)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:573)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:421)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:287)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:189)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
	at com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
	at com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
	at com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:401)
	at com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:260)
	at com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
	at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
	at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
	at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
	at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
	at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)


IMHO, this looks like eclipselink finds the classes before it adds the _persistence_* methods, thus causing an NPE.

Setup:

    * Windows Server 2003R2
    * Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)
    * Eclipse Persistence Services - 1.1.2.v20090612-r4475

Any solutions would be highly appreciated. I have all the logs and will be very willing to help solve this.

Thanks in advance,
Michael Bar-Sinai


------------------------------------------------------------------------
View this message in context: Can't deploy when using LAZY, can deply when using EAGER <http://www.nabble.com/Can%27t-deploy-when-using-LAZY%2C-can-deply-when-using-EAGER-tp25433376p25433376.html> Sent from the EclipseLink - Users mailing list archive <http://www.nabble.com/EclipseLink---Users-f26658.html> at Nabble.com.


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top