我有一个已经在oracle应用服务器上多次部署的jsf项目,它使用eclipse链接2.2.0,在最近的一次新安装中,网站在从DB加载数据时崩溃,因为它一直在执行相同的查询数千个然后它抛出stackoverflow异常
如果我从本地jdev连接到同一个新安装,应用程序正常启动,所以看起来服务器配置问题而不是编码问题。 用于创建对象描述符的代码
public ClassDescriptor buildTLEntityPCDAODescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(com.its.tabs.tpc.layers.dal.entity.toplink.TLEntityPCDAO.class);
descriptor.addTableName("TPC_ENTITIES");
descriptor.addPrimaryKeyFieldName("TPC_ENTITIES.ENTITY_ID");
// Inheritance Properties.
// Descriptor Properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.useRemoteSoftCacheWeakIdentityMap();
descriptor.setRemoteIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("TPC_ENTITIES.ENTITY_ID");
descriptor.setSequenceNumberName("SEQ_ENTITIES");
descriptor.setAlias("TLEntityPCDAO");
// Cache Invalidation Policy
TimeToLiveCacheInvalidationPolicy policy = new TimeToLiveCacheInvalidationPolicy(1);
policy.setShouldUpdateReadTimeOnUpdate(false);
descriptor.setCacheInvalidationPolicy(policy);
// Query Manager.
descriptor.getQueryManager().checkCacheForDoesExist();
DirectToFieldMapping descriptionMapping = new DirectToFieldMapping();
descriptionMapping.setAttributeName("description");
descriptionMapping.setFieldName("TPC_ENTITIES.DESCRIPTION");
descriptor.addMapping(descriptionMapping);
DirectToFieldMapping serviceProviderCodeMapping = new DirectToFieldMapping();
serviceProviderCodeMapping.setAttributeName("serviceProviderCode");
serviceProviderCodeMapping.setFieldName("TPC_ENTITIES.SERVICE_PROVIDER_CODE");
descriptor.addMapping(serviceProviderCodeMapping);
DirectToFieldMapping entity_idMapping = new DirectToFieldMapping();
entity_idMapping.setAttributeName("entity_id");
entity_idMapping.setNullValue(new Long(0));
entity_idMapping.setFieldName("TPC_ENTITIES.ENTITY_ID");
descriptor.addMapping(entity_idMapping);
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.readOnly();
idMapping.setFieldName("TPC_ENTITIES.ENTITY_ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping levelIdMapping = new DirectToFieldMapping();
levelIdMapping.setAttributeName("levelId");
levelIdMapping.setNullValue(new Long(0)); //changed from -1 to 0
levelIdMapping.setFieldName("TPC_ENTITIES.LEVEL_ID");
descriptor.addMapping(levelIdMapping);
DirectToFieldMapping lookupIdMapping = new DirectToFieldMapping();
lookupIdMapping.setAttributeName("lookupId");
lookupIdMapping.setNullValue(new Long(0)); //changed from -1 to 0
lookupIdMapping.setFieldName("TPC_ENTITIES.LOOKUP_ID");
descriptor.addMapping(lookupIdMapping);
DirectToFieldMapping levelDepthMapping = new DirectToFieldMapping();
levelDepthMapping.setAttributeName("levelDepth");
levelDepthMapping.setFieldName("TPC_ENTITIES.LEVEL_DEPTH");
descriptor.addMapping(levelDepthMapping);
DirectToFieldMapping entity_sequenceMapping = new DirectToFieldMapping();
entity_sequenceMapping.setAttributeName("entity_sequence");
entity_sequenceMapping.setNullValue(new Long(0));
entity_sequenceMapping.setFieldName("TPC_ENTITIES.ENTITY_SEQUENCE");
descriptor.addMapping(entity_sequenceMapping);
DirectToFieldMapping entity_typeMapping = new DirectToFieldMapping();
entity_typeMapping.setAttributeName("entity_type");
entity_typeMapping.setFieldName("TPC_ENTITIES.ENTITY_TYPE");
descriptor.addMapping(entity_typeMapping);
DirectToFieldMapping nameMapping = new DirectToFieldMapping();
nameMapping.setAttributeName("name");
nameMapping.setFieldName("TPC_ENTITIES.NAME");
descriptor.addMapping(nameMapping);
DirectToFieldMapping parent_entity_idMapping = new DirectToFieldMapping();
parent_entity_idMapping.setAttributeName("parent_entity_id");
parent_entity_idMapping.setNullValue(new Long(0)); //changed from -1 to 0
parent_entity_idMapping.setFieldName("TPC_ENTITIES.PARENT_ENTITY_ID");
descriptor.addMapping(parent_entity_idMapping);
AggregateObjectMapping auditFieldsMapping = new AggregateObjectMapping();
auditFieldsMapping.setAttributeName("auditFields");
auditFieldsMapping.setReferenceClass(com.its.tabs.architecture.dal.persistency.AuditFields.class);
auditFieldsMapping.setIsNullAllowed(false);
auditFieldsMapping.addFieldNameTranslation("TPC_ENTITIES.CREATED_BY", "createdBy->DIRECT");
auditFieldsMapping.addFieldNameTranslation("TPC_ENTITIES.MODIFIED_BY", "modifiedBy->DIRECT");
auditFieldsMapping.addFieldNameTranslation("TPC_ENTITIES.CREATED_DATE", "createdDate->DIRECT");
auditFieldsMapping.addFieldNameTranslation("TPC_ENTITIES.MODIFIED_DATE", "modifiedDate->DIRECT");
descriptor.addMapping(auditFieldsMapping);
OneToManyMapping entitesMapping = new OneToManyMapping();
entitesMapping.setAttributeName("entites");
entitesMapping.setReferenceClass(com.its.tabs.tpc.layers.dal.entity.toplink.TLEntityPCDAO.class);
entitesMapping.useTransparentCollection();
entitesMapping.useCollectionClass(org.eclipse.persistence.indirection.IndirectList.class);
entitesMapping.addTargetForeignKeyFieldName("TPC_ENTITIES.PARENT_ENTITY_ID", "TPC_ENTITIES.ENTITY_ID");
descriptor.addMapping(entitesMapping);
OneToManyMapping entityattributesMapping = new OneToManyMapping();
entityattributesMapping.setAttributeName("entityattributes");
entityattributesMapping.setReferenceClass(com.its.tabs.tpc.layers.dal.entityattributes.toplink.TLEntityAttributesDAO.class);
entityattributesMapping.useTransparentCollection();
entityattributesMapping.useCollectionClass(org.eclipse.persistence.indirection.IndirectList.class);
entityattributesMapping.addTargetForeignKeyFieldName("TPC_ENTITY_ATTRIBUTES.ENTITY_ID", "TPC_ENTITIES.ENTITY_ID");
descriptor.addMapping(entityattributesMapping);
OneToOneMapping entityLevelIdMapping = new OneToOneMapping();
entityLevelIdMapping.setAttributeName("levels");
entityLevelIdMapping.setReferenceClass(TLLevelsDAO.class);
entityLevelIdMapping.useProxyIndirection();
entityLevelIdMapping.readOnly();
entityLevelIdMapping.addForeignKeyFieldName("TPC_ENTITIES.LEVEL_ID", "TPC_LEVELS.LEVEL_ID");
descriptor.addMapping(entityLevelIdMapping);
OneToOneMapping entityLookupIdMapping = new OneToOneMapping();
entityLookupIdMapping.setAttributeName("lookups");
entityLookupIdMapping.setReferenceClass(TLLookupDAO.class);
entityLookupIdMapping.useProxyIndirection();
entityLookupIdMapping.readOnly();
entityLookupIdMapping.addForeignKeyFieldName("TPC_ENTITIES.LOOKUP_ID", "TPC_LOOKUP.LOOKUP_ID");
descriptor.addMapping(entityLookupIdMapping);
return descriptor;
}
用于读取实体的代码
List<EntityPCEntity> entityList = new ArrayList<EntityPCEntity>();
entityList = (List<EntityPCEntity>)this.getTABSEntityManagerFinder().getEclipseLinkAdapter().readMultipleDAOs(TLEntityPCDAO.class);
return entityList;
例外
14/06/17 13:03:36引起:java.lang.StackOverflowError 14/06/17 13:03:36在com.evermind.server.connector.ApplicationConnectionManager.getTransaction(ApplicationConnectionManager.java:1582) 14/06/17 13:03:36在com.evermind.server.connector.ApplicationConnectionManager.getConnectionFromShareablePool(ApplicationConnectionManager.java:1652) 14/06/17 13:03:36在com.evermind.server.connector.ApplicationConnectionManager.acquireConnectionContext(ApplicationConnectionManager.java:1497) 14/06/17 13:03:36在com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1449) 14/06/17 13:03:36 at oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.java:238) 14/06/17 13:03:36 at oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192) 14/06/17 13:03:36 at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:197) 14/06/17 13:03:36 at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:142) 14/06/17 13:03:36 at oracle.oc4j.sql.ManagedDataSource.getConnection(ManagedDataSource.java:127) 14/06/17 13:03:36在org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:126) 14/06/17 13:03:36 at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94) 14/06/17 13:03:36 org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) 14/06/17 13:03:36在org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:330) 14/06/17 13:03:36 at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:291) 14/06/17 13:03:36在org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.reconnect(DatasourceAccessor.java:565) 14/06/17 13:03:36在org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.reconnect(DatabaseAccessor.java:1434) 14/06/17 13:03:36 at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.incrementCallCount(DatasourceAccessor.java:305) 14/06/17 13:03:36在org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:570) 14/06/17 13:03:36在org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:526) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1729) 14/06/17 13:03:36 org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:566) 14/06/17 13:03:36在org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207) 14/06/17 13:03:36在org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193) 14/06/17 13:03:36在org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectOneRow(DatasourceCallQueryMechanism.java:667) 14/06/17 13:03:36 at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRowFromTable(ExpressionQueryMechanism.java:2603) 14/06/17 13:03:36在org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow(ExpressionQueryMechanism.java:2574) 14/06/17 13:03:36 org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:444) 14/06/17 13:03:36 org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1080) 14/06/17 13:03:36 org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:808) 14/06/17 13:03:36 org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040) 14/06/17 13:03:36 org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:412) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1126) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2842) 14/06/17 13:03:36 org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1521) 14/06/17 13:03:36在org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1503) 14/06/17 13:03:36 org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1463) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.AbstractSession.checkAndRefreshInvalidObject(AbstractSession.java:1024) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:960) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:628) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:565) 14/06/17 13:03:36 org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:497) 14/06/17 13:03:36 org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:456) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:723) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(ReadObjectQuery.java:766) 14/06/17 13:03:36 org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:451) 14/06/17 13:03:36 org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1080) 14/06/17 13:03:36 org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:808) 14/06/17 13:03:36 org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040) 14/06/17 13:03:36 org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:412) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1126) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2842) 14/06/17 13:03:36 org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1521) 14/06/17 13:03:36在org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1503) 14/06/17 13:03:36 org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1463) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.AbstractSession.checkAndRefreshInvalidObject(AbstractSession.java:1024) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:960) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:628) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:565) 14/06/17 13:03:36 org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:497) 14/06/17 13:03:36 org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:456) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:723) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(ReadObjectQuery.java:766) 14/06/17 13:03:36 org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:451) 14/06/17 13:03:36 org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1080) 14/06/17 13:03:36 org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:808) 14/06/17 13:03:36 org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040) 14/06/17 13:03:36 org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:412) 14/06/17 13:03:36 at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1126) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2842) 14/06/17 13:03:36 org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1521) 14/06/17 13:03:36在org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1503) 14/06/17 13:03:36 org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1463) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.AbstractSession.checkAndRefreshInvalidObject(AbstractSession.java:1024) 14/06/17 13:03:36 at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:960) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:628) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:565) 14/06/17 13:03:36在org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:497)
答案 0 :(得分:1)
如果您查看失效政策:
TimeToLiveCacheInvalidationPolicy policy = new TimeToLiveCacheInvalidationPolicy(1);
policy.setShouldUpdateReadTimeOnUpdate(false);
descriptor.setCacheInvalidationPolicy(policy);
你已经将它设置为在毫秒内失效,可能在它甚至可以完成读入之前。虽然我看不到更多关于你的对象模型或正在执行的查询,但这很可能是你的问题的一个非常大的贡献者,因为它意味着对这个对象的任何引用几乎总是无效并被迫再次查询它。