I posted in another discussion about having to remove messages by hand from our oracle db. But now we found the problem behind this necessity.
The context is that we sometimes have to 'DELETE FROM JBM_MSG_REF' when messages still exist in a queue, because when a server tries to start the queue, he fails with:
java.sql.SQLException: Invalid column index
The reason behind this is as follows:
- in the persistence-service.xml (in our case the one for oracle), a SELECT query is defined as:
LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
- in the supported JDBCPersistenceManager in jboss-messaging (version 1_4_6_GA) the following code appears in the method loadFromStart(long, int)
982 | ps = conn.prepareStatement(getSQLStatement("LOAD_UNPAGED_REFS")); |
983 |
|
984 | ps.setFetchSize(number); |
985 |
|
986 | ps.setLong(1, channelID); |
987 |
|
988 | rs = ps.executeQuery(); |
989 |
|
990 | List<ReferenceInfo> refs = new ArrayList<ReferenceInfo>(); |
991 |
|
992 | List<ReferenceInfo> refsToUpdate = new ArrayList<ReferenceInfo>(); |
993 |
|
994 | int count = 0; |
995 | boolean inMemSwitch = false; |
996 | boolean nonPageFlag = true; |
997 | while (rs.next()) |
998 | { |
999 | rs.getObject(4); |
1000 | inMemSwitch = rs.wasNull(); |
1001 | if (nonPageFlag && (!inMemSwitch)) |
1002 | { |
1003 | nonPageFlag = false; |
1004 | } |
I have no idea what the use of 'inMemSwitch' is (it will be ignored because nonPageFlag is always true), or how it is set. But the result of this is that when there are message entries in our queues from a previous run, the startup code for that queue WILL crash (4 > 3).
What am I supposed to do now ? I can't just upgrade because we're under support contract for this version.
Or am I missing something ?
Thanks in advance for any helpful replies !
Tim