-->
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.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Mon Dec 07, 2009 2:06 pm 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Hy guys,

I tried to setup Hibernate Search with ActiveMQ for a cluster after this "tutorial": http://docs.jboss.org/hibernate/stable/ ... ms-backend. At first time I have many ClassNotFoundException, which I have fixed with copying a lot of libs into the tomcat/lib directory.

Unfortunately now the server starts with a "javax.naming.NameNotFoundException: Name jms is not bound in this Context".

I wrote the ActiveMQ Resources inside the "Context" tag inside the server.xml:

Code:
   <Context path="" reloadable="false"
               docBase="">

               <Resource name="jdbc/DataSource" auth="Container"
                  driverClassName="com.mysql.jdbc.Driver" username="" password=""
                  type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/db" />
                  
               <!-- ActiveMQ ConnectionFactory -->   
                   <Resource name="jms/ConnectionFactory"  auth="Container"  type="org.apache.activemq.ActiveMQConnectionFactory"
                       description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                       brokerURL="tcp://localhost:61616?trace=true" brokerName="LocalActiveMQBroker"/>
                        
                   <!-- ActiveMQ HibernateSearch queue -->   
                   <Resource name="queue/hibernatesearch"  auth="Container"  type="org.apache.activemq.command.ActiveMQQueue"
                       description="Hibernate search queue" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                       physicalName="HibernateSearchController"/>                   


               <Resource auth="Container" mail.smtp.host="localhost"
                  name="mail/Session" type="javax.mail.Session" />


            </Context>
   



Then i extend my hibernate configuration:

Code:
   <bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      ....
      <property name="hibernateProperties">
         <map>
            .....

            <entry key="hibernate.search.default.directory_provider" value="${hibernate.search.default.directory_provider}" />
            <entry key="hibernate.search.default.indexBase" value="/path" />
            <entry key="hibernate.search.default.sourceBase" value="/path2" />
            <entry key="hibernate.search.default.refresh" value="1800" />
            <entry key="hibernate.search.worker.backend" value="jms" />
            <entry key="hibernate.search.worker.jms.connection_factory"  value="java:comp/env/jms/ConnectionFactory" />
            <entry key="hibernate.search.worker.jms.queue" value="java:comp/env/queue/hibernatesearch" />
            
         </map>
      </property>
      ...
      <property name="dataSource" ref="dataSource" />
   </bean>





Just for a try I set the jdbc-datasource-resource as value for "hibernate.search.worker.jms.connection_factory". After doing this the server starts with a ClassCastException. Seems so, that the tomcat will find the jdbc-datasource-resource in jndi, but not the connectionFactory.

Any suggestions about this?


Best regards,
Simon


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Mon Dec 07, 2009 5:30 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Have you seen this. It might be a little out-dated, but that's how I got it to work - Clustering using ActiveMQ and Tomcat


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Mon Dec 07, 2009 5:38 pm 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Hy,

thanks for your reply. Yes I use this tutorial. Thats where the code for the resources came from :). I think I have done all described things, but it does not work for me.


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 6:27 am 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Wow. Seems that the tomcat now starts. Don't know why. Nothing changed since yesterday. Maybe caching or eclipse problem...or weather in siberia changed ^^.

Just another Problem. But thats a user problem, I think. I get a couldNotConnectException. Yäh!. All Fine.

Code:
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616?trace=true. Reason: java.net.ConnectException: Connection refused


In tutorial https://www.hibernate.org/421.html is described, that I have to implement tow new classes. One to start the broker and one to register the app to the queue. Both in the master application.

