You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Mark Struberg (Created) (JIRA)" <ji...@apache.org> on 2012/02/22 13:33:48 UTC

[jira] [Created] (OPENJPA-2139) uknown entities if the database cannot be accessed on initialisation

uknown entities if the database cannot be accessed on initialisation
--------------------------------------------------------------------

                 Key: OPENJPA-2139
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.2.0
            Reporter: Mark Struberg
            Assignee: Mark Struberg
            Priority: Critical
             Fix For: 2.3.0


The following scenario:

1.) turn off the database
2.) perform a query against the database
3.) turn on the database
4.) try to re-run the query from 2.)

In 4.) you will get the following Exception:

openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []

Basically the whole app is stale afterwards!

Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by Rick Curtis <cu...@gmail.com>.
Yes! My first patch attached to this JIRA *should* address this problem,
but ultimately might fail in the same manner in a different part of our
code.

On Mon, Feb 27, 2012 at 12:03 PM, Albert Lee <al...@gmail.com> wrote:

> I think this is what you are looking for:
>
> [2/23/12 5:12:04:214 GMT+08:00]     FFDC
> Exception:com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException
>
> SourceId:com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper
> ProbeId:199 Reporter:com.ibm.ejs.j2c.FreePool@2a062a06
> com.ibm.ws.exception.WsException: DSRA8100E: Unable to get a
> PooledConnection from the DataSource. with SQL State : 08001 SQL Code :
> -4499
>    at
>
> com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.setLinkedException(DataStoreAdapterException.java:530)
>    at com.ibm.ws.rsadapter.AdapterUtil.mapException(AdapterUtil.java:2152)
>    at
>
> com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:2312)
>    at
>
> com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:1598)
>    at
>
> com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:2034)
>    at
> com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1711)
>    at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:2496)
>    at
>
> com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:1061)
>    at
>
> com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:698)
>    at
>
> com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:668)
>    at
>
> com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:635)
>    at
>
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:106)
>    at
>
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
>    at
>
> org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
>    at
>
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:562)
>    at
>
> org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1344)
>    at
>
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
>    at
>
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
>    at
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
>    at
>
> org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
>    at
> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
>    at
>
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
>    at
>
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:854)
>    at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:234)
>    at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:217)
>    at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:134)
>    at
>
> org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:59)
>    at
>
> com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1498)
>
> Albert
>
> On Mon, Feb 27, 2012 at 10:24 AM, Rick Curtis <cu...@gmail.com> wrote:
>
> > I was referring to the exception that resulted in this message :
> > "openjpa.Runtime: Warn: An error occurred while registering a
> > ClassTransformer with..... "
> >
> > On Mon, Feb 27, 2012 at 9:24 AM, Albert Lee <al...@gmail.com> wrote:
> >
> > > Exception data: <openjpa-1.2.3-SNAPSHOT-r422266:1053401 nonfatal user
> > > error> org.apache.openjpa.persistence.ArgumentException: An error
> > occurred
> > > while parsing the query filter "SELECT b from AuditLogon b WHERE
> > > b.sessionId = :sessionId". Error message: The name "AuditLogon" is not
> a
> > > recognized entity or identifier. Known entity names: []
> > >         at
> > >
> > >
> >
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
> > >        at
> > > org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:156)
> > >        at
> > > org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
> > >        at
> > >
> > >
> >
> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
> > >        at
> > >
> >
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
> > >        at
> org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:574)
> > >  ....
> > >
> > >
> > > On Mon, Feb 27, 2012 at 8:14 AM, Rick Curtis (Commented) (JIRA) <
> > > jira@apache.org> wrote:
> > >
> > > >
> > > >    [
> > > >
> > >
> >
> https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217198#comment-13217198
> > > ]
> > > >
> > > > Rick Curtis commented on OPENJPA-2139:
> > > > --------------------------------------
> > > >
> > > > Albert -
> > > >
> > > > In the case that you mentioned, do you know what/where the exception
> is
> > > > that we encounter?
> > > >
> > > > > OpenJPA fails to recover from a broken database on startup
> > > > > ----------------------------------------------------------
> > > > >
> > > > >                 Key: OPENJPA-2139
> > > > >                 URL:
> > > https://issues.apache.org/jira/browse/OPENJPA-2139
> > > > >             Project: OpenJPA
> > > > >          Issue Type: Bug
> > > > >    Affects Versions: 2.2.0
> > > > >            Reporter: Mark Struberg
> > > > >            Assignee: Mark Struberg
> > > > >            Priority: Critical
> > > > >             Fix For: 2.3.0
> > > > >
> > > > >         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
> > > > >
> > > > >
> > > > > The following scenario:
> > > > > 1.) turn off the database
> > > > > 2.) perform a query against the database
> > > > > 3.) turn on the database
> > > > > 4.) try to re-run the query from 2.)
> > > > > In 4.) you will get the following Exception:
> > > > > openjpa-2.2.0-r422266:1244990 nonfatal user error>
> > > > org.apache.openjpa.persistence.ArgumentException: An error occurred
> > while
> > > > parsing the query filter "SELECT k FROM DbEnumKey AS k where
> > k.type=:typ
> > > > ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a
> > > > recognized entity or identifier. Known entity names: []
> > > > > Basically the whole app is stale afterwards!
> > > > > Solution: caching the entities might only be done if a connection
> can
> > > be
> > > > established.
> > > >
> > > > --
> > > > This message is automatically generated by JIRA.
> > > > If you think it was sent incorrectly, please contact your JIRA
> > > > administrators:
> > > >
> > https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> > > > For more information on JIRA, see:
> > > http://www.atlassian.com/software/jira
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Albert Lee.
> > >
> >
> >
> >
> > --
> > *Rick Curtis*
> >
>
>
>
> --
> Albert Lee.
>



