We are using an Application Server for our application - >15'000 classes >2000 
db tables, on-premised deployed - and not planed to be a cloud system (legal 
constraints).
An application server is a better fit for this kind of application with a very 
long history / inception 1998.
Today, this application server is TomEE.

When I dived into this app - any libs wered mixed, different versions (Axis, 
Axis2, Metro, etc) >370 libs over Tomcat, single app, home-made persistence and 
transactions framework .
Some Spring were under the hood, adding complexity.
Now, the better thing to do was ---> merging to some standard - any but one.

And the only standard today, IS JEE - and running for more than 20 years - 
developed by all main industry actors, including Spring.
Mixing SpringBoot with pure JEE is not good - my opinon- because both paradigms 
are close but don’t fit together, mixing up developers.

Most of time, Spring framework opens up the door for programing goodies, and 
JEE holds it (lately) but with the experience, and with smarter result (eg CDI).
Same with Hibernate and JPA.

Most of time developers think that Spring is better (or Hibernate better than 
JPA), but when going to JEE they realize that it provides 80%-90% same 
functionality. But they don't know the counterparts.

I'm in the process of dividing the monolythic app I described, but I will never 
use the "microservice" term. Services is enough for me.

I had a *very* bad experience with a Spring-Boot architecture - just as an 
observer after the storm - not as an actor. The (juniors) developers who 
designed it didn't know the full life cycle of a software and didn't know what 
was the cost of misunderstanding the concept of "microservices". The result was 
in an application with as many Spring boot (Tomcat) as tables in the 
application - and no idea of how to create a secured transaction on rest 
implying multiple "microservices". Worse than that - it result in a ton of 
'microservices' making just a reverse-proxy on a monolithic app - so never gain 
anything in term of resilience of performance. It was fancy- based on spring 
boot and Zuul (Netflix) - but wasting a ton of memory and a complexity under a 
ton of configuration files and logs. Now my job was to close that page - its 
closed - hopefully without too much harm.

Why is Spring fancy ? because it appears (still) to be a better way to develop 
cloud-based systems.
Maybe the coming future of Jakarta-EE will change this.

If you don't need a cloud based system or refactoring a monolythic application 
- go or stay on JEE.

S

-----Message d'origine-----
De : Jonathan Gallimore <[email protected]> 
Envoyé : mercredi, 8 avril 2020 14:31
À : [email protected]
Objet : Re: Spring Boot Persistence Context

Thanks for the follow up! I did get this working. I'm thinking a little Spring 
Boot example for TomEE might be useful. Any thoughts? Is anyone here using 
Spring Boot in their applications?

Jon

On Tue, Apr 7, 2020 at 2:27 PM Gilberto Caetano de Andrade < 
[email protected]> wrote:

> Maybe you need to adjust the config like this one [1] for weblogic.
>
> Regards,
>
> Gilberto
> [1]
> https://docs.spring.io/spring-boot/docs/current/rference/html/howto.ht
> ml#howto-weblogic
>
> On 2020/04/06 11:29:14, Jonathan Gallimore 
> <[email protected]>
> wrote:
> > Hi All,
> >
> > I'm looking at running a Spring Boot app in TomEE. Spring injects a 
> > persistence context into a bean managed by Spring:
> >
> > @EnableJpaRepositories(basePackages = "org.superbiz.movies.dao")
> >
> > @Repository
> > public class MovieDao {
> >
> >     @PersistenceContext(unitName = "movie-unit")
> >     private EntityManager entityManager;
> >
> > .....
> >
> > }
> >
> > The .war created doesn't have a persistence.xml file, and so this 
> > fails validation. I've tried turning off CDI with a beans.xml file 
> > with bean-discovery-mode="none" - that doesn't make any difference.
> >
> > The exception is below. Does anyone have this working? I'm of the 
> > view
> that
> > if the .war file works on Tomcat, it should also work with TomEE, 
> > without changes.
> >
> > I'll debug through to see if the @Repository class is a managed
> component,
> > and if so, what sort of managed component it is and some options to 
> > try
> and
> > get this usecase to work.
> >
> > 06-Apr-2020 12:19:11.435 INFO [main]
> org.hsqldb.persist.Logger.logInfoEvent
> > Checkpoint end - txts: 1
> > 06-Apr-2020 12:19:11.453 INFO [main] 
> > org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking 
> > resource-ref 'jdbc/DefaultDB' in bean
> > tomee-xa-tx-0.0.1-SNAPSHOT.Comp1802029863 to Resource(id=Default 
> > JDBC
> > Database)
> > 06-Apr-2020 12:19:11.496 INFO [main] 
> > org.apache.openejb.config.OutputGeneratedDescriptors.writeEjbJar 
> > Dumping Generated ejb-jar.xml to:
> >
> /home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/temp/ejb-jar-4834
> 268279266350669tomee-xa-tx-0.0.1-SNAPSHOT.xml
> > 06-Apr-2020 12:19:11.540 INFO [main] 
> > org.apache.openejb.config.OutputGeneratedDescriptors.writeOpenejbJar
> > Dumping Generated openejb-jar.xml to:
> >
> /home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/temp/openejb-jar-
> 1838234661417596634tomee-xa-tx-0.0.1-SNAPSHOT.xml
> > 06-Apr-2020 12:19:11.565 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults FAIL ...
> > tomee-xa-tx-0.0.1-SNAPSHOT: Missing required persistence.xml for 
> > @PersistenceContext ref "entityManager" to unit "movie-unit"
> > 06-Apr-2020 12:19:11.565 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults Invalid 
> > EjbModule(name=tomee-xa-tx-0.0.1-SNAPSHOT,
> >
> path=/home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/webapps/tome
> e-xa-tx-0.0.1-SNAPSHOT)
> > 06-Apr-2020 12:19:11.565 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults FAIL ...
> > tomee-xa-tx-0.0.1-SNAPSHOT: Missing required persistence.xml for 
> > @PersistenceContext ref "entityManager" to unit "movie-unit"
> > 06-Apr-2020 12:19:11.566 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults Invalid 
> > WebModule(name=tomee-xa-tx-0.0.1-SNAPSHOT,
> >
> path=/home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/webapps/tome
> e-xa-tx-0.0.1-SNAPSHOT)
> > 06-Apr-2020 12:19:11.566 INFO [main] 
> > org.apache.openejb.config.ReportValidationResults.deploy Set the 
> > 'openejb.validation.output.level' system property to VERBOSE for
> increased
> > validation details.
> > 06-Apr-2020 12:19:11.566 SEVERE [main] 
> > org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Unable 
> > to deploy collapsed ear in war
> >
> StandardEngine[Catalina].StandardHost[localhost].StandardContext[/tome
> e-xa-tx-0.0.1-SNAPSHOT]
> > org.apache.openejb.config.ValidationFailedException: Module failed 
> > validation. AppModule(name=tomee-xa-tx-0.0.1-SNAPSHOT)
> > at
> >
> org.apache.openejb.config.ReportValidationResults.deploy(ReportValidat
> ionResults.java:88)
> > at
> org.apache.openejb.config.AppInfoBuilder.build(AppInfoBuilder.java:327
> )
> > at
> >
> org.apache.openejb.config.ConfigurationFactory.configureApplication(Co
> nfigurationFactory.java:1036)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebA
> ppBuilder.java:1286)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWeb
> AppBuilder.java:1130)
> > at
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalL
> istenerSupport.java:134)
> >
> >
> > 06-Apr-2020 12:19:11.435 INFO [main]
> org.hsqldb.persist.Logger.logInfoEvent
> > Checkpoint end - txts: 1
> > 06-Apr-2020 12:19:11.453 INFO [main] 
> > org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking 
> > resource-ref 'jdbc/DefaultDB' in bean
> > tomee-xa-tx-0.0.1-SNAPSHOT.Comp1802029863 to Resource(id=Default 
> > JDBC
> > Database)
> > 06-Apr-2020 12:19:11.496 INFO [main] 
> > org.apache.openejb.config.OutputGeneratedDescriptors.writeEjbJar 
> > Dumping Generated ejb-jar.xml to:
> >
> /home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/temp/ejb-jar-4834
> 268279266350669tomee-xa-tx-0.0.1-SNAPSHOT.xml
> > 06-Apr-2020 12:19:11.540 INFO [main] 
> > org.apache.openejb.config.OutputGeneratedDescriptors.writeOpenejbJar
> > Dumping Generated openejb-jar.xml to:
> >
> /home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/temp/openejb-jar-
> 1838234661417596634tomee-xa-tx-0.0.1-SNAPSHOT.xml
> > 06-Apr-2020 12:19:11.565 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults FAIL ...
> > tomee-xa-tx-0.0.1-SNAPSHOT: Missing required persistence.xml for 
> > @PersistenceContext ref "entityManager" to unit "movie-unit"
> > 06-Apr-2020 12:19:11.565 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults Invalid 
> > EjbModule(name=tomee-xa-tx-0.0.1-SNAPSHOT,
> >
> path=/home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/webapps/tome
> e-xa-tx-0.0.1-SNAPSHOT)
> > 06-Apr-2020 12:19:11.565 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults FAIL ...
> > tomee-xa-tx-0.0.1-SNAPSHOT: Missing required persistence.xml for 
> > @PersistenceContext ref "entityManager" to unit "movie-unit"
> > 06-Apr-2020 12:19:11.566 SEVERE [main] 
> > org.apache.openejb.config.ReportValidationResults.logResults Invalid 
> > WebModule(name=tomee-xa-tx-0.0.1-SNAPSHOT,
> >
> path=/home/jgallimore/dev/tomee-xa-tx/target/apache-tomee/webapps/tome
> e-xa-tx-0.0.1-SNAPSHOT)
> > 06-Apr-2020 12:19:11.566 INFO [main] 
> > org.apache.openejb.config.ReportValidationResults.deploy Set the 
> > 'openejb.validation.output.level' system property to VERBOSE for
> increased
> > validation details.
> > 06-Apr-2020 12:19:11.566 SEVERE [main] 
> > org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Unable 
> > to deploy collapsed ear in war
> >
> StandardEngine[Catalina].StandardHost[localhost].StandardContext[/tome
> e-xa-tx-0.0.1-SNAPSHOT]
> > org.apache.openejb.config.ValidationFailedException: Module failed 
> > validation. AppModule(name=tomee-xa-tx-0.0.1-SNAPSHOT)
> > at
> >
> org.apache.openejb.config.ReportValidationResults.deploy(ReportValidat
> ionResults.java:88)
> > at
> org.apache.openejb.config.AppInfoBuilder.build(AppInfoBuilder.java:327
> )
> > at
> >
> org.apache.openejb.config.ConfigurationFactory.configureApplication(Co
> nfigurationFactory.java:1036)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebA
> ppBuilder.java:1286)
> > at
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWeb
> AppBuilder.java:1130)
> > at
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalL
> istenerSupport.java:134)
> >
> > Jon
> >
>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to