Unfortunately for the first class my app can`t find the class "PropertyReader". In the second class the whole javax.jms package seems to be lost. Although I found it while typing in the strg+shift+T Dialog.

So it seems, that the tutorial is outdated. Not bad, but I dont no what to do. Has anyone help?


Best Regards,
Simon


edit*

Well, thats was my fault. I forgott to add the activemq dependency to my webapp module. It was only added to the core module. Sry.

But, now another problem:

I get a lot of Exceptions during set the messageListener to the MessageConsumer.
Thats my Code:

Listener on startup:

Code:
   /* (non-Javadoc)
    * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
    */
   @Override
   public void contextInitialized(ServletContextEvent sce)
   {
       // Start message broker
      try {
          File brokerdata = new File(Environment.getInstance().getProperty("hibernate.search.jmsprovider.datadir"));
          if (! brokerdata.exists()) {
              brokerdata.mkdirs();
          }
         
          BrokerService broker = new BrokerService();
          broker.setDataDirectoryFile(brokerdata);
          broker.addConnector("tcp://localhost:61616");
          broker.start();
      } catch (Exception e) {
          throw new RuntimeException("error during broker startup: " + e);
      }
     
      JMSHibernateSearchControllerImpl con = new JMSHibernateSearchControllerImpl();
      con.connect();
   }



Subclass of AbstractJMSHibernateSearchController, that will be instantiated in the listener:

Code:
public void connect()
   {
      Context initCtx;
      try
      {
         initCtx = new InitialContext();
             // Look up for connection factory & create connection, session
       ConnectionFactory connectionFactory = (ConnectionFactory) initCtx.lookup("java:comp/env/jms/ConnectionFactory");       
       Connection connection = connectionFactory.createConnection();
       connection.start();
       javax.jms.Session session = connection.createSession(true, 0);

       // Look up for destination and set listner
       Queue queue = (Queue) initCtx.lookup("java:comp/env/queue/hibernatesearch");
       MessageConsumer consumer = session.createConsumer(queue);
       consumer.setMessageListener(this);
       
      }
      catch (NamingException e)
      {
         Logger.getLogger(getClass()).error("" , e);
         throw new TechnicalException(e);
         
      }
      catch (JMSException e)
      {
         Logger.getLogger(getClass()).error("" , e);
         throw new TechnicalException(e);
      }

   }



After " consumer.setMessageListener(this);" the following Exceptions will be thrown:

Code:
SCHWERWIEGEND: ID:Macsuppe.local-52159-1260271860148-2:0:1:1 Exception while processing message: java.lang.NullPointerException
java.lang.NullPointerException
   at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:23)
   at org.hibernate.search.util.ContextHelper.getSearchFactory(ContextHelper.java:18)
   at org.hibernate.search.backend.impl.jms.AbstractJMSHibernateSearchController.getWorker(AbstractJMSHibernateSearchController.java:95)
   at org.hibernate.search.backend.impl.jms.AbstractJMSHibernateSearchController.onMessage(AbstractJMSHibernateSearchController.java:85)
   at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:946)
   at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
   at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
   at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:118)
   at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:42)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:637)
08.12.2009 12:31:00 org.apache.activemq.ActiveMQMessageConsumer dispatch
SCHWERWIEGEND: ID:Macsuppe.local-52159-1260271860148-2:0:1:1 Exception while processing message: java.lang.NullPointerException
java.lang.NullPointerException
   at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:23)
   at org.hibernate.search.util.ContextHelper.getSearchFactory(ContextHelper.java:18)
   at org.hibernate.search.backend.impl.jms.AbstractJMSHibernateSearchController.getWorker(AbstractJMSHibernateSearchController.java:95)
   at org.hibernate.search.backend.impl.jms.AbstractJMSHibernateSearchController.onMessage(AbstractJMSHibernateSearchController.java:85)
   at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:946)
   at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
   at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
   at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:118)
   at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:42)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:637)


Top
 Profile  
 
 Post subject: No Indexfiles have been created
PostPosted: Tue Dec 08, 2009 9:20 am 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Sry, for doublepost, but this ist clearly a new problem. I hope it`s ok.


So the second problem is fixed. I added the line "session.setMessageListener(this);" after "javax.jms.Session session = connection.createSession(true, 0);" to the JMSHibernateSearchListenerImpl. I hope this will not only hide the exceptions.

If all runs, maybe you want to update the tutorial.

Now, I hope the last problem. No Exceptions where thrown. Master Index and slave Index will be created. But no Indexfiles, only the segments files have been created.

Without Exceptions it is hard to say, what is wrong now. Maybe one of you have had the same problem.

Here is some debug output:

