That will also fix the original error - that the list of mapped classes is
empty? Copy of the error again:

Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: An error occurred while
parsing the query filter "SELECT a FROM Account a". Error message: The name
"Account" is not a recognized entity or identifier. Known entity names: []




On 2 July 2013 12:31, Romain Manni-Bucau <[email protected]> wrote:

> just add in your persistence unit the needed property (sample for
> mysql: <property
> name="openjpa.jdbc.DBDictionary" value="mysql"/> )
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/7/2 James Green <[email protected]>
>
> > The documentation link you supplied: I'm not sure what I am looking for
> in
> > it. That's what I meant to say.
> >
> > To cut this down is there a demonstration project where this is already
> > correctly configured? May be simpler than explaining the changes to me :)
> >
> >
> > On 2 July 2013 12:14, Romain Manni-Bucau <[email protected]> wrote:
> >
> > > didnt get the first sentence
> > >
> > > about the "make it worse" it is what i explained in my previous answer:
> > if
> > > you start without a db and openjpa uses automatically the wrong
> > dictionnary
> > > then even if the db is back and the pool well configured, the jpa layer
> > > will generate wrong SQL so it will not work, so your app is broken
> > whatever
> > > the db state is.
> > >
> > > *Romain Manni-Bucau*
> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > http://rmannibucau.wordpress.com/>
> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > *Github: https://github.com/rmannibucau*
> > >
> > >
> > >
> > > 2013/7/2 James Green <[email protected]>
> > >
> > > > Am I looking for something letting me list the classes I want mapped?
> > The
> > > > error I see shows an empty list, hence this particular question.
> > > >
> > > > You say it doesn't solve our issue and can actually make it worse?
> Care
> > > to
> > > > elaborate?
> > > >
> > > >
> > > > On 2 July 2013 09:17, Romain Manni-Bucau <[email protected]>
> > wrote:
> > > >
> > > > > the dict doc is here
> > > > >
> > > > >
> > > >
> > >
> >
> http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/ref_guide_dbsetup_dbsupport.html
> > > > >
> > > > > it is important to set it if the database can be down at startup
> > > > otherwise
> > > > > you can end up with a wrong dict (generally the generic one) and
> then
> > > > when
> > > > > the database is up again SQL stuff will not work
> > > > >
> > > > > it doesn't solve your issue but it can make it worse
> > > > >
> > > > > *Romain Manni-Bucau*
> > > > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > > > http://rmannibucau.wordpress.com/>
> > > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > > > *Github: https://github.com/rmannibucau*
> > > > >
> > > > >
> > > > >
> > > > > 2013/7/2 James Green <[email protected]>
> > > > >
> > > > > > That's exactly what I want. All I have are EJBs with entity
> > managers
> > > > > > injected via @PersistenceContext (exactly as we are taught in the
> > > > > > "Beginning Java EE 6 Platform with Glassfish 3" book which is how
> > > this
> > > > > > application began life.
> > > > > >
> > > > > > So what's the difference I wonder? Romain talks about adding a
> > > > dictionary
> > > > > > but I didn't spot anything spectacularly obvious in a browse of
> the
> > > > > OpenJPA
> > > > > > user guide yesterday (indeed on the subject of injection it told
> me
> > > to
> > > > > > refer to my application server documentation...).
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 1 July 2013 18:05, José Luis Cetina <[email protected]>
> > wrote:
> > > > > >
> > > > > > > I did this test:
> > > > > > >
> > > > > > > 1. Stop TomEE
> > > > > > > 2. Shutdown my database server
> > > > > > > 3. Start TomEE
> > > > > > > 4. Try to access to my app, i could access but when i hit my
> > login
> > > > > button
> > > > > > > for example then i get this error:
> > > > > > >
> > > com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
> > > > > > > Could not create connection to database server. Attempted
> > > reconnect 3
> > > > > > > times. Giving up.
> > > > > > > 5. Start up my database server
> > > > > > > 6. Wait for my database to be ready, i refresh the page then
> hit
> > > > again
> > > > > at
> > > > > > > the login button, then my app run without problem (in this
> point
> > i
> > > > DONT
> > > > > > > stop/start TomEE again).
> > > > > > >
> > > > > > > Is this the behavior that you need/want it??
> > > > > > >
> > > > > > >
> > > > > > > *Remeber that i have tomee and database in separate server's
> > > > > > >
> > > > > > >
> > > > > > > 2013/7/1 Howard W. Smith, Jr. <[email protected]>
> > > > > > >
> > > > > > > > Will you be trying the magic that Romain recommended?
> > > > > > > >  On Jul 1, 2013 10:34 AM, "James Green" <
> > > [email protected]>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > I was asking about cold boot, specifically. It is when the
> > > > > > application
> > > > > > > > > server begins that the JPA implementation performs the
> Entity
> > > > > > mapping,
> > > > > > > so
> > > > > > > > > if the database is not available presumably it remains dead
> > > until
> > > > > the
> > > > > > > > > application server itself is restarted?
> > > > > > > > >
> > > > > > > > > Unless you already have the magic installed that Romain
> > refers
> > > > to.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On 1 July 2013 15:24, José Luis Cetina <
> [email protected]
> > >
> > > > > wrote:
> > > > > > > > >
> > > > > > > > > > My entire app use database and of course the app doesnt
> > work
> > > if
> > > > > the
> > > > > > > > > > database is unavailable, but when the database server is
> > > > > available
> > > > > > > > again
> > > > > > > > > > the webapp can use the database again without restarting
> > > TomEE.
> > > > > > > > > >
> > > > > > > > > > I dont know if i response your question.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2013/7/1 James Green <[email protected]>
> > > > > > > > > >
> > > > > > > > > > > Are you saying your application starts from cold
> without
> > > the
> > > > > > > > database,
> > > > > > > > > > the
> > > > > > > > > > > operates fine without intervention once the database
> > > becomes
> > > > > > > > available?
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On 1 July 2013 14:26, José Luis Cetina <
> > > [email protected]
> > > > >
> > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > I have also differents server, 1 one database and 2
> for
> > > > TomEE
> > > > > > > > (using
> > > > > > > > > > > > memcached + cluster) and with autoReconnect=true i
> dont
> > > > have
> > > > > > any
> > > > > > > > > issue
> > > > > > > > > > > when
> > > > > > > > > > > > the database server reboot, i set this attribute
> > > > > > (autoReconnect)
> > > > > > > > > after
> > > > > > > > > > i
> > > > > > > > > > > > experiment your same problems, when the database
> server
> > > > > > rebooted
> > > > > > > my
> > > > > > > > > > apps
> > > > > > > > > > > > cant connect anymore to the database server, i had to
> > > stop
> > > > > and
> > > > > > > > start
> > > > > > > > > > > tomee
> > > > > > > > > > > > again for work. But then, i add that option and now i
> > > work
> > > > > with
> > > > > > > any
> > > > > > > > > > > > problem.
> > > > > > > > > > > >
> > > > > > > > > > > > Here is a example of my Resource:
> > > > > > > > > > > >
> > > > > > > > > > > > <Resource id="ANY_NAME" type="DataSource">
> > > > > > > > > > > >   JdbcDriver com.mysql.jdbc.Driver
> > > > > > > > > > > >   JdbcUrl
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> jdbc:mysql://any_ip:3306/any_database?zeroDateTimeBehavior=convertToNull&amp;rewriteBatchedStatements=true&amp;autoReconnect=true
> > > > > > > > > > > >   UserName any_user
> > > > > > > > > > > >   Password any_password
> > > > > > > > > > > >   JtaManaged true
> > > > > > > > > > > >   InitialSize=3
> > > > > > > > > > > >   MaxActive=100
> > > > > > > > > > > >   ValidationQuery=SELECT 1
> > > > > > > > > > > >   TestOnBorrow=true
> > > > > > > > > > > > </Resource>
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > 2013/7/1 James Green <[email protected]>
> > > > > > > > > > > >
> > > > > > > > > > > > > This now sounds substantially more complex than my
> > > design
> > > > > > > (which
> > > > > > > > > uses
> > > > > > > > > > > > > @PersistenceContext(unitName="accounts")) caters
> for.
> > > Is
> > > > > > there
> > > > > > > an
> > > > > > > > > > > example
> > > > > > > > > > > > > of what you mean somewhere so I can scope the work
> > out?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Thanks
> > > > > > > > > > > > > James
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On 1 July 2013 12:44, Romain Manni-Bucau <
> > > > > > > [email protected]>
> > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > it depends your config and that's probably more
> an
> > > > > openjpa
> > > > > > > > > question
> > > > > > > > > > > but
> > > > > > > > > > > > > > basically you'll need to provide the dictionnary
> to
> > > use
> > > > > > since
> > > > > > > > > > openjpa
> > > > > > > > > > > > > will
> > > > > > > > > > > > > > not be able to read database metadata (at least).
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > *Romain Manni-Bucau*
> > > > > > > > > > > > > > *Twitter: @rmannibucau <
> > > > https://twitter.com/rmannibucau
> > > > > >*
> > > > > > > > > > > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > > > > > > > > > > > > http://rmannibucau.wordpress.com/>
> > > > > > > > > > > > > > *LinkedIn: **
> > http://fr.linkedin.com/in/rmannibucau*
> > > > > > > > > > > > > > *Github: https://github.com/rmannibucau*
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 2013/7/1 James Green <[email protected]>
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I've suppressed the RuntimeExceptions
> encountered
> > > as
> > > > > EJBs
> > > > > > > > fire
> > > > > > > > > > and
> > > > > > > > > > > > > access
> > > > > > > > > > > > > > > JPA, however I have a new problem now:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Caused by: <openjpa-2.2.0-r422266:1244990
> > nonfatal
> > > > user
> > > > > > > > error>
> > > > > > > > > > > > > > >
> org.apache.openjpa.persistence.ArgumentException:
> > > An
> > > > > > error
> > > > > > > > > > occurred
> > > > > > > > > > > > > while
> > > > > > > > > > > > > > > parsing the query filter "SELECT a FROM Account
> > a".
> > > > > Error
> > > > > > > > > > message:
> > > > > > > > > > > > The
> > > > > > > > > > > > > > name
> > > > > > > > > > > > > > > "Account" is not a recognized entity or
> > identifier.
> > > > > Known
> > > > > > > > > entity
> > > > > > > > > > > > names:
> > > > > > > > > > > > > > []
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > It seems the JPA component was unable to map my
> > > > @Entity
> > > > > > > > classes
> > > > > > > > > > > > because
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > connection did not exist at startup. What do I
> > need
> > > > to
> > > > > do
> > > > > > > to
> > > > > > > > > work
> > > > > > > > > > > > > around
> > > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On 1 July 2013 12:07, Romain Manni-Bucau <
> > > > > > > > > [email protected]>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > yep
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > basically get injected the timerservice (
> > > > > > > > > > > > > > > >
> > > > > > > > > >
> > > > http://docs.oracle.com/javaee/6/api/javax/ejb/TimerService.html
> > > > > > > > > > > ),
> > > > > > > > > > > > in
> > > > > > > > > > > > > > > your
> > > > > > > > > > > > > > > > init method you try to get your data, if not
> > > > trigger
> > > > > a
> > > > > > > > later
> > > > > > > > > > > > > > > > invocation (
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://docs.oracle.com/javaee/6/api/javax/ejb/TimerService.html#createSingleActionTimer(java.util.Date
> > > > > > > > > > > > > > > > ,
> > > > > > > > > > > > > > > > javax.ejb.TimerConfig)). While it fails
> trigger
> > > > > another
> > > > > > > one
> > > > > > > > > > when
> > > > > > > > > > > > > > invoked.
> > > > > > > > > > > > > > > > When it succeeds you are done.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > *Romain Manni-Bucau*
> > > > > > > > > > > > > > > > *Twitter: @rmannibucau <
> > > > > > https://twitter.com/rmannibucau
> > > > > > > >*
> > > > > > > > > > > > > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > > > > > > > > > > > > > > http://rmannibucau.wordpress.com/>
> > > > > > > > > > > > > > > > *LinkedIn: **
> > > > http://fr.linkedin.com/in/rmannibucau*
> > > > > > > > > > > > > > > > *Github: https://github.com/rmannibucau*
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > 2013/7/1 James Green <
> [email protected]
> > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > In our case we have two EJBs, both
> @Singleton
> > > and
> > > > > > > > @Startup,
> > > > > > > > > > one
> > > > > > > > > > > > > > depends
> > > > > > > > > > > > > > > > on
> > > > > > > > > > > > > > > > > the other. One is a cache façade and the
> > other
> > > > > loads
> > > > > > > data
> > > > > > > > > via
> > > > > > > > > > > JPA
> > > > > > > > > > > > > and
> > > > > > > > > > > > > > > > feeds
> > > > > > > > > > > > > > > > > it into the cache. An external schedule
> > fires a
> > > > > > servlet
> > > > > > > > > that
> > > > > > > > > > > > > reloads
> > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > cache from the database.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > What's happening is that without MySQL we
> see
> > > EJB
> > > > > > > > > exceptions
> > > > > > > > > > > that
> > > > > > > > > > > > > > they
> > > > > > > > > > > > > > > > > cannot be created and thus we are dead.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > I've just tried adding autoReconnect=true
> > > inside
> > > > a
> > > > > > > > > <Resource>
> > > > > > > > > > > but
> > > > > > > > > > > > > > that
> > > > > > > > > > > > > > > > made
> > > > > > > > > > > > > > > > > no difference. I also tried adding
> > > > > > ,autoReconnect=true
> > > > > > > to
> > > > > > > > > > > > > > > > > ConnectionProperties and
> > > > > ConnectionFactoryProperties
> > > > > > > > > without
> > > > > > > > > > > any
> > > > > > > > > > > > > > change
> > > > > > > > > > > > > > > > but
> > > > > > > > > > > > > > > > > I'm not convinced that would have fixed the
> > > > problem
> > > > > > > here.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Is it instead the case that within the EJB
> I
> > > > should
> > > > > > be
> > > > > > > > > > trapping
> > > > > > > > > > > > > > > > > connectivity problems such as
> > > > PersistenceException
> > > > > > and
> > > > > > > > > > allowing
> > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > containing to gracefully start up and
> > naturally
> > > > > keep
> > > > > > > > trying
> > > > > > > > > > > > anyway?
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > James
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > On 28 June 2013 17:10, José Luis Cetina <
> > > > > > > > > > [email protected]>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > I had a similar problem and what i did
> was
> > > set
> > > > > the
> > > > > > > > > > > > autoReconnect
> > > > > > > > > > > > > > > > > attribute
> > > > > > > > > > > > > > > > > > to true en my tomee.xml datasource.
> > > > > > > > > > > > > > > > > > What do you mean with retry until the
> > > > connection
> > > > > > > > springs
> > > > > > > > > to
> > > > > > > > > > > > life?
> > > > > > > > > > > > > > do
> > > > > > > > > > > > > > > > you
> > > > > > > > > > > > > > > > > > have some schedules or jobs running and
> > want
> > > to
> > > > > > retry
> > > > > > > > > again
> > > > > > > > > > > > when
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > connection is available again? or just
> want
> > > > when
> > > > > > > > somebody
> > > > > > > > > > > click
> > > > > > > > > > > > > any
> > > > > > > > > > > > > > > > > button
> > > > > > > > > > > > > > > > > > the app can connect again (this was my
> > > case)??
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > 2013/6/28 Romain Manni-Bucau <
> > > > > > [email protected]>
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > With an ejb timer?
> > > > > > > > > > > > > > > > > > > Le 28 juin 2013 17:46, "James Green" <
> > > > > > > > > > > > [email protected]
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > > écrit
> > > > > > > > > > > > > > > > > > :
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Hopefully a quick one.
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > On boot our application attempts to
> > read
> > > > data
> > > > > > > > > through a
> > > > > > > > > > > JPA
> > > > > > > > > > > > > > > > > > > EntityManager.
> > > > > > > > > > > > > > > > > > > > If the database connection fails at
> > this
> > > > > point
> > > > > > > the
> > > > > > > > > > entire
> > > > > > > > > > > > > > > > application
> > > > > > > > > > > > > > > > > > is
> > > > > > > > > > > > > > > > > > > > effectively dead.
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Is there a way to essentially ask the
> > > > > database
> > > > > > > > layer
> > > > > > > > > to
> > > > > > > > > > > > retry
> > > > > > > > > > > > > > > until
> > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > > > connection springs to life?
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Thanks,
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > James
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to