-->
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: Newbie problem - Hibernate wanting to use ActiveMQ?
PostPosted: Mon Sep 01, 2008 1:31 pm 
Newbie

Joined: Tue Jun 10, 2008 10:21 pm
Posts: 4
Hibernate appears to be wanting to use ActiveMQ for unknown reasons. I don't have it explicitly configured anywhere, and when I add it it just gives me a different error. I was really hoping to avoid complications, so I want to just leave ActiveMQ out if I can, with the hope that I'll put it back in later if I need it.

Hibernate version:
3.3.0.SP1

I am using a very simple test class with two methods (one that accesses hibernate and one that does not) - and using the HibernateUtil class in the manual. The class is this:

Code:
package com.tamedtornado.util;

import org.hibernate.*;
import org.hibernate.cfg.*;

public class HibernateUtil {

   private static final SessionFactory sessionFactory;
   
   static
   {
      try
      {
         sessionFactory = new Configuration().configure().buildSessionFactory();
      } catch (Throwable ex)
      {
         System.err.println("Initial SessionFactory creation failed "+ex);
         throw new ExceptionInInitializerError(ex);
      }
   }
   
   public static SessionFactory getSessionFactory()
   {
      return sessionFactory;
   }
   
}


Code:
package com.tamedtornado.weborbtest;

import org.hibernate.Session;

import com.tamedtornado.util.HibernateUtil;

import com.tamedtornado.weborbtest.Tester1;

public class TestClass {
   public String TestCrap(long id)
   {
      Session sess = HibernateUtil.getSessionFactory().getCurrentSession();
      
      
      Tester1 blah = (Tester1) sess.load(Tester1.class, id);
      
      return blah.getTxtDude();
   }
   
   public String TestCrap2(long id)
   {
      return "TEST!";
   }
}


Exception raised:
Code:
354 [btpool0-2] INFO org.hibernate.impl.SessionFactoryImpl - building session fa
ctory
499 [btpool0-2] INFO org.hibernate.impl.SessionFactoryObjectFactory - Factory na
me: TestWebOrbFactory
500 [btpool0-2] INFO org.hibernate.util.NamingHelper - JNDI InitialContext prope
rties:{}
503 [btpool0-2] ERROR org.hibernate.util.NamingHelper - Could not obtain initial
context
javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.act
ivemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFo
undException: org.apache.activemq.jndi.ActiveMQInitialContextFactory]
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:5
1)
        at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFac
toryObjectFactory.java:112)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
338)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)
        at com.tamedtornado.util.HibernateUtil.<clinit>(Unknown Source)
        at com.tamedtornado.weborbtest.TestClass.TestCrap(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at weborb.util.Invocation.invoke(Unknown Source)
        at weborb.handler.JavaObjectHandler.invoke(Unknown Source)
        at weborb.handler.Handlers.invokeWithHandler(Unknown Source)
        at weborb.handler.Handlers.invoke(Unknown Source)
        at weborb.dispatch.Invoker.handleInvoke(Unknown Source)
        at weborb.v3types.ReqMessage.execute(Unknown Source)
        at weborb.dispatch.V3Dispatcher.dispatch(Unknown Source)
        at weborb.dispatch.Dispatchers.dispatch(Unknown Source)
        at weborb.ORBServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491
)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1074)
        at org.mortbay.servlet.MultiPartFilter.doFilter(MultiPartFilter.java:78)

        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1065)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
65)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:185)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
81)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:6
89)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)

        at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
39)
        at org.mortbay.jetty.Server.handle(Server.java:285)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:45
7)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnectio
n.java:765)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:627)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
        at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.
java:217)
        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
.java:475)
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.jndi.ActiveMQIn
itialContextFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
r.java:363)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
r.java:325)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
        ... 43 more
518 [btpool0-2] WARN org.hibernate.impl.SessionFactoryObjectFactory - Could not
bind factory to JNDI
javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.act
ivemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFo
undException: org.apache.activemq.jndi.ActiveMQInitialContextFactory]
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:5
1)
        at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFac
toryObjectFactory.java:112)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
338)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)
        at com.tamedtornado.util.HibernateUtil.<clinit>(Unknown Source)
        at com.tamedtornado.weborbtest.TestClass.TestCrap(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at weborb.util.Invocation.invoke(Unknown Source)
        at weborb.handler.JavaObjectHandler.invoke(Unknown Source)
        at weborb.handler.Handlers.invokeWithHandler(Unknown Source)
        at weborb.handler.Handlers.invoke(Unknown Source)
        at weborb.dispatch.Invoker.handleInvoke(Unknown Source)
        at weborb.v3types.ReqMessage.execute(Unknown Source)
        at weborb.dispatch.V3Dispatcher.dispatch(Unknown Source)
        at weborb.dispatch.Dispatchers.dispatch(Unknown Source)
        at weborb.ORBServlet.service(Unknown Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491
)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1074)
        at org.mortbay.servlet.MultiPartFilter.doFilter(MultiPartFilter.java:78)

        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1065)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
65)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:185)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
81)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:6
89)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)

        at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
39)
        at org.mortbay.jetty.Server.handle(Server.java:285)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:45
7)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnectio
n.java:765)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:627)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
        at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.
java:217)
        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
.java:475)
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.jndi.ActiveMQIn
itialContextFactory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
r.java:363)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
r.java:325)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
        ... 43 more


I understand that I may have some basic Hibernate errors in here as well, as I am quite new with it, but please be forgiving. I'm really more concerned about getting the session to even create itself.

Any help is appreciated,
Jason


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 2:28 pm 
Newbie

Joined: Sat Aug 02, 2008 12:09 pm
Posts: 12
By looking at you stacktrace, i.e.

at weborb.util.Invocation.invoke(Unknown Source)
at weborb.handler.JavaObjectHandler.invoke(Unknown Source)
at weborb.handler.Handlers.invokeWithHandler(Unknown Source)

and...

at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1

...it seems to be more than hibernate involved in your application :-)

If you are using WebORB it will be this framework that wants ActiveMQ JNDI lookup classes, Not hibernate.

G


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 10:28 pm 
Newbie

Joined: Tue Jun 10, 2008 10:21 pm
Posts: 4
Yes, WebOrb is involved. ActiveMQ in weborb is disabled, since it is documented quite explicitly how to turn it off.

Also, this appears to say that it's Hibernate asking for ActiveMQ:

Code:
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:5
1)
        at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFac
toryObjectFactory.java:112)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
338)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)


Since That's hibernate code calling javax code. Is there some reason why Hibernate would be passing through something related to weborb? I honestly don't know enough about what's going on here to say, but I think just saying "oh, it must be that other thing in there" without explanation is supremely unhelpful and possibly wrong.


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.