Code:
[DEBUG] [2009-12-08 14:17:40,146] [de.tempodome.adserver.common.spring.SwitchableSchedulerFactoryBean#0_Worker-1] org.hibernate.event.def.AbstractFlushingEventListener | Flushed: 0 insertions, 0 updates, 0 deletions to 8 objects
[DEBUG] [2009-12-08 14:17:40,146] [de.tempodome.adserver.common.spring.SwitchableSchedulerFactoryBean#0_Worker-1] org.hibernate.event.def.AbstractFlushingEventListener | Flushed: 0 (re)creations, 0 updates, 0 removals to 21 collections

Thanks,
Simon


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 9:27 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi Simon,

great for running though all this code again. Maybe you can sum up all the changes/updates the tutorial needs so that we can update it. Or even better register yourself on the wiki and do it yourself.

Regarding your index being empty - how does your indexing code look like?

--Hardy


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 9:47 am 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Hy Hardy,

If I can ensure, that the code is running, of course I will help to update the tutorial!.

Thats my indexing code:

Code:
   public void rebuildCreativeIndex() throws TechnicalException
   {
      FullTextSession fts = Search.getFullTextSession(getCurrentSession());

      final long currentTimeMillis = System.currentTimeMillis();
      final int count = getActiveCreativesCount();
      final int maxResults = 100;

      getLogger().info("Start Creative Index Rebuild");
      fts.purgeAll(Creative.class);
      for (int firstResult = 0; firstResult < count; firstResult += maxResults)
      {
         List<Creative> creatives = getActiveCreatives(firstResult, maxResults);
         getLogger().info("Re-Indexed " + (creatives.size() + firstResult) + " of " + count + " Creatves");
         index(fts, creatives);
      }
      getLogger().info("Finished Creative Index Rebuild in " + (System.currentTimeMillis() - currentTimeMillis) + "ms");
      fts.flushToIndexes();
      fts.flush();
      fts.clear();

   }


   protected void index(FullTextSession fts, List entities)
   {
      int counter = 0;
      for (Object entity : entities)
      {
         fts.index(entity);
         counter++;
      }
      flushToIndexes(fts);
   }




I have ensured, that there were 3 creatives at all.

edit:*
And it works before i activate the ActiveMQ/HSearch Clustering. Maybe there must be the failure. Or have I to index in a different way?

Thanks,
Simon


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 10:22 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

The backend configuration (single node vs. master/slave) is transparent to the indexing process. Your indexing code looks fine and if you say that it was working before you switched to JMS I would start looking in your ActiveMQ setup.
Not sure what you did before to make this exception disappear, but it sounded like that you just ignoring it. Maybe your problem is there. Have you turned debug trace on?

--Hardy


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 10:46 am 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Hy Hardy,

yeah debug trace is on for org.hibernate and org.apache.activemq. But I cannot find something useful. Here is some output.

Code:
[DEBUG] [2009-12-08 15:37:32,196] [main] org.hibernate.jdbc.ConnectionManager | transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
[DEBUG] [2009-12-08 15:37:32,196] [main] org.hibernate.event.def.AbstractFlushingEventListener | processing flush-time cascades
[DEBUG] [2009-12-08 15:37:32,196] [main] org.hibernate.event.def.AbstractFlushingEventListener | dirty checking collections
[DEBUG] [2009-12-08 15:37:32,197] [main] org.hibernate.event.def.AbstractFlushingEventListener | Flushed: 0 insertions, 0 updates, 0 deletions to 9 objects
[DEBUG] [2009-12-08 15:37:32,197] [main] org.hibernate.event.def.AbstractFlushingEventListener | Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[DEBUG] [2009-12-08 15:37:32,197] [main] org.hibernate.pretty.Printer | listing entities:
[DEBUG] [2009-12-08 15:37:32,199] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=1, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=left_top, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,199] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=7, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=right_top, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,200] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=8, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=right_middle, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,200] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=2, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=left_middle, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,200] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=3, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=left_bottom, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,200] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=5, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=center_middle, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,202] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=4, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=center_top, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,203] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=6, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=center_bottom, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,203] [main] org.hibernate.pretty.Printer | de.tempodome.adserver.core.creative.Placement{id=9, creationDate=2009-11-30 15:18:54, height=200, description=null, width=200, name=right_bottom, modificationDate=2009-11-30 15:18:54}
[DEBUG] [2009-12-08 15:37:32,203] [main] org.hibernate.jdbc.ConnectionManager | releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
[DEBUG] [2009-12-08 15:37:32,203] [main] org.hibernate.jdbc.ConnectionManager | transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
[INFO] [2009-12-08 15:37:32,204] [main] de.tempodome.adserver.webapp.InitDatabaseListener | Finished Initialization of Database
08.12.2009 15:37:32 org.apache.activemq.broker.BrokerService getBroker
INFO: ActiveMQ null JMS Message Broker (localhost) is starting
08.12.2009 15:37:32 org.apache.activemq.broker.BrokerService getBroker
INFO: For help or more information please see: http://activemq.apache.org/
08.12.2009 15:37:32 org.apache.activemq.store.amq.AMQPersistenceAdapter start
INFO: AMQStore starting using directory: /Users/simjac/10-Projekte/AdServer/Servers/Tomcat v6.0 Server at localhost-config/jms/data/localhost
08.12.2009 15:37:32 org.apache.activemq.kaha.impl.KahaStore initialize
INFO: Kaha Store using data directory /Users/simjac/10-Projekte/AdServer/Servers/Tomcat v6.0 Server at localhost-config/jms/data/localhost/kr-store/state
08.12.2009 15:37:32 org.apache.activemq.store.amq.AMQPersistenceAdapter start
INFO: Active data files: [1]
08.12.2009 15:37:32 org.apache.activemq.broker.BrokerService start
INFO: Using Persistence Adapter: AMQPersistenceAdapter(/Users/simjac/10-Projekte/AdServer/Servers/Tomcat v6.0 Server at localhost-config/jms/data/localhost)
08.12.2009 15:37:33 org.apache.activemq.kaha.impl.KahaStore initialize
INFO: Kaha Store using data directory /Users/simjac/10-Projekte/AdServer/Servers/Tomcat v6.0 Server at localhost-config/jms/data/localhost/kr-store/data
08.12.2009 15:37:33 org.apache.activemq.broker.jmx.ManagementContext$1 run
INFO: JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
08.12.2009 15:37:33 org.apache.activemq.transport.TransportServerThreadSupport doStart
INFO: Listening for connections at: tcp://Macsuppe.local:61616
08.12.2009 15:37:33 org.apache.activemq.broker.TransportConnector start
INFO: Connector tcp://Macsuppe.local:61616 Started
08.12.2009 15:37:33 org.apache.activemq.broker.BrokerService start
INFO: ActiveMQ JMS Message Broker (localhost, ID:Macsuppe.local-54524-1260283052842-0:0) started
08.12.2009 15:37:33 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'springweb'
[Deprecated] Xalan: org.apache.xpath.CachedXPathAPI
08.12.2009 15:37:35 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
[DEBUG] [2009-12-08 15:37:35,759] [http-8080-1] org.hibernate.impl.SessionImpl | opened session at timestamp: 12602830557
08.12.2009 15:37:35 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
08.12.2009 15:37:35 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/34  config=null
08.12.2009 15:37:35 org.apache.catalina.startup.Catalina start
INFO: Server startup in 12968 ms