-- 
*Rick Curtis*

Re: [jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by Albert Lee <al...@gmail.com>.
I think this is what you are looking for:

[2/23/12 5:12:04:214 GMT+08:00]     FFDC
Exception:com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException
SourceId:com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper
ProbeId:199 Reporter:com.ibm.ejs.j2c.FreePool@2a062a06
com.ibm.ws.exception.WsException: DSRA8100E: Unable to get a
PooledConnection from the DataSource. with SQL State : 08001 SQL Code :
-4499
    at
com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.setLinkedException(DataStoreAdapterException.java:530)
    at com.ibm.ws.rsadapter.AdapterUtil.mapException(AdapterUtil.java:2152)
    at
com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:2312)
    at
com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:1598)
    at
com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:2034)
    at
com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1711)
    at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:2496)
    at
com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:1061)
    at
com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:698)
    at
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:668)
    at
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:635)
    at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:106)
    at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
    at
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
    at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:562)
    at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1344)
    at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
    at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
    at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
    at
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
    at
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
    at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
    at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:854)
    at
org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:234)
    at
org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:217)
    at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:134)
    at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:59)
    at
com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1498)

Albert

On Mon, Feb 27, 2012 at 10:24 AM, Rick Curtis <cu...@gmail.com> wrote:

> I was referring to the exception that resulted in this message :
> "openjpa.Runtime: Warn: An error occurred while registering a
> ClassTransformer with..... "
>
> On Mon, Feb 27, 2012 at 9:24 AM, Albert Lee <al...@gmail.com> wrote:
>
> > Exception data: <openjpa-1.2.3-SNAPSHOT-r422266:1053401 nonfatal user
> > error> org.apache.openjpa.persistence.ArgumentException: An error
> occurred
> > while parsing the query filter "SELECT b from AuditLogon b WHERE
> > b.sessionId = :sessionId". Error message: The name "AuditLogon" is not a
> > recognized entity or identifier. Known entity names: []
> >         at
> >
> >
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
> >        at
> >
> >
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
> >        at
> > org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
> >        at
> >
> >
> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:156)
> >        at
> > org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
> >        at
> >
> >
> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
> >        at
> >
> >
> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
> >        at
> >
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
> >        at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:574)
> >  ....
> >
> >
> > On Mon, Feb 27, 2012 at 8:14 AM, Rick Curtis (Commented) (JIRA) <
> > jira@apache.org> wrote:
> >
> > >
> > >    [
> > >
> >
> https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217198#comment-13217198
> > ]
> > >
> > > Rick Curtis commented on OPENJPA-2139:
> > > --------------------------------------
> > >
> > > Albert -
> > >
> > > In the case that you mentioned, do you know what/where the exception is
> > > that we encounter?
> > >
> > > > OpenJPA fails to recover from a broken database on startup
> > > > ----------------------------------------------------------
> > > >
> > > >                 Key: OPENJPA-2139
> > > >                 URL:
> > https://issues.apache.org/jira/browse/OPENJPA-2139
> > > >             Project: OpenJPA
> > > >          Issue Type: Bug
> > > >    Affects Versions: 2.2.0
> > > >            Reporter: Mark Struberg
> > > >            Assignee: Mark Struberg
> > > >            Priority: Critical
> > > >             Fix For: 2.3.0
> > > >
> > > >         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
> > > >
> > > >
> > > > The following scenario:
> > > > 1.) turn off the database
> > > > 2.) perform a query against the database
> > > > 3.) turn on the database
> > > > 4.) try to re-run the query from 2.)
> > > > In 4.) you will get the following Exception:
> > > > openjpa-2.2.0-r422266:1244990 nonfatal user error>
> > > org.apache.openjpa.persistence.ArgumentException: An error occurred
> while
> > > parsing the query filter "SELECT k FROM DbEnumKey AS k where
> k.type=:typ
> > > ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a
> > > recognized entity or identifier. Known entity names: []
> > > > Basically the whole app is stale afterwards!
> > > > Solution: caching the entities might only be done if a connection can
> > be
> > > established.
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > If you think it was sent incorrectly, please contact your JIRA
> > > administrators:
> > >
> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> > > For more information on JIRA, see:
> > http://www.atlassian.com/software/jira
> > >
> > >
> > >
> >
> >
> > --
> > Albert Lee.
> >
>
>
>
> --
> *Rick Curtis*
>



