Romain's emails tend to assume you know what's he's talking about ;-) On this matter I've no idea how to provide the dictionary to JPA and how it fits in with our existing design so if the "magic" appears as an example I'll certainly give it shot!
On 1 July 2013 17:17, Howard W. Smith, Jr. <[email protected]> wrote: > 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&rewriteBatchedStatements=true&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* > > > ------------------------------------------------------------------- > > > > > >
