[JBoss Messaging] - Missing tables (Oracle)
by HibsMax
Hi, Group.
When I startup my JBoss Server (4.2.0 GA with Messaging 1.3) I find that the following tables are missing from my schema:
HILOSEQUENCES
TIMERS
I believe these tables are supposed to be created at startup.
My colleague did not have this problem with missing tables (we use different schemas / users but the same database instance). Just for a test, I dropped his tables and started my server again. Bingo, my tables are all there. Then he started his server and he started getting the same table or view not found exceptions as I was getting. So, in short, it appears that we cannot start two completely separate JBoss servers using Messaging 1.3 and Oracle with the same database instance (even though we are using separate users). This leads me to believe that when JBoss checks the database for the existence of these tables at startup it casts two wide a net e.g. perhaps the code uses:
select count(*) from all_tables where table_name = 'HILOSEQUENCES'
instead of:
select count(*) from user_tables where table_name = 'HILOSEQUENCES'
Please note, this is just a guess on my part.
I have checked the database users. Neither of them have access to one another's objects via SQL*Plus unless we explicitly prefix each object name with the schema name. In other words, when I am logged in as user1, I cannot see user2's tables and vice versa.
Is this a known limitation / issue? Is there a workaround? I don't believe we should have to use two database instances i.e. one per JBoss.
Thanks, Anders
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065990#4065990
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065990
18Â years, 9Â months
[Messaging, JMS & JBossMQ] - Configuring retry behaviour for an MDB
by ojacobson
Good afternoon.
I'm working my way towards understanding JMS and MDBs and I've encountered a roadblock.
I have a very simple MDB which accepts one message out of X (it cheats on the EJB spect and keeps a per-instance "how many messages have I recieved" count) and "rejects" the rest with context.setRollbackOnly(). When X is large enough, JBoss gives up on re-sending the message before the next "accept message" state comes up and drops the message in the DLQ.
What I want to do is instruct JBoss to retry the message indefinitely, accepting the risk of a poison message blocking any further messages from being processed. If possible I'd also like the retries to be delayed a few seconds, rather than being re-delivered immediately after transaction rollback.
What configuration changes do I need to make to have at least one of those effects?
I have the following dead-simple MDB implementation:
package xxx;
|
| import javax.annotation.Resource;
| import javax.ejb.ActivationConfigProperty;
| import javax.ejb.MessageDriven;
| import javax.ejb.MessageDrivenContext;
| import javax.ejb.TransactionAttribute;
| import javax.ejb.TransactionAttributeType;
| import javax.jms.JMSException;
| import javax.jms.Message;
| import javax.jms.MessageListener;
| import javax.jms.TextMessage;
|
| import org.apache.log4j.Logger;
|
| @MessageDriven(activationConfig = {
| @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
| @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/MDBDemo") })
| public class Receiver implements MessageListener {
| private int count = 0;
| private static final int MODULUS = 100;
|
| private static final Logger log = Logger.getLogger(Receiver.class);
|
| @Resource
| private MessageDrivenContext context;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void onMessage(Message message) {
| log.info("Recieve " + count + " of " + MODULUS);
| boolean accept = count == 0;
|
| count = (count + 1) % MODULUS;
|
| if (accept)
| try {
| log.info("Accepted message: "
| + ((TextMessage) message).getText());
| } catch (JMSException e) {
| log.error("JMX Exception", e);
| context.setRollbackOnly();
| }
| else {
| log.info("Rejecting message.");
| context.setRollbackOnly();
| }
| }
| }
There are no deployment descriptors in the ejb-jar file (neither ejb-jar.xml nor jboss.xml).
There is no MBean descriptor for the queue/MDBDemo Queue.
The message-driven-bean invoker proxy binding in standardjboss.xml has been edited to have MaxTimesRedelivered = 3 instead of the default of 10; this does not appear to have any effect on how many times MDB delivery is attempted before JBoss gives up and sends the message to the DLQ. (Related question: will removing the DLQConfig element entirely accomplish what I want?)
All of this is running under JBoss 4.0.4.GA.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065987#4065987
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065987
18Â years, 9Â months
[Persistence, JBoss/CMP, Hibernate, Database] - Toplink->Hibernate, GenerateSequence Issue
by trouby
Hey,
I am trying to migrate an application from GF that uses Toplin as JPA to Jboss with Hibernate,
I'm still having a confusion of how to generate IDs as generic as possible,
Usually my app is deployed with Oracle 9/10 or Mysql DBs and I'd like to have my application be as generic as possible,
I tried just to use '@Id @GeneratedValue' annotations but with Oracle it just didn't work. so my entities ID get method looked like:
| @Id @GeneratedValue //JB
| @Column(name="MY_ID")
| public Long getMyId() {
| return myId;
| }
|
So, with Toplink, I solved it by using GenerateSequences, which worked fine for Mysql too.
It looked like:
| @Id
| @SequenceGenerator(name="MYTABLE_GEN",sequenceName="MYTABLE_SEQ", allocationSize=1)
| @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="MYTABLE_GEN")
| @Column(name="MY_ID")
| public Long getMyId() {
| return myId;
| }
|
When I tried to deploy my application with Jboss, I got the following exception:
| Caused by: org.hibernate.MappingException: could not instantiate id generator
| at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
| at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
| at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
| at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
| ... 99 more
| Caused by: org.hibernate.MappingException: Dialect does not support sequences
| at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:595)
| at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:65)
| at org.hibernate.id.SequenceHiLoGenerator.configure(SequenceHiLoGenerator.java:43)
| at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:94)
| ... 103 more
|
What am I doing wrong? and most important, what's the best practice of generating regular long IDs in order to support most of the DB vendors? (especially Mysql/Oracle)
Thanks,
Asaf.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065985#4065985
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065985
18Â years, 9Â months