-- 
Albert Lee.

Re: [jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by Rick Curtis <cu...@gmail.com>.
I was referring to the exception that resulted in this message :
"openjpa.Runtime: Warn: An error occurred while registering a
ClassTransformer with..... "

On Mon, Feb 27, 2012 at 9:24 AM, Albert Lee <al...@gmail.com> wrote:

> Exception data: <openjpa-1.2.3-SNAPSHOT-r422266:1053401 nonfatal user
> error> org.apache.openjpa.persistence.ArgumentException: An error occurred
> while parsing the query filter "SELECT b from AuditLogon b WHERE
> b.sessionId = :sessionId". Error message: The name "AuditLogon" is not a
> recognized entity or identifier. Known entity names: []
>         at
>
> org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
>        at
>
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
>        at
> org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
>        at
>
> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:156)
>        at
> org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
>        at
>
> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
>        at
>
> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
>        at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
>        at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:574)
>  ....
>
>
> On Mon, Feb 27, 2012 at 8:14 AM, Rick Curtis (Commented) (JIRA) <
> jira@apache.org> wrote:
>
> >
> >    [
> >
> https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217198#comment-13217198
> ]
> >
> > Rick Curtis commented on OPENJPA-2139:
> > --------------------------------------
> >
> > Albert -
> >
> > In the case that you mentioned, do you know what/where the exception is
> > that we encounter?
> >
> > > OpenJPA fails to recover from a broken database on startup
> > > ----------------------------------------------------------
> > >
> > >                 Key: OPENJPA-2139
> > >                 URL:
> https://issues.apache.org/jira/browse/OPENJPA-2139
> > >             Project: OpenJPA
> > >          Issue Type: Bug
> > >    Affects Versions: 2.2.0
> > >            Reporter: Mark Struberg
> > >            Assignee: Mark Struberg
> > >            Priority: Critical
> > >             Fix For: 2.3.0
> > >
> > >         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
> > >
> > >
> > > The following scenario:
> > > 1.) turn off the database
> > > 2.) perform a query against the database
> > > 3.) turn on the database
> > > 4.) try to re-run the query from 2.)
> > > In 4.) you will get the following Exception:
> > > openjpa-2.2.0-r422266:1244990 nonfatal user error>
> > org.apache.openjpa.persistence.ArgumentException: An error occurred while
> > parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ
> > ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a
> > recognized entity or identifier. Known entity names: []
> > > Basically the whole app is stale afterwards!
> > > Solution: caching the entities might only be done if a connection can
> be
> > established.
> >
> > --
> > This message is automatically generated by JIRA.
> > If you think it was sent incorrectly, please contact your JIRA
> > administrators:
> > https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> > For more information on JIRA, see:
> http://www.atlassian.com/software/jira
> >
> >
> >
>
>
> --
> Albert Lee.
>



