5 Replies Latest reply on Jul 2, 2009 2:59 PM by Marcel Koopman

    jBoss and Hibernate

    Marcel Koopman Newbie

      Hello!

      I am doing my own hello world jBoss EJB application.
      I've got derby running, have a connection to it. have a EJB remote.

      However when doing a query I get classnotfound HibernateQueryException.

      Why Hibernate? Do I need Hibernate to do queries?

        • 1. Re: jBoss and Hibernate
          Wolfgang Knauf Master

          Hi!

          Where do you see the exception? In your EJB or in the client side? Please provide more details about your app.

          JBoss uses Hibernate internally to perform all EJB3 database access. Does your app contain hibernate JARs?

          Best regards

          Wolfgang

          • 2. Re: jBoss and Hibernate
            Marcel Koopman Newbie

             

            Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
             at $Proxy2.findMedewerker(Unknown Source)
             at nl.capgemini.inzetmanagement.client.Client.main(Client.java:27)
            Caused by: java.lang.ClassNotFoundException: org.hibernate.hql.ast.QuerySyntaxException
             at org.jboss.remoting.serialization.ClassLoaderUtility.loadClass(ClassLoaderUtility.java:103)
             at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:86)
             at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
             at java.lang.Class.forName0(Native Method)


            This happens when i use this code:
            @Override
             public Medewerker findMedewerker(int id) {
             Query createQuery = entityManager.createQuery("SELECT m FROM medewerker m");
             Collection<Medewerker> result = createQuery.getResultList();
             System.out.println(result);
             return null;
             }


            Ths is what I put in my remote bean.

            So do I have something missing in my libs? Do i need hibernate in the libs dir?

            • 3. Re: jBoss and Hibernate
              Marcel Koopman Newbie

              Also I am running the client app in Eclipse, maybe I need hibernate there?
              I am confused sorry.

              • 4. Re: jBoss and Hibernate
                Peter Johnson Master

                Which version of JBoss AS are you using? I found the QuerySyntaxException
                in common/lib/hibernate-core.jar, so it should be available.

                Could you post your JAR or EAR file that contains the EJB? Use: "jar -tf xxx.jar" where xxx.jar is the name of your JAR (or EAR) file.

                Also, is the code that you posted from and EJB3 session bean? If so, where are the entity beans located relative to the session bean? The stack trace suggests that you are attempting to access the entity beans remotely...

                • 5. Re: jBoss and Hibernate
                  Marcel Koopman Newbie

                  Sorry, already solved it, i didnt have the right jars.

                  Thanks anyway!