ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » StandAlone Java App on Solaris using Oracle XA

Post new topic  Reply to topic
 StandAlone Java App on Solaris using Oracle XA « View previous topic :: View next topic » 
Author Message
fdouek
PostPosted: Wed Jul 17, 2002 5:30 pm    Post subject: StandAlone Java App on Solaris using Oracle XA Reply with quote

Newbie

Joined: 17 Jul 2002
Posts: 4
Location: Brazil

Hi,
I have a very big problem.
I develop a simple application to get an message and insert on Oracle database, using Two Phase Commit. MQ are the coordinator.

SO: Solaris 2.7
API: MA88
Database: Oracle 8.1.7
MQ Version: 5.2

When I run one instance of process (on solaris), works fine.
When I start an second instance (on solaris), occur an error described bellow.
PS: If I start two instances on windows 2000 works fine.

My code
=====
import com.ibm.mq.*;
import java.util.*;
import java.sql.*;
import oracle.jdbc.xa.client.*;

public class Test {
public static void main(String[] args) {
Test mt = new Test();
mt.execute();

}


public void execute() {
MQQueueManager mm=null;
try {
System.out.println("inicia");
//teste para ver se carrega as classes:
Class mag = Class.forName("com.ibm.mq.MQQueueManager").getClassLoader().loadClass("com.ibm.mq.MQQueueManager");
Class magm = Class.forName("com.ibm.mq.MQSESSION").getClassLoader().loadClass("com.ibm.mq.MQSESSION");
System.out.println("fim " + mag);
System.out.println("fim " + magm);
//teste para ver se faz a conexao:
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
Hashtable ht = new Hashtable();
ht.put("MQC.TRANSPORT_PROPERTY", "MQC.TRANSPORT_MQSERIES_BINDINGS"); //"MQC.TRANSPORT_MQSERIES_CLIENT");
ht.put("MQC.PASSWORD_PROPERTY", "mqmpassword");
ht.put("MQC.USER_ID_PROPERTY", "mqmuser");

mm = new MQQueueManager("QM_TEST", ht);
OracleXADataSource oxa = new OracleXADataSource();
oxa.setURL("jdbc:oracle:thin:@10.10.10.1:1521:orcl");
oxa.setUser("username");
oxa.setPassword("password");
oxa.setDatabaseName("10.10.10.1:1521:orcl");
java.sql.Connection cAux = mm.getJDBCConnection(oxa);

System.out.println("end " + cAux);
System.out.println("end " + mm);


int options = MQC.MQOO_INPUT_SHARED | MQC.MQOO_OUTPUT;
MQQueue queue = mm.accessQueue("MYQUEUE",
options,
"QM_TEST",
null,
null);


MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.waitInterval = MQC.MQWI_UNLIMITED;
gmo.options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT;
MQMessage retrievedMessage = new MQMessage();


while (true) {
mm.begin();
retrievedMessage.clearMessage();
retrievedMessage.correlationId = MQC.MQCI_NONE;
retrievedMessage.messageId=MQC.MQMI_NONE;

System.out.println("Aguardando msg");
queue.get(retrievedMessage, gmo);
String msgText = retrievedMessage.readString(retrievedMessage.getMessageLength());
System.out.println("the message: " + msgText);

System.out.println("the end of the get");

Statement stt = cAux.createStatement();
String query = "insert into testefabio values('" + msgText + "')";
int i = stt.executeUpdate(query);
System.out.println();
mm.commit();
}
} catch(Exception e) {
try {
mm.backout();
}
catch (Exception ex) {
System.out.println("Erro no rollback" + ex.getMessage());
}
e.printStackTrace();
}
}


}




Error on client
=========
MQJE001: Completion Code 2, Reason 2195
MQJE001: Completion Code 2, Reason 2009
Erro no rollbackMQJE001: Completion Code 2, Reason 2009
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2195
at com.ibm.mq.MQQueueManager.commit(MQQueueManager.java:905)
at Test.execute(Test.java:74)
at Test.main(Test.java:9)


Error on MQ server (log)
================

07/17/02 22:47:48
AMQ7605: The XA resource manager smstar has returned an unexpected return code
-3, when called for xa_prepare.