-- 
*Rick Curtis*

Re: [jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by Albert Lee <al...@gmail.com>.
Exception data: <openjpa-1.2.3-SNAPSHOT-r422266:1053401 nonfatal user
error> org.apache.openjpa.persistence.ArgumentException: An error occurred
while parsing the query filter "SELECT b from AuditLogon b WHERE
b.sessionId = :sessionId". Error message: The name "AuditLogon" is not a
recognized entity or identifier. Known entity names: []
        at
org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:180)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:150)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:225)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:195)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:188)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$600(JPQLExpressionBuilder.java:69)
        at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1756)
        at
org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:56)
        at
org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:156)
        at
org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:658)
        at
org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:639)
        at
org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:605)
        at
org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:667)
        at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:574)
  ....


On Mon, Feb 27, 2012 at 8:14 AM, Rick Curtis (Commented) (JIRA) <
jira@apache.org> wrote:

>
>    [
> https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217198#comment-13217198]
>
> Rick Curtis commented on OPENJPA-2139:
> --------------------------------------
>
> Albert -
>
> In the case that you mentioned, do you know what/where the exception is
> that we encounter?
>
> > OpenJPA fails to recover from a broken database on startup
> > ----------------------------------------------------------
> >
> >                 Key: OPENJPA-2139
> >                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
> >             Project: OpenJPA
> >          Issue Type: Bug
> >    Affects Versions: 2.2.0
> >            Reporter: Mark Struberg
> >            Assignee: Mark Struberg
> >            Priority: Critical
> >             Fix For: 2.3.0
> >
> >         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
> >
> >
> > The following scenario:
> > 1.) turn off the database
> > 2.) perform a query against the database
> > 3.) turn on the database
> > 4.) try to re-run the query from 2.)
> > In 4.) you will get the following Exception:
> > openjpa-2.2.0-r422266:1244990 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: An error occurred while
> parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ
> ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a
> recognized entity or identifier. Known entity names: []
> > Basically the whole app is stale afterwards!
> > Solution: caching the entities might only be done if a connection can be
> established.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators:
> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>


-- 
Albert Lee.

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13279744#comment-13279744 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

I tried to apply the patch manually, but it just doesn't fit. Against which branch did you do the changes? Please note that I did a quick commit removing some unused imports and fix a few JavaDocs on the MappingDefaultsImpl. But the patch also didn't apply before.
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x-v2.patch, OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13214840#comment-13214840 ] 

Rick Curtis commented on OPENJPA-2139:
--------------------------------------

Mark -- I was afraid that the patch might fail in a different area. Can you post a stack from when we try to create the first EM? I assume that we get an exception from some other method that AbstractBrokerFactory.makeReadOnly() calls.
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13249782#comment-13249782 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

