aspose file tools*
The moose likes JBoss/WildFly and the fly likes jboss 6 and persistence.xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "jboss 6 and persistence.xml file" Watch "jboss 6 and persistence.xml file" New topic
Author

jboss 6 and persistence.xml file

Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
I am using jboss 6.0.0.Final version with hibernate and I am getting the following error if I don't specify the Task class in the persistence.xml file. I don't need to do that with jboss 5, can someone shed some light to this issue.

Caused by: javax.servlet.ServletException: org.hibernate.hql.ast.QuerySyntaxException: Task is not mapped [Select t from Task as t]

TIA.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10264
    
168

Please post the entire exception stacktrace, the contents of your persistence.xml and more details about how your application is packaged.

[My Blog] [JavaRanch Journal]
Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
2011-03-21 10:29:05,431 ERROR [com.action.InitHomeAction] (http-127.0.0.1-8443-4) execute(ActionMapping,Ac
tionForm,HttpServletRequest,HttpServletResponse): Exception[java.lang.IllegalArgumentException] thrown.: java.lang.IllegalArgumentException:
org.hibernate.hql.ast.QuerySyntaxException: Todo is not mapped [Select t from Todo as t]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1201) [:3.6.0.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147) [:3.6.0.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:275) [:3.6.0.Final]
at com..action.InitHomeAction.execute(InitHomeAction.java:53) [:]
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) [:]
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) [:]
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [:]
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) [:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) [:1.1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at com.persistence.HibernateJTAFilter.doFilter(HibernateJTAFilter.java:67) [:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:593) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_22]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Todo is not mapped [Select t from Todo as t]
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) [:3.6.0.Final]
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) [:3.6.0.Final]
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) [:3.6.0.Final]
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322) [:3.6.0.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) [:3.6.0.Final]
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) [:3.6.0.Final]



persistence.xml:
----------------------

<?xml version='1.0' encoding='utf-8'?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">

<persistence-unit name="jboss">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/jboss</jta-data-source>
<properties>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
</properties>

</persistence-unit>

</persistence>


Packaging:
----------------

ear
|
|-------META-INF
|      |
|      |
|      |--> application.xml, jboss-app.xml, MANIFEST.MF
|
|
|-------lib
|       |
|       |
|       |------persistenceUnit.jar
|       |
|       |
|       |--------> META-INF
|       |              |
|       |              |------->MANIFEST.MF, persistence.xml
|       |
|       |--------> <model classes are here>
|
|-------war
|
|
|
|-------ejb.jar
Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
Please help if anyone knows why?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10264
    
168

Is it a typo in your post, or do you really have the persistence.xml at .ear/lib/META-INF folder? If that's where you have it then it's an incorrect location. Move it to .ear/lib/persistenceUnit.jar/META-INF.
Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
Jaikiran, thanks for your answer. The persistence.xml actually is in ear/lib/persistenceUnit.jar/META-INF directory.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10264
    
168

Post the output of



and also the code from the Todo class.
Bob Green
Ranch Hand

Joined: Feb 29, 2004
Posts: 93
META-INF/
META-INF/MANIFEST.MF
META-INF/persistence.xml
com/
com/persistence/
com/persistence/model/
com/persistence/model/Todo.class
com/util/
com/util/persistence/
com/util/persistence/HibernateJTAFilter.class
com/util/persistence/PersistenceUtil.class

/**
* Todo generated by hbm2java
*/
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10264
    
168

Hmmm, looks fine to me assuming the Todo class has com.persistence.model as its package declaration. Can you post the code which accesses the entitymanager and invokes on it? Including how you get hold of the entity manager?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jboss 6 and persistence.xml file