[opencms-dev] Antwort: Re: Antwort: Re: Antwort: Re: Update OpenCMS 10.5 to 11.0.1 - NoClassDefFoundError

martin.rosenthal at oerag.de martin.rosenthal at oerag.de
Mon Jul 20 10:01:42 CEST 2020


Hello Stephan,

thanks for your help. My application is now running.

Regards,
Martin
_______________________________




Von:	Stephan Schrader <zstephanz at gmail.com>
An:	The OpenCms mailing list <opencms-dev at opencms.org>
Datum:	17.07.2020 13:21
Betreff:	Re: [opencms-dev] Antwort: Re: Antwort: Re: Update OpenCMS 10.5
            to 11.0.1 - NoClassDefFoundError
Gesendet von:	opencms-dev-bounces at opencms.org



You will need at least: geronimo-jpa_2.0_spec-1.1.jar that JAR contains
javax.persistence. Maybe you will also need ehcache-core-2.4.7.jar
and ehcache-openjpa-0.2.0.jar for caching, but I'm not sure about this.

Stephan

Am Fr., 17. Juli 2020 um 12:17 Uhr schrieb <martin.rosenthal at oerag.de>:
      Hello Michael and Stefan,

      thank you for your help. I found the reason for the error. We are
      using a
      custom OpenCMS module which contains als class for creating
      EntityManagerFactory for the Application. This calls will be loaded
      by an
      annotation @WebListener.

      @WebListener
      public class EMF implements ServletContextListener {

        private static EntityManagerFactory emf;

        @Override
        public void contextInitialized(ServletContextEvent event) {
            emf = Persistence.createEntityManagerFactory("xxxxxx");
            ServiceFactory.initializeServiceFactory(emf);

        }

        @Override
        public void contextDestroyed(ServletContextEvent event) {
            if (emf != null) {
                emf.close();
            }
        }

        public static EntityManager createEntityManager() {
            if (emf == null) {
                throw new IllegalStateException("Context is not initialized
      yet."
      );
            }

            return emf.createEntityManager();
        }

        public static EntityManagerFactory getEntityManagerFactory() {
            return emf;
        }

      As persistence provide we are using
      org.apache.openjpa.persistence.PersistenceProviderImpl in the
      persistence.xml file. The db2 driver deliverd by OpenCMS works fine.
      The
      only problem is to get the above shown class working on startup. I've
      copied the openjpa-2.4.0.jar in the lib directory but it has no
      effect. I
      get the same error. I think i must write a new class  for creating
      EntityManagerFactory .

      Regards,
      Martin




      Von:    Stephan Schrader <zstephanz at gmail.com>
      An:     The OpenCms mailing list <opencms-dev at opencms.org>
      Datum:  17.07.2020 10:32
      Betreff:        Re: [opencms-dev] Antwort: Re: Update OpenCMS 10.5 to
      11.0.1 -
                  NoClassDefFoundError
      Gesendet von:   opencms-dev-bounces at opencms.org



      Hi Martin,

      I would say, it depends. If you have custom classes referencing
      javax.persistence.EntityManagerFactory then copy the missing JARs
      (OpenJPA
      or Hibernate) to the WEB-INF/lib folder or update the dependency
      management
      in your build tool. But this depends on your setup.

      If you used the OpenCms JPA DB driver before, then you need to
      configure
      the non JPA DB driver as Michael mentioned.

      https://documentation.opencms.org/javadoc/core/org/opencms/db/db2/package-summary.html


      Stephan

      Am Fr., 17. Juli 2020 um 07:02 Uhr schrieb <martin.rosenthal at oerag.de
      >:
            Hello Stephan,

            thanks for your reply. It's really strange. What can i / should
      use
            instead
            of JPA???

            Regards,
            Martin




            Von:    Stephan Schrader <zstephanz at gmail.com>
            An:     The OpenCms mailing list <opencms-dev at opencms.org>
            Datum:  16.07.2020 20:37
            Betreff:        Re: [opencms-dev] Update OpenCMS 10.5 to 11.0.1
      -
                        NoClassDefFoundError
            Gesendet von:   opencms-dev-bounces at opencms.org



            Hi Martin,

            the JPA support has been removed with commit:

      https://github.com/alkacon/opencms-core/commit/375c6bf71f645a84d9121d84beb75c111bc5734a


            . Unfortunately I haven't found any reason.

            Stephan

            Am Do., 16. Juli 2020 um 12:15 Uhr schrieb <
      martin.rosenthal at oerag.de
            >:

                  Hello,

                  i'm trying to upgrade my local OpenCMS developer system
      from
            OpenCMS
                  10.5
                  to 11.0.1. It is actually running on Windows 10, Oracle
      Java 8
            in a
                  Tomcat
                  9.0.30. As database i'm using IBM DB2 v.10.5.0.9 .
                  After copying the files from the upgrade package in my
            installation
                  directory als described in the readme-file, OpenCMS isn't
            starting
                  After a
                  few seconds i get the error:


                  SCHWERWIEGEND: Error deploying web application directory
                  [D:\apache-tomcat-9.0.30\webapps\web]
                  java.lang.IllegalStateException: Error starting child
                          at
            org.apache.catalina.core.ContainerBase.addChildInternal
                  (ContainerBase.java:720)
                          at
      org.apache.catalina.core.ContainerBase.addChild
                  (ContainerBase.java:690)
                          at org.apache.catalina.core.StandardHost.addChild
                  (StandardHost.java:705)
                          at
            org.apache.catalina.startup.HostConfig.deployDirectory
                  (HostConfig.java:1133)
                          at org.apache.catalina.startup.HostConfig
            $DeployDirectory.run
                  (HostConfig.java:1867)
                          at java.util.concurrent.Executors
      $RunnableAdapter.call
                  (Executors.java:511)
                          at java.util.concurrent.FutureTask.run
            (FutureTask.java:266)
                          at

      org.apache.tomcat.util.threads.InlineExecutorService.execute
                  (InlineExecutorService.java:75)
                          at
      java.util.concurrent.AbstractExecutorService.submit
                  (AbstractExecutorService.java:112)
                          at
            org.apache.catalina.startup.HostConfig.deployDirectories
                  (HostConfig.java:1045)
                          at
      org.apache.catalina.startup.HostConfig.deployApps
                  (HostConfig.java:429)
                          at org.apache.catalina.startup.HostConfig.start
                  (HostConfig.java:1576)
                          at
            org.apache.catalina.startup.HostConfig.lifecycleEvent
                  (HostConfig.java:309)
                          at
            org.apache.catalina.util.LifecycleBase.fireLifecycleEvent
                  (LifecycleBase.java:123)
                          at
            org.apache.catalina.util.LifecycleBase.setStateInternal
                  (LifecycleBase.java:423)
                          at
      org.apache.catalina.util.LifecycleBase.setState
                  (LifecycleBase.java:366)
                          at
      org.apache.catalina.core.ContainerBase.startInternal
                  (ContainerBase.java:936)
                          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:1384)
                          at org.apache.catalina.core.ContainerBase
            $StartChild.call
                  (ContainerBase.java:1374)
                          at java.util.concurrent.FutureTask.run
            (FutureTask.java:266)
                          at

      org.apache.tomcat.util.threads.InlineExecutorService.execute
                  (InlineExecutorService.java:75)
                          at
      java.util.concurrent.AbstractExecutorService.submit
                  (AbstractExecutorService.java:134)
                          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:930)
                          at org.apache.catalina.util.LifecycleBase.start
                  (LifecycleBase.java:183)
                          at org.apache.catalina.startup.Catalina.start
                  (Catalina.java:633)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0
      (Native
                  Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke
                  (NativeMethodAccessorImpl.java:62)
                          at
      sun.reflect.DelegatingMethodAccessorImpl.invoke
                  (DelegatingMethodAccessorImpl.java:43)
                          at java.lang.reflect.Method.invoke
      (Method.java:498)
                          at org.apache.catalina.startup.Bootstrap.start
                  (Bootstrap.java:343)
                          at org.apache.catalina.startup.Bootstrap.main
                  (Bootstrap.java:474)
                  Caused by: org.apache.catalina.LifecycleException: Failed
      to
            start
                  component [StandardEngine[Catalina].StandardHost
                  [localhost].StandardContext
                  [/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.addChildInternal
                  (ContainerBase.java:717)
                          ... 37 more
                  Caused by: java.lang.NoClassDefFoundError:
                  Ljavax/persistence/EntityManagerFactory;
                          at java.lang.Class.getDeclaredFields0(Native
      Method)
                          at java.lang.Class.privateGetDeclaredFields
            (Class.java:2583)
                          at java.lang.Class.getDeclaredFields
      (Class.java:1916)
                          at
            org.apache.catalina.util.Introspection.getDeclaredFields
                  (Introspection.java:110)
                          at


      org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation
                  (WebAnnotationSet.java:269)
                          at


      org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations



                  (WebAnnotationSet.java:89)
                          at


      org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations



                  (WebAnnotationSet.java:67)
                          at


      org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig



                  (ContextConfig.java:330)
                          at
            org.apache.catalina.startup.ContextConfig.configureStart
                  (ContextConfig.java:777)
                          at
            org.apache.catalina.startup.ContextConfig.lifecycleEvent
                  (ContextConfig.java:301)
                          at
            org.apache.catalina.util.LifecycleBase.fireLifecycleEvent
                  (LifecycleBase.java:123)
                          at
            org.apache.catalina.core.StandardContext.startInternal
                  (StandardContext.java:5051)
                          at org.apache.catalina.util.LifecycleBase.start
                  (LifecycleBase.java:183)
                          ... 38 more
                  Caused by: java.lang.ClassNotFoundException:
                  javax.persistence.EntityManagerFactory
                          at
            org.apache.catalina.loader.WebappClassLoaderBase.loadClass
                  (WebappClassLoaderBase.java:1365)
                          at
            org.apache.catalina.loader.WebappClassLoaderBase.loadClass
                  (WebappClassLoaderBase.java:1188)
                          ... 51 more

                  Has anyone the same problem or an idea, what could be the
            reason?

                  Thanks and regards,
                  Martin Rosenthal

                  _______________________________________________
                  This mail is sent to you from the opencms-dev mailing
      list
                  To change your list options, or to unsubscribe from the
      list,
            please
                  visit

      http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev


                  _______________________________________________
                  This mail is sent to you from the opencms-dev mailing
      list
                  To change your list options, or to unsubscribe from the
      list,
            please
                  visit

      http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev






            _______________________________________________
            This mail is sent to you from the opencms-dev mailing list
            To change your list options, or to unsubscribe from the list,
      please
            visit
            http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev


            _______________________________________________
            This mail is sent to you from the opencms-dev mailing list
            To change your list options, or to unsubscribe from the list,
      please
            visit
            http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev






      _______________________________________________
      This mail is sent to you from the opencms-dev mailing list
      To change your list options, or to unsubscribe from the list, please
      visit
      http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev


      _______________________________________________
      This mail is sent to you from the opencms-dev mailing list
      To change your list options, or to unsubscribe from the list, please
      visit
      http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev









More information about the opencms-dev mailing list