I've now committed a fix for the original issue. We now reset the _readOnly flag if we hit an Exception during initialisation. That way we will try again until the db is up again.

This will _not_ yet fix the problem with dynamic enhancement! But since runtime enhancement is mostly considered problematic anyway atm, it will be good enough for most users.
Shouldn't we create an own Jira issue for the dynamic enhancement issue?
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13279740#comment-13279740 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

PS: your IDE seems to add TABS! Please switch your editor to SPACES ONLY.

It is generally a good idea to switch your IDE to 'show whitespaces' for all Apache projects. Otherwise we will end up with a completely messed tabs/spaces mixture.
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x-v2.patch, OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Heath Thomann (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heath Thomann updated OPENJPA-2139:
-----------------------------------

    Attachment: OPENJPA-2139-1.2.x.patch

Will provide detailed comments about this patch shortly.

Thanks,

Heath
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13418197#comment-13418197 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

Heath, any update on this? 
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x-v2.patch, OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Work stopped] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Work stopped) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on OPENJPA-2139 stopped by Mark Struberg.

> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13214799#comment-13214799 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

I'm not sure what I did different to yesterdays run, but the patch doesn't seem to solve the problem in all situations.

If I start my webapp with an offline database and wait until the request dies down completely. Then I start the db and issue a 2nd request -> here I get the original error indicating that my aliases are empty.

Rick, I fear I forgot to 'undeploy' my own fix prior to testing your patch yesterday :(
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213572#comment-13213572 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

additional info: all recovers fine if the database once got successfully accessed 1 time and _then_ the db dies and will be restarted.
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Albert Lee (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216773#comment-13216773 ] 

Albert Lee commented on OPENJPA-2139:
-------------------------------------

There is another twisted use case in the JEE environment.

In the app server container, when the emf is created, it will try to create a transformer attaching to the pu. If the data source connection is still not available, OJ will throw

    openjpa.Runtime: Warn: An error occurred while registering a ClassTransformer with.....

and any entity loaded by this associated application classloader will NOT enhanced the entity. Eventually, this will yield the same ArgumentException.

Albert Lee
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg updated OPENJPA-2139:
-----------------------------------

    Summary: OpenJPA fails to recover from a broken database on startup  (was: uknown entities if the database cannot be accessed on initialisation)
    
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213960#comment-13213960 ] 

Rick Curtis commented on OPENJPA-2139:
--------------------------------------

Background details : The runtime isn't able to determine which type of DB we're running against based off any of the connection properties so we need to make a connection to figure it out.

The root problem is that when creating the first EM, in AbstractBrokerFactory we have this[1] block of code that gets a MDR instance, and the configures it as a class listener. As part of configuring the MDR, we get a reference to the DBDictionary[2]. While instantiating the dictionary, we need to connect to the DB to figure out which type to create. Instantiation of the dictionary results in an exception, which blows out of the AbstractBrokerFactory.makeReadOnly() method. Thus we never register the MDR as a register class listener, and thus the MDR never gets populated with metadata..

To work around the problem, I modified the MDR so that we only will instantiate a DBDictionary when we actually use it. Mark tested this patch in his environment and it seemed to work fine.

[1] 
            MetaDataRepository repos = _conf.getMetaDataRepositoryInstance();
            repos.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            repos.setResolve(MetaDataModes.MODE_MAPPING_INIT, true);
            PCRegistry.addRegisterClassListener(repos);

[2] MappingRepository.endConfiguration()
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Heath Thomann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heath Thomann updated OPENJPA-2139:
-----------------------------------

    Attachment: OPENJPA-2139-1.2.x-v2.patch

Providing a second version of my previous patch.  We've taken a slightly different approach in this version of the fix in that we will no longer eat an SQLException caused in 'JDBCConfigurationImpl.getDBDictionaryInstance'.  Rather a similar pattern was followed in MappingDefaultsImpl as was done in MappingRepository (i.e. delay getting a reference to DBDictionary).
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x-v2.patch, OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216777#comment-13216777 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

That might be the case. In my scenario I'm working with compile time enhancement.
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258830#comment-13258830 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

Hi Heath!

Txs for doing a review and provide additional work. I just came back from a conference and hope I can test your patch early next week. Just looked at your patch quickly but need to take more time to grok the details.

Just to be sure that we aim into the same direction:

a.) aborting the app in case a DB is not available is NOT an option. It is a standard case in big apps that the db is not always available. E.g on cluster failover (cold standby) the app needs to continue after the db is back up again.

b.) there are quite a few different scenarios we need to take care
  1.) build-time enhancement
  2.) runtime enhancement
  3.) subclassing enhancement
  4.) configuration via PersistenceUnitInfo vs persistence.xml
   etc. Please add other testing scenarios where this could have an impact. In our app we use build-time enhancement.