EXPLANATION:
MQSeries received an unexpected return code when calling XA resource manager
smstar at its xa_prepare entry point. This indicates an internal error, either
within MQSeries or the resource manager.
ACTION:
Try to determine the source of the error. A trace of the failure could be used
to look at the XA flows between MQSeries and the resource manager. MQSeries
has allocated an RMId of 1 to this resource manager. This will be useful when
isolating the flows associated with the resource manager concerned. If the
error occurs on an xa_commit or xa_rollback request, the queue manager will not
attempt to redeliver the commit or rollback instruction for this transaction,
until after the queue manager has been restarted. The transaction indoubt is
identified by the following XID of
X'004D514D0000000E000000043D360B1800032012514D5F534D5300000001'. If you think
that the error lies within the queue manager, contact your IBM support center.
Do not discard any information describing the problem until after the problem
has been resolved.
-------------------------------------------------------------------------------
07/17/02 22:47:48
AMQ6184: An internal MQSeries error has occurred on queue manager QM_SMS.

EXPLANATION:
An error has been detected, and the MQSeries error recording routine has been
called. The failing process is process 22317.
ACTION:
Use the standard facilities supplied with your system to record the problem
identifier, and to save the generated output files. Contact your IBM support
center. Do not discard these files until the problem has been resolved.
-------------------------------------------------------------------------------
_________________
Fabio Douek
Back to top
View user's profile Send private message
fdouek
PostPosted: Thu Jul 18, 2002 6:33 pm    Post subject: This problem have been solved Reply with quote

Newbie

Joined: 17 Jul 2002
Posts: 4
Location: Brazil

Hi,

This problem have been solved.
On qm.ini I configured to Oracle Resources to work with thread (no process).
_________________
Fabio Douek
Back to top
View user's profile Send private message
kamy
PostPosted: Tue Jul 23, 2002 5:26 am    Post subject: Reply with quote

Novice

Joined: 26 Oct 2001
Posts: 21

Hi ,
We are trying to build a similar adpter Java /JMS using Oracle as the Database,
I could successfullly test / run my code on Windows 2000 queue manager..(Test environment)
I am unable to compile the switch file comes as part of MQ Installation on Solaris..
I am getting the following error

make: Fatal error: Command failed for target `ora8swit'
mexi2015:u000734$ make -f $HOME/newswit.mak ora8swit
gcc -G -e MQStart -R /oracle/product/8.1.7/lib -L /oracle/product/8.1.7/lib -lcl
ntsh /oracle/product/8.1.7/lib/scorept.o /oracle/product/8.1.7/lib/sscoreed.o /o
racle/product/8.1.7/rdbms/lib/kpudfo.o -lsql8 /oracle/product/8.1.7/rdbms/lib/kp
uadef.o `cat /oracle/product/8.1.7/lib/ldflags` -lnsgr8 -lnzjs8 -ln8 -lnl8 -lnr
o8 `cat /oracle/product/8.1.7/lib/ldflags` -lnsgr8 -lnzjs8 -ln8 -lnl8 -lclient8
-lvsn8 -lwtc8 -lcommon8 -lgeneric8 -lwtc8 -lmm -lnls8 -lcore8 -lnls8 -lcore8
-lnls8 `cat /oracle/product/8.1.7/lib/ldflags` -lnsgr8 -lnzjs8 -ln8 -lnl8 -lnro8
`cat /oracle/product/8.1.7/lib/ldflags` -lnsgr8 -lnzjs8 -ln8 -lnl8 -lclient8 -
lvsn8 -lwtc8 -lcommon8 -lgeneric8 -lpls8 -ltrace8 -lnls8 -lcore8 -lnls8 -lcore8
-lnls8 -lclient8 -lvsn8 -lwtc8 -lcommon8 -lgeneric8 -lnls8 -lcore8 -lnls8 -
lcore8 -lnls8 `cat /oracle/product/8.1.7/lib/sysliblist` -R/oracle/product/8.
1.7/lib -laio -lm -l clntsh -l m -o ora8swit oraswit.c
gcc: clntsh: No such file or directory
gcc: m: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `ora8swit'


I was wondering if you could shares some tricks /tips ..

thx
- kamy
Back to top
View user's profile Send private message Send e-mail
ceritnl
PostPosted: Wed Jul 30, 2003 10:51 pm    Post subject: Reply with quote

Newbie

Joined: 30 Jul 2003
Posts: 3
Location: Amsterdam

Regarding compilation of jdbc switch:

Don't change the makefile (completely). All you have to this is set the path to the Oracle lib dir and the Java (j2se) lib/sparc dir. Compilation should then work as designed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » StandAlone Java App on Solaris using Oracle XA
Jump to:  



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
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.