For me, it seems, that activeMQ stores the data inside the given folder. I found there a lot of files, which contains classnames of entities, that I want to index.

My way to hide the NullPointerExceptions from the post above:

In the subclass of AbstractJMSHibernateSearchController (in relation to https://www.hibernate.org/421.html) I set the subclass as messageListener to the javax.jms.Session. If I do not so, I will get a NullPointerException, because the code to set the MessageListener to the consumer will be access the messageListener of the Session.

This is what I mean:
Code:
   public void connect()
   {
      Context initCtx;
      try
      {
         initCtx = new InitialContext();
             // Look up for connection factory & create connection, session
       ConnectionFactory connectionFactory = (ConnectionFactory) initCtx.lookup("java:comp/env/jms/ConnectionFactory");       
       Connection connection = connectionFactory.createConnection();
       connection.start();
       javax.jms.Session session = connection.createSession(true, 0);

       //HERE I HAVE SET THE SUBCLASS OF AbstractJMSHibernateSearchController TO THE javax.jms.Session
       session.setMessageListener(this);
       
       // Look up for destination and set listner
       Queue queue = (Queue) initCtx.lookup("java:comp/env/queue/hibernatesearch");
       MessageConsumer consumer = session.createConsumer(queue);
       

          //HERE THE NULLPOINTEREXCEPTION WILL BE THROWN IF NO MESSAGELISTENER IS DEFINED TO THE SESSION!
       consumer.setMessageListener(this);
      }
      catch (NamingException e)
      {
//         Logger.getLogger(getClass()).error("" , e);
         throw new TechnicalException(e);
         
      }
      catch (JMSException e)
      {
//         Logger.getLogger(getClass()).error("" , e);
         throw new TechnicalException(e);
      }

   }


This method will be executed by a startup Listener (also described in 412.html), which will start the broker and then call the "connect" function.

I now see:

Sometimes and not often this Exception will be thrown:

Code:
08.12.2009 15:47:33 org.apache.activemq.ActiveMQConnection onAsyncException
WARNUNG: Async exception with no exception listener: java.io.EOFException
java.io.EOFException
   at java.io.DataInputStream.readInt(DataInputStream.java:375)
   at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:268)
   at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:192)
   at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:184)
   at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:172)
   at java.lang.Thread.run(Thread.java:637)