c.) I'm not sure if connecting-for-dictionary-failed is practicable. It's imo not if you have to deal with multiple databases depending on the installation.

d.) we must be careful to not introduce a chicken-egg problem ;)

                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg updated OPENJPA-2139:
-----------------------------------

    Attachment: OPENJPA-2139.patch

please review this patch!

I found that I need to wait a bit (50ms) because going down to the connector would just trash them again. This is for sure not a perfect solution, if you have a better idea then please speak up!
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Work started] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (Work started) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on OPENJPA-2139 started by Mark Struberg.

> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Heath Thomann (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13238926#comment-13238926 ] 

Heath Thomann commented on OPENJPA-2139:
----------------------------------------

Hey Rick!  Let me try to answer the question you posed previously in response to Albert's comments.  If you look at PersistenceProviderImpl.createContainerEntityManagerFactory you can see we have this code:

            try {
                pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
                    pui.getNewTempClassLoader(), newConfigurationImpl()));
            } catch (Exception e) {
                // fail gracefully
                transformerException = e;
            }

Within the 'addTransformer' call, we are doing a bunch of stuff which includes instantiating a 'ClassTransformerImpl' (CTI).  You'll have to take a leap of faith a bit and trust me when I say that as part of instantiating the CTI, a call is eventually made to 'DBDictionaryFactory.newDBDictionary'.  Within 'newDBDictionary', a connection to the DB is made.  If an exception is thrown when making the connection (e.g. DB is down), the exception flows all the way back to the try/catch in the above code block.  That means we never add a transformer......so later at runtime we'd see the ArgumentException given the lack of transformer/enhancement registration.  Furthermore, as you can see in the catch block we attempt to "fail gracefully" which means to me in what I see in my env that there isn't much indication of the fact that we didn't register a transformer.  So the patch you added previously doesn't work in this case because it does nothing to handle the case where we go down the 'createContainerEntityManagerFactory' path.  I'm working on a patch which will "eat" any connection errors at the point 'DBDictionaryFactory.newDBDictionary' is called (i.e. JDBCConfiguratoinImple.getDBDictionaryInstance)....the code will be gated by a system property of course.

IMHO, it seems OpenJPA needs to take a long hard look at these DB up/down scenarios.  In what little testing has been down via this JIRA, we've unearthed a few areas needing to be changed.  What other issues could be lurking as further testing is done?  That is, could we be opening a can of worms by fixing this limited scenario given OpenJPA doens't appear to do much/any testing in this area (one could think of a million DB up/down scenarios and timing windows)?  Anyway, I'm always the pessimist.......  :-)

Thanks,

Heath Thomann
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13279741#comment-13279741 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

