You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by jschoudt <js...@gmail.com> on 2012/06/14 19:03:41 UTC

Default JMS Persistence fails on restart if messages are left in a queue

Hi all,

I'm using tomee plus (I've tried 1.0.0 plus and 1.0.1 plus snashot from June
7) and I'm seeing an issue.  Before I open a bug, I thought I'd ask and see
if anyone has a workaround or has reported this issue (I searched and didn't
find it).  I'd rather not re-configure tomee to use some other datasource
for persistence, I like the built-in one especially while I'm developing and
testing.

I have a JMS queue in my application that I use to send/process textmessages
and if I shutdown/restart tomee while there are messages in the queue they
get persisted, but then when the server starts I get the following error and
the ActiveMQ JMS Broker fails to start.

WARNING: JDBC Failure: incompatible data type in conversion: from SQL type
OTHER to [B, value: instance of org.hsqldb.types.JavaObjectData
java.sql.SQLSyntaxErrorException: incompatible data type in conversion: from
SQL type OTHER to [B, value: instance of org.hsqldb.types.JavaObjectData
	at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
	at org.hsqldb.jdbc.Util.throwError(Unknown Source)
	at org.hsqldb.jdbc.JDBCResultSet.getColumnInType(Unknown Source)
	at org.hsqldb.jdbc.JDBCResultSet.getBytes(Unknown Source)
	at
org.apache.commons.dbcp.DelegatingResultSet.getBytes(DelegatingResultSet.java:241)
	at
org.apache.commons.dbcp.DelegatingResultSet.getBytes(DelegatingResultSet.java:241)
	at
org.apache.activemq.store.jdbc.adapter.BytesJDBCAdapter.getBinaryData(BytesJDBCAdapter.java:38)
	at
org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doGetMessageById(DefaultJDBCAdapter.java:194)
	at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getLastMessageBrokerSequenceId(JDBCPersistenceAdapter.java:234)
	at
org.apache.activemq.broker.region.DestinationFactoryImpl.getLastMessageBrokerSequenceId(DestinationFactoryImpl.java:145)
	at
org.apache.activemq.broker.region.RegionBroker.<init>(RegionBroker.java:122)
	at
org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1833)
	at
org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1824)
	at
org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1781)
	at
org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:766)
	at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:296)
	at org.apache.activemq.broker.BrokerService.start(BrokerService.java:493)
	at
