-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problems with JTA TransactionManager not available
PostPosted: Wed Apr 09, 2008 9:41 pm 
Newbie

Joined: Tue Apr 01, 2008 12:30 pm
Posts: 12
I'm running JBoss 4.0.4 and running in to no end of problems getting my first attempt at J2EE code up and running. I've ridden circles of try to start the debugger, crash on an exception, search for help on exception, and implement fix for most of the day. Now I've run into one that I can't find any information about:

19:16:25,234 INFO [SessionFactoryObjectFactory] Factory name: java:hibernate/SessionFactory
19:16:25,250 INFO [NamingHelper] JNDI InitialContext properties:{}
19:16:25,281 INFO [NamingHelper] Creating subcontext: java:hibernate
19:16:25,296 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:hibernate/SessionFactory
19:16:25,296 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
19:16:41,421 ERROR [[Login]] Servlet.service() for servlet Login threw exception
java.lang.IllegalStateException: JTA TransactionManager not available
at org.hibernate.transaction.JTATransaction.registerSynchronization(JTATransaction.java:302)
at org.hibernate.context.ThreadLocalSessionContext.currentSession(ThreadLocalSessionContext.java:78)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:541)
at com.msobkow.admobile.advdb.rec.AdvDbImUserDbIO.getByImUserNameIdx(AdvDbImUserDbIO.java:163)
at com.msobkow.admobile.web.LoginServlet.doPost(LoginServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619)

Below are my hibernate.properties and hibernate.cfg.xml files.

Code:
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://localhost/advdb
hibernate.connection.username = postgres
hibernate.connection.password = *****
hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect


Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory
        name="java:hibernate/SessionFactory">

        <!-- properties -->
        <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
        <property name="current_session_context_class">thread</property>
        <property name="show_sql">false</property>
        <property name="transaction.factory_class">
            org.hibernate.transaction.JTATransactionFactory
        </property>
        <property name="jta.UserTransaction">java:comp/UserTransaction</property>

        <!-- mapping files -->
      <mapping resource="com/msobkow/admobile/advdb/rec/AdvDbActionCodeBean.hbm.xml" />
             .... a lot more of the same ...
      
        <!-- cache settings -->
      <class-cache class="com.msobkow.admobile.advdb.rec.AdvDbActionCodeBean" usage="read-write" />
      ... a lot more of the same ...
    </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 12:23 pm 
Newbie

Joined: Tue Apr 01, 2008 12:30 pm
Posts: 12
That turned out to be a simple matter of commenting out the JTA transaction factory initialization in the hibernate.cfg.xml, but now I'm getting into the "nuts'n'bolts" of debugging the actual HQL.

I have a very simple query method:
Code:
   public AdvDbImUserBean getByImUserNameIdx(
      String   argUserName )
   {
      Session session = HibernateSessionFactory.getSessionFactory().getCurrentSession();
      Query qry = session.createQuery(
            "select o from AdvDbImUserBean "
         +   "where"
         +      " UserName = :parmUserName" );
      qry.setParameter( "parmUserName", argUserName );
      AdvDbImUserBean rec = (AdvDbImUserBean)qry.uniqueResult();
      return( rec );
   }


But I'm getting an IllegalStateException from Hibernate that baffles me, as the mappings for AdvDbImUserBean ran successfully only moments earlier.


10:16:37,171 ERROR [[Login]] Servlet.service() for servlet Login threw exception
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode
\-[IDENT] IdentNode: 'o' {originalText=o}

at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:144)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:714)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:538)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:227)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:159)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1612)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy58.createQuery(Unknown Source)
at com.msobkow.admobile.advdb.rec.AdvDbImUserDbIO.getByImUserNameIdx(AdvDbImUserDbIO.java:165)
at com.msobkow.admobile.web.LoginServlet.doPost(LoginServlet.java:157)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 1:17 pm 
Newbie

Joined: Tue Apr 01, 2008 12:30 pm
Posts: 12
*sigh* Nothing more than a syntax error. HQL should have skipped the "select o" portion.

Now to figure out how to turn on debug logging of the generated SQL so I can see what PostgreSQL is complaining about.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.