Maybe there is a relation. Maybe not.

I use java 6 and tomcat 6.


Thanks,
Simon


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 12:03 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi Simon,

I think you should back to the point where the NullPointerException was thrown. Looking at the stack trace you can see that onMessage is properly called in this case. This is what you want. The NullPointerException seems to originate from the fact that your Hibernate Session is null. Have you confirmed that AbstractJMSHibernateSearchController.getSession() is returning a proper Hibernate Session?

--Hardy


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 12:32 pm 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Hy Hardy,

propable you`re right. No there is no HibernateSession given in this method.

Where should I take it from in tomcat container? If I try to get it from the DAO I get this Exception :(

Code:
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here


Thanks a lot,
Simon


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Tue Dec 08, 2009 2:22 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Ahh, that's your problem then. The session is not needed to access the databse, but rather needed to read all the relevant Hibernate Search configuration.
There are many ways to create the session. You could do it programmatically in the getSession() method, but probably it would be easier to use some sort of injection or other form of bootstrapping. In an web application you normally have some sort of startup listener bootstrapping Hibernate and then giving access to the Session via eg a HibernateUtil class. Or in case you are using Spring as well you could use the Spring way of bootstrapping Hibernate.
How do you bootstrap Hibernate in your Slave web app? Just to the same in the master webapp and make sure you return a valid session for getSession().

--Hardy


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Wed Dec 09, 2009 6:24 am 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Alright,

I will now inject a sessionFactory inside the AbstractJMSHibernateSearchController Implementation. It is now a spring bean. So I could get it through the applicationContext.

That`s how it looks:

Code:
   /* (non-Javadoc)
    * @see org.hibernate.search.backend.impl.jms.AbstractJMSHibernateSearchController#getSession()
    */
   @Override
   protected Session getSession()
   {
         return sessionFactory.openSession();
   }
   


There are no more Exceptions at all. All seems fine. Unfortunately the index will not be updated. Same problem as before.

During the index rebuild process I get millions of millions of these debug message:

Code:
[DEBUG] [2009-12-09 11:14:29,219] [ActiveMQ Session Task] org.hibernate.impl.SessionImpl | opened session at timestamp: 12603536692


I think that occurs, because I have to open a new Session inside the getSession Method. Not so fine, but I think also not so bad. I will think about a smarter solution, if the code runs fine.

And sometimes this Exception will be thrown:

Code:
09.12.2009 11:14:29 org.apache.activemq.ActiveMQConnection onAsyncException
WARNUNG: Async exception with no exception listener: java.net.SocketException: Socket closed
java.net.SocketException: Socket closed
   at java.net.SocketInputStream.socketRead0(Native Method)
   at java.net.SocketInputStream.read(SocketInputStream.java:129)
   at org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
   at org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
   at java.io.DataInputStream.readInt(DataInputStream.java:370)
   at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:268)
   at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:192)
   at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:184)
   at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:172)
   at java.lang.Thread.run(Thread.java:637)



Well, for me it looks, that all changes run into the queue, but never out. Maybe the listener will not listen well.


Thanks a lot,
Simon


edit*:

Ok. In explanation: I have no different Apps for Master/Slave. It`s the same software. I only want to handle the configuration through properties files inside the server to set up slave or master node. That`s working.

I`am now testing the master node on my local machine. That means, that there is no slave and I only want,

- that the master receives an update-index-comand (dont`t know if it the master receives messages. Think not. But not sure.)
- that the master will update his local index (don`t work)
- that the master will copy the index directory to the configurated shared directory (This runs perfectly)


But I think, this cannot be the reason for my problems.


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Wed Dec 09, 2009 10:35 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

you are running master and slave in the same application? Even in the same JVM?. That sounds odd. How do you make sure that the master and slave see/get the right configuration. Do you have two different property files?

Btw, what is the point of using the JMS setup in within the same application? Unless you mean you have two instances of the application running where one should be the master and the other the slave. In this case you also have to make sure that the right properties are used in the slave resp. master configuration.

--Hardy


Top
 Profile  
 
 Post subject: Re: NameNotFoundException raises for ActiveMQ/HSearch Clustering
PostPosted: Wed Dec 09, 2009 10:41 am 
Newbie

Joined: Mon Dec 07, 2009 1:38 pm
Posts: 11
Location: Hamburg, Germany
Hy,

right, I have two application server. Two physically machines. So also two different properties files. Not the same VM. That would be...strange :). By change it is the same software. Could also be another one.

Regards,
Simon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

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.