1 Reply Latest reply on Aug 25, 2010 7:13 AM by Peter Brewer

    Migrating to JBoss 5.x - User not mapped exception

    Dahn Maier Newbie

      Hello everyone,


      I am migrating a WAR app from JBoss 4.2.X (where it works like a dream) to JBoss 5.0.1 or JBoss 5.1.0 (am currently trying both). I'm using Seam 2.1.2
      On JBoss 5.0.1 the app loads properly (no exceptions) and Hibernate even generates the schema according to all annotated entities. The problem comes the first time
      I try to check for a users (on user login) and I have a query that runs like this:




      List<User> users = entityManager.createQuery(
              "from User u where u.username = :username")
              .setParameter("username", identity.getCredentials().getUsername())
              .getResultlist();



      The app then coughs with the following error:


      org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User u where u.username = :username]
           at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:181)...



      The problem is that I have mapped the class correctly and am calling it properly in the query (not calling the table name instead).
      I just can't figure out what it is. It must be a configuration in the JBoss 5.X server that causes it.


      On JBoss 5.1 it's even stranger - it doesn't throw any errors on startup but just aborts at some point and keeps trying to reload.


      Any help would be greatly appreciated. I'm migrating to JBoss 5.x in order to integrate with the latest version of Hibernate Search.


      Dahn




        • 1. Re: Migrating to JBoss 5.x - User not mapped exception
          Peter Brewer Novice

          It must be a configuration in the JBoss 5.X server that causes it.

          Not sure what causes it, but I'm guessing this is a classloader problem. Best bet is to google this - I deploy as an EAR and don't encounter this issue.



          On JBoss 5.1 it's even stranger - it doesn't throw any errors on startup but just aborts at some point and keeps trying to reload

          Do you mean that the war keeps trying to redploy? This is a know issue with Seam 2.2 and Jboss 5.1 that causes continuous redeployment. Although I can't find the JIRA ref right now, the fix is available here.


          Hope that helps, Pete.