another note: 
    public DBDictionary getDBDictionary() {
        if (dict == null) {
            dict = ((JDBCConfiguration) conf).getDBDictionaryInstance();
        }...

do we need some synchronisation or DCL here? I've not yet checked if this could happen concurrently. Anyone knows this?


                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x-v2.patch, OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Rick Curtis (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis updated OPENJPA-2139:
---------------------------------

    Attachment: OPENJPA-2139.mdr.patch

Attaching a patch that fixes the root issue.
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13279739#comment-13279739 ] 

Mark Struberg commented on OPENJPA-2139:
----------------------------------------

Hi Heath, did you apply the patch already? I'm now finally back on working on this stuff again. Any updates?
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x-v2.patch, OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217198#comment-13217198 ] 

Rick Curtis commented on OPENJPA-2139:
--------------------------------------

Albert -

In the case that you mentioned, do you know what/where the exception is that we encounter?
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Heath Thomann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262675#comment-13262675 ] 

Heath Thomann commented on OPENJPA-2139:
----------------------------------------

Hi Mark!  Just wanted to add a quick update here.  Rick reviewed my patch and yours (your committed changes to trunk that is).  He feels that your fix/commit is definitely necessary in addition to a *portion* of the last patch I submitted.  The changes to MappingRepository in my previous patch are necessary.  However, he raised a very valid point that my eating of an exception in 'JDBCConfigurationImpl.getDBDictionaryInstance' would allow a null DB instance to be returned where an exception used to be returned.......there are a lot of callers to JDBCConfigurationImpl.getDBDictionaryInstance throughout OpenJPA code and as such we can't be sure each caller accounts for a null DB instance to be returned.  However, when I test with your commit plus the changes to MappingRepository, it still does not allow us to register a transformer because as part of the registration, we go down the path to JDBCConfigurationImpl.getDBDictionaryInstance which yields an exception when the DB is down, thus cause the registration to not occur.  We have some ideas on a modified fix which will consist of following a similar pattern in MappingDefaultsImpl as was done in MappingRepository (i.e. delay getting a reference to DBDictionary).  I will work on a fix today and hopefully have an updated patch later today (the patch will include your changes).
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup

Posted by "Heath Thomann (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13258402#comment-13258402 ] 

Heath Thomann commented on OPENJPA-2139:
----------------------------------------

Hello Mark!  I worked with Albert and Rick on this issue and we came up with a slightly different change than yours but I think it is effectively the same idea.  Please review the patch I just uploaded, it is named 'OPENJPA-2139-1.2.x.patch'.  First, I used the OPENJPA-2139.mdr.patch which Rick provided a while back.  This did not fix some of the issues Albert and I described in latter posts to this JIRA (i.e. registration of a transformer).  So our approach was to catch, and eat, the exception at the point we actually attempt to connect to the DB (as well as log a warning message)......specifically JDBCConfigurationImpl.getDBDictionaryInstance.  We took the approach that there is no need to allow a connection/SQLException to percolate up the call chain.....we figured it best to catch the exception, eat it, and warn the user of the connection issue.  In this way, and with Rick's previous patch, an attempt to connect to the DB can be made at a later time (when hopefully the DB is back up).  I noticed that you changed AbstractBrokerFactory.makeReadOnly.......this method eventually causes (indirectly) JDBCConfigurationImpl.getDBDictionaryInstance to be called....when the DB is down getDBDictionaryInstance will cause an exception to be thrown.  It appears the 'catch' block you added to AbstractBrokerFactory.makeReadOnly will catch and re-throw this exception as well as reset some state.  With my fix, you will no longer receive an exception in some cases (i.e. for the DB connection case where we catch/eat the exception).  I would like you to try my patch in your testing environment to see if it fixes your issue.  At the very least I'd like you to describe your scenario so we can understand why you made the changes you made.  Our fix has been test in a JEE environment whereas I believe you are in a JSE env, right?  I've tested a few scenarios in my JEE server where I've cycled the DB at various times and our fix handles these cases as we'd expect.  Furthermore, our fix has been tested by an internal group (who uses our JEE server) which is performing some very rigorous DB fail over scenarios and our change fixes their issues.  So, I think our fix is necessary, but the remaining question is whether or not your fix is needed in addition to ours.  

Thanks,

Heath
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139-1.2.x.patch, OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier. Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira