3 Replies Latest reply on Aug 24, 2009 1:06 PM by heapifyman heapifyman

    generate-ui throws ClassNotFoundException

    heapifyman heapifyman Newbie

      I just created a new seam project with seam 2.2.0.GA. I copied some existing entities to my src/main folder and wanted to let seam generate the ui stuff from that. running seam generate-ui I got the following error:



      war:
      [hibernate] Executing Hibernate Tool with a JPA Configuration
      [hibernate] 1. task: generic exportertemplate: view/list.xhtml.ftl
      [hibernate] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
      [hibernate] log4j:WARN Please initialize the log4j system properly.
      [hibernate] An exception occurred while running exporter #2:generic exportertemplate: view/list.xhtml.ftl
      [hibernate] To get the full stack trace run ant with -verbose
      [hibernate] Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
      [hibernate] java.lang.reflect.InvocationTargetException
      [hibernate] javax.persistence.PersistenceException: [PersistenceUnit: tester] class or package not found
      [hibernate] java.lang.ClassNotFoundException: com.atb.oasmme.entity.TreeTest
      [hibernate] A class were not found in the classpath of the Ant task.
      [hibernate] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.
      
      BUILD FAILED
      D:\Programme\Development\jboss-seam-2.2.0.GA\seam-gen\build.xml:1598: Problems in creating a configuration for JPA. Have you remembered to add hiberna
      te EntityManager jars to the classpath ?




      Any ideas what might be the problem here?
      Thanks in advance,
      philip

        • 1. Re: generate-ui throws ClassNotFoundException
          heapifyman heapifyman Newbie

          I figured out now that my problem is that my entity extends another class, which is not annotated with @Entity.
          Apparently the generate-ui target cannot handle such a thing although it's IMHO a valid entity hierarchy.


          Is this a known problem? Or is such functionality not wanted?
          Can I somehow adapt the seam generation part to make it work?


          Any hints would be appreciated. Thanks in advance,
          philip

          • 2. Re: generate-ui throws ClassNotFoundException
            Johan Hörting Newbie

            I had the same problem, only difference is that I implemented an interface that was included in an external jar-file. To fix the problem, I added my external jar to the classpath in the seam bash-file.   


            jar:
            [hibernate] Executing Hibernate Tool with a JPA Configuration
            [hibernate] 1. task: generic exportertemplate: view/list.xhtml.ftl
            [hibernate] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
            [hibernate] log4j:WARN Please initialize the log4j system properly.
            [hibernate] An exception occurred while running exporter #2:generic exportertemplate: view/list.xhtml.ftl
            [hibernate] To get the full stack trace run ant with -verbose
            [hibernate] Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
            [hibernate] java.lang.reflect.InvocationTargetException
            [hibernate] javax.persistence.PersistenceException: [PersistenceUnit: leagbench] class or package not found
            [hibernate] java.lang.ClassNotFoundException: st.horting.leagbench.entity.TeamTarget
            [hibernate] A class were not found in the classpath of the Ant task.
            [hibernate] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.
            
            BUILD FAILED
            /home/johan/Software/jboss-seam-2.2.0.GA/seam-gen/build.xml:1598: Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
            



            • 3. Re: generate-ui throws ClassNotFoundException
              heapifyman heapifyman Newbie

              I had the same problem, only difference is that I implemented an interface that was included in an external jar-file. To fix the problem, I added my external jar to the classpath in the seam bash-file.

              In the end that really was my problem, as well. My Superclass also implemented an interface that was in an external jar. Adding that jar to seam-gen's classpath did the trick.


              However, editing the seam bash file (or seam.bat) is not really comfortable. Is there another way to pass such external jars to seam-gen?