この日記は私的なものであり所属会社の見解とは無関係です。 GitHub: takahashikzn

Lazy Loadingを設定していると、Webアプリがときどき起動失敗する件

EclipseLinkでLazy Loadingを設定していると、ときどき盛大にエラーを吐いてTomcatが起動失敗することがあります。

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_setbelongArea_vh] or [_persistence_getbelongArea_vh] is not defined in the object [jp.root42.r42fw_sample_shop.model.entity.Shop]. 
Internal Exception: java.lang.NoSuchMethodException: jp.root42.r42fw_sample_shop.model.entity.Shop._persistence_getbelongArea_vh() 
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[belongArea] 
Descriptor: RelationalDescriptor(jp.root42.r42fw_sample_shop.model.entity.Shop --> [DatabaseTable(SHOP)]) 
Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException 
Exception Description: The method [_persistence_setrole_vh] or [_persistence_getrole_vh] is not defined in the object [jp.root42.r42fw_sample_auth.model.entity.Permission]. 
Internal Exception: java.lang.NoSuchMethodException: jp.root42.r42fw_sample_auth.model.entity.Permission._persistence_getrole_vh() 
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[role] 
Descriptor: RelationalDescriptor(jp.root42.r42fw_sample_auth.model.entity.Permission --> [DatabaseTable(PERMISSION)]) 
Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException 
Exception Description: The method [_persistence_setproductImage_vh] or [_persistence_getproductImage_vh] is not defined in the object [jp.root42.r42fw_sample_shop.model.entity.Product]. 
Internal Exception: java.lang.NoSuchMethodException: jp.root42.r42fw_sample_shop.model.entity.Product._persistence_getproductImage_vh() 
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[productImage] 
Descriptor: RelationalDescriptor(jp.root42.r42fw_sample_shop.model.entity.Product --> [DatabaseTable(PRODUCT)]) 
Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException 
Exception Description: The method [_persistence_setworkingShop_vh] or [_persistence_getworkingShop_vh] is not defined in the object [jp.root42.r42fw_sample_shop.model.entity.Employee]. 
Internal Exception: java.lang.NoSuchMethodException: jp.root42.r42fw_sample_shop.model.entity.Employee._persistence_getworkingShop_vh() 
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[workingShop] 
Descriptor: RelationalDescriptor(jp.root42.r42fw_sample_shop.model.entity.Employee --> [DatabaseTable(EMPLOYEE)]) 
Exception [EclipseLink-60] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException 
Exception Description: The method [_persistence_setrank_vh] or [_persistence_getrank_vh] is not defined in the object [jp.root42.r42fw_sample_shop.model.entity.Employee]. 
Internal Exception: java.lang.NoSuchMethodException: jp.root42.r42fw_sample_shop.model.entity.Employee._persistence_getrank_vh() 
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[rank] 
Descriptor: RelationalDescriptor(jp.root42.r42fw_sample_shop.model.entity.Employee --> [DatabaseTable(EMPLOYEE)]) 
Runtime Exceptions:
---------------------------------------------------------
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException 
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:477)
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:666)
    org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:617)
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:227)
    org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:255)
    org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:111)

うーん、何がなんだか、といった感じですね。


こういうときは、Tomcatワークディレクトリのクリーンをすると大丈夫な模様。