org.apache.openejb.resource.activemq.ActiveMQ5Factory$1.run(ActiveMQ5Factory.java:126)
Caused by: org.hsqldb.HsqlException: incompatible data type in conversion:
from SQL type OTHER to [B, value: instance of
org.hsqldb.types.JavaObjectData
	at org.hsqldb.error.Error.error(Unknown Source)
	at org.hsqldb.error.Error.error(Unknown Source)
	... 16 more



Here's some sample code to reproduce the problem.  Put this class in an
otherwise empty web app:

package org.jschoudt.test;

import javax.annotation.Resource;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class ConfigListener implements ServletContextListener {

	@Resource
	ConnectionFactory cf;

	@Resource(name = "somequeue")
	Queue queue;

	public ConfigListener() {}

	public void contextInitialized(ServletContextEvent event) {
		Connection conn = null;
		Session session = null;
		MessageProducer messageProducer = null;
		try {
			conn = cf.createConnection();
			conn.start();
			session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
			messageProducer = session.createProducer(queue);
			Message m = session.createTextMessage("{'foo':'bar'}");
			messageProducer.send(m);
			event.getServletContext().log("Message sent");
		} catch (Exception e) {
			event.getServletContext().log("Error sending message", e);
		} finally {
			if (messageProducer != null) {
				try {
					messageProducer.close();
				} catch (JMSException e) {
					event.getServletContext().log(
							"Error closing messageProducer", e);
				}
			}
			if (session != null) {
				try {
					session.close();
				} catch (JMSException e) {
					event.getServletContext().log("Error closing session", e);
				}
			}
			if (conn != null) {
				try {
					conn.close();
				} catch (JMSException e) {
					event.getServletContext()
							.log("Error closing connection", e);
				}
			}
		}

	}

	public void contextDestroyed(ServletContextEvent event) {}

}


--
View this message in context: http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart-if-messages-are-left-in-a-queue-tp4655619.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Default JMS Persistence fails on restart if messages are left in a queue

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
I refer you to:

http://openejb.apache.org/mailing-lists.html


Regards,
Alan

 
On Jun 17, 2012, at 7:10 PM, Robin wrote:

> Please Remove me from the e-mail list.
> Thank You
> Robin
> 
> -----Original Message-----
> From: AndyG [mailto:andy.gumbrecht@orprovision.com] 
> Sent: Friday, June 15, 2012 3:08 AM
> To: users@openejb.apache.org
> Subject: Re: Default JMS Persistence fails on restart if messages are left
> in a queue
> 
> Please create a jira (then post it here) and I will have a look at it. In
> the mean time could you please try the latest release of Derby. I know you
> don't want to, but it would really help to know if this a database issue.
> 
> http://db.apache.org/derby/derby_downloads.html
> 
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart
> -if-messages-are-left-in-a-queue-tp4655619p4655631.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
> 


RE: Default JMS Persistence fails on restart if messages are left in a queue

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: AndyG [mailto:andy.gumbrecht@orprovision.com] 
Sent: Friday, June 15, 2012 3:08 AM
To: users@openejb.apache.org
Subject: Re: Default JMS Persistence fails on restart if messages are left
in a queue

Please create a jira (then post it here) and I will have a look at it. In
the mean time could you please try the latest release of Derby. I know you
don't want to, but it would really help to know if this a database issue.

http://db.apache.org/derby/derby_downloads.html

--
View this message in context:
http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart
-if-messages-are-left-in-a-queue-tp4655619p4655631.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


RE: Default JMS Persistence fails on restart if messages are left in a queue

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin
-----Original Message-----
From: jschoudt [mailto:jschoudt@gmail.com] 
Sent: Friday, June 15, 2012 11:35 AM
To: users@openejb.apache.org
Subject: Re: Default JMS Persistence fails on restart if messages are left
in a queue

https://issues.apache.org/jira/browse/TOMEE-233

I have no problem helping test the issue with another db.  I'm happy to
help.  Sorry if I seemed to imply that I wouldn't.

I'll post derby results here once I have time to test it.

--
View this message in context:
http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart
-if-messages-are-left-in-a-queue-tp4655619p4655650.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


RE: Default JMS Persistence fails on restart if messages are left in a queue

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: AndyG [mailto:andy.gumbrecht@orprovision.com] 
Sent: Saturday, June 16, 2012 9:15 AM
To: users@openejb.apache.org
Subject: Re: Default JMS Persistence fails on restart if messages are left
in a queue

Ok, that was kind of what I was expecting looking at the stacktrace. This
means that the bug is either in the ActiveMQ version or the HSQLDB version.
It is not going to be fixable from an OpenEJB perspective other than playing
with the distributed versions.

It would still be good if you could post a JIRA here
https://issues.apache.org/jira/browse/OPENEJB and also here
https://issues.apache.org/jira/browse/AMQ 

I know it is sometimes a hassle to register just to post an issue, so if you
like I can create them for you - Just let me know here.

Just for your info, I have a feeling for what the issue may be. Have a look
at the source here
http://www.docjar.org/html/api/org/activemq/store/jdbc/adapter/BytesJDBCAdap
ter.java.html
and you can see that it is calling rs.getBytes(index) - This is failing, but
accessing the data via getBlob seems to work.

--
View this message in context:
http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart
-if-messages-are-left-in-a-queue-tp4655619p4655659.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


RE: Default JMS Persistence fails on restart if messages are left in a queue

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: AndyG [mailto:andy.gumbrecht@orprovision.com] 
Sent: Saturday, June 16, 2012 10:38 AM
To: users@openejb.apache.org
Subject: Re: Default JMS Persistence fails on restart if messages are left
in a queue

I have just run and upgraded the hsqldb version in trunk to 2.2.8 (from
2.2.4). You could download hsqldb 2.2.8 and see if it works, but i have no
idea if there has been a specific fix. Just worth a try I guess.

--
View this message in context:
http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart
-if-messages-are-left-in-a-queue-tp4655619p4655660.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Default JMS Persistence fails on restart if messages are left in a queue

Posted by AndyG <an...@orprovision.com>.
I have just run and upgraded the hsqldb version in trunk to 2.2.8 (from
2.2.4). You could download hsqldb 2.2.8 and see if it works, but i have no
idea if there has been a specific fix. Just worth a try I guess.

--
View this message in context: http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart-if-messages-are-left-in-a-queue-tp4655619p4655660.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Default JMS Persistence fails on restart if messages are left in a queue

Posted by AndyG <an...@orprovision.com>.
Ok, that was kind of what I was expecting looking at the stacktrace. This
means that the bug is either in the ActiveMQ version or the HSQLDB version.
It is not going to be fixable from an OpenEJB perspective other than playing
with the distributed versions.

It would still be good if you could post a JIRA here
https://issues.apache.org/jira/browse/OPENEJB and also here
https://issues.apache.org/jira/browse/AMQ 

I know it is sometimes a hassle to register just to post an issue, so if you
like I can create them for you - Just let me know here.

Just for your info, I have a feeling for what the issue may be. Have a look
at the source here
http://www.docjar.org/html/api/org/activemq/store/jdbc/adapter/BytesJDBCAdapter.java.html
and you can see that it is calling rs.getBytes(index) - This is failing, but
accessing the data via getBlob seems to work.

--
View this message in context: http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart-if-messages-are-left-in-a-queue-tp4655619p4655659.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: Default JMS Persistence fails on restart if messages are left in a queue

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: jschoudt [mailto:jschoudt@gmail.com] 
Sent: Friday, June 15, 2012 12:10 PM
To: users@openejb.apache.org
Subject: Re: Default JMS Persistence fails on restart if messages are left
in a queue

I tested with derby and put the results in the JIRA.

Summary:  The problem does not occur with derby.

--
View this message in context:
http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart
-if-messages-are-left-in-a-queue-tp4655619p4655654.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Default JMS Persistence fails on restart if messages are left in a queue

Posted by jschoudt <js...@gmail.com>.
I tested with derby and put the results in the JIRA.

Summary:  The problem does not occur with derby.

--
View this message in context: http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart-if-messages-are-left-in-a-queue-tp4655619p4655654.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Default JMS Persistence fails on restart if messages are left in a queue

Posted by jschoudt <js...@gmail.com>.
https://issues.apache.org/jira/browse/TOMEE-233

I have no problem helping test the issue with another db.  I'm happy to
help.  Sorry if I seemed to imply that I wouldn't.

I'll post derby results here once I have time to test it.

--
View this message in context: http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart-if-messages-are-left-in-a-queue-tp4655619p4655650.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Default JMS Persistence fails on restart if messages are left in a queue

Posted by AndyG <an...@orprovision.com>.
Please create a jira (then post it here) and I will have a look at it. In the
mean time could you please try the latest release of Derby. I know you don't
want to, but it would really help to know if this a database issue.

http://db.apache.org/derby/derby_downloads.html

--
View this message in context: http://openejb.979440.n4.nabble.com/Default-JMS-Persistence-fails-on-restart-if-messages-are-left-in-a-queue-tp4655619p4655631.html
Sent from the OpenEJB User mailing list archive at Nabble.com.