0
votes

I'm new to Java EE, spending some times in learning it. Several hours on this error, cannot find exact similar questions, exept one student on udemy Q&A in same udemy course, but teacher cannot help the student.

The tutorial is teaching persistence using TomEE and JPA on MySQL.

I'm using Eclipse: Eclipse Java EE IDE for Web Developers. Version: 2018-09 (4.9.0)

TomEE Version: Tomcat v9.0 Server

TomEE using JRE: jdk-12.0.1

Project Java Build Path --> Module Path --> Execution Environment: JavaSE-10 (jdk-12.0.1)

Java Compiler: Use compliance from execution environment JavaSE-10

Actual MySql Connector in lib TomEE folder (tried several): mysql-connector-java-8.0.17.jar

This is my tomee.xml

<tomee>
    <Resource id="connessioneCorsoWeb" type="DataSource">
        JdbcDriver          com.mysql.jdbc.Driver
        JdbcUrl             jdbc:Mysql://127.0.0.1:3306/corso_java_web?useUnicode=true&amp;useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC
        UserName            root
        Password            admin
    </Resource>
</tomee>

this is the persistence.xml

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="1.0">
    <persistence-unit name="corsoWebPersistence">
        <jta-data-source>connessioneCorsoWeb</jta-data-source>
        <properties>
            <property name="openejb.jpa.auto-scan" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

The console message on starting application does not help me

INFO: Undeploying app: D:\Shared\Studio\Java EE Developer - La guida completa\apache-tomee-8.0.0-M3-plume\apache-tomee-plume-8.0.0-M3\webapps\corso-web Aug 16, 2019 12:11:31 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke SEVERE: Error destroying child org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] in state [STARTING_PREP] at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:430) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:316) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:814) ...

What can I look at to go deeper?

EDIT:

Removing persistence.xml the server starts.

Adding persistence.xml with only lines:

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="1.0">
</persistence>

the server starts.

Just right modifying persistence.xml as this:

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="1.0">
    <persistence-unit>
    </persistence-unit>
</persistence>

the server fails.

This is a more exhaustive extract from the current console:

... Aug 18, 2019 3:21:18 PM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web] java.lang.NullPointerException at org.apache.openejb.util.LinkResolver.resolve(LinkResolver.java:55) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:37) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:33) at org.apache.openejb.config.AutoConfig.resolvePersistenceRefs(AutoConfig.java:223) at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:197) at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420) at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1033) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1286) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)

Aug 18, 2019 3:21:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke SEVERE: Error destroying child org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] in state [STARTING_PREP] at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:430) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:316) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:814) at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1656) at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1636) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1317) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)

Aug 18, 2019 3:21:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ... 21 more Caused by: org.apache.tomee.catalina.TomEERuntimeException: java.lang.NullPointerException at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1320) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 27 more Caused by: java.lang.NullPointerException at org.apache.openejb.util.LinkResolver.resolve(LinkResolver.java:55) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:37) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:33) at org.apache.openejb.config.AutoConfig.resolvePersistenceRefs(AutoConfig.java:223) at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:197) at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420) at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1033) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1286) ... 32 more

Aug 18, 2019 3:21:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ... 13 more Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ... 21 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ... 21 more Caused by: org.apache.tomee.catalina.TomEERuntimeException: java.lang.NullPointerException at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1320) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 27 more Caused by: java.lang.NullPointerException at org.apache.openejb.util.LinkResolver.resolve(LinkResolver.java:55) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:37) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:33) at org.apache.openejb.config.AutoConfig.resolvePersistenceRefs(AutoConfig.java:223) at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:197) at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420) at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1033) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1286) ... 32 more

Aug 18, 2019 3:21:18 PM jdk.internal.reflect.NativeMethodAccessorImpl invoke SEVERE: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ... 13 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ... 13 more Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ... 21 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/corso-web]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ... 21 more Caused by: org.apache.tomee.catalina.TomEERuntimeException: java.lang.NullPointerException at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1320) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1130) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 27 more Caused by: java.lang.NullPointerException at org.apache.openejb.util.LinkResolver.resolve(LinkResolver.java:55) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:37) at org.apache.openejb.util.LinkResolver.add(LinkResolver.java:33) at org.apache.openejb.config.AutoConfig.resolvePersistenceRefs(AutoConfig.java:223) at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:197) at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420) at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1033) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1286) ... 32 more

Aug 18, 2019 3:21:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke INFO: Pausing ProtocolHandler ["http-nio-8080"] Aug 18, 2019 3:21:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke INFO: Pausing ProtocolHandler ["ajp-nio-8009"] Aug 18, 2019 3:21:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke INFO: Stopping service [Catalina] Aug 18, 2019 3:21:18 PM org.apache.openejb.server.SimpleServiceManager stop INFO: Stopping server services Aug 18, 2019 3:21:18 PM org.apache.openejb.assembler.classic.Assembler destroyApplication INFO: Undeploying app: D:\Shared\Studio\Java EE Developer - La guida completa\apache-tomee-8.0.0-M3-plume\apache-tomee-plume-8.0.0-M3\webapps\ROOT Aug 18, 2019 3:21:18 PM org.apache.openejb.assembler.classic.Assembler doResourceDestruction INFO: Closing DataSource: connessioneCorsoWeb Aug 18, 2019 3:21:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke INFO: Destroying ProtocolHandler ["http-nio-8080"] Aug 18, 2019 3:21:18 PM jdk.internal.reflect.DelegatingMethodAccessorImpl invoke INFO: Destroying ProtocolHandler ["ajp-nio-8009"]

Any single idea would be very appreciated.

2

2 Answers

0
votes

Try this instead:

<?xml version="1.0" encoding="UTF-8"?>
<persistence
    xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
    version="2.1">
    <persistence-unit name="corsoWebPersistence">
        <jta-data-source>connessioneCorsoWeb</jta-data-source>
        <properties>
            <property
                name="openejb.jpa.auto-scan"
                value="true" />
        </properties>
    </persistence-unit>
</persistence>
0
votes

Finally I solved, to be very clear: in Udemy course was used Tomcat v8.0 Server (apache-tomee-7.0.4) instead I was using Tomcat v9.0 Server (apache-tomee-8.0.0-M3-plume)

Now with old version is not necessary, but with tomee-8.0.0 it is necessary to set JPA in Project Facets (when checking JPA screen alert to configure it), or in JPA project properties.

I've tested both tomee versions, now both working.

This is a screen of my JPA config in my Tomcat v9.0 Server (apache-tomee-8.0.0-M3-plume)

enter image description here