aspose file tools*
The moose likes JBoss/WildFly and the fly likes jboss arjuna transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "jboss arjuna transactions" Watch "jboss arjuna transactions" New topic
Author

jboss arjuna transactions

raj kiran
Greenhorn

Joined: Jul 13, 2006
Posts: 4
hi,

i use the jboss arjuna api for standolone application i got the runtime error. my code is,

import java.util.*;
import java.sql.*;
import javax.sql.*;
import com.arjuna.ats.jta.*;
import com.arjuna.ats.jta.UserTransaction.*;
import com.arjuna.ats.*;
import com.arjuna.ats.jdbc.TransactionalDriver;
import javax.transaction.*;
import com.arjuna.ats.jta.TransactionManager;
import com.arjuna.ats.jdbc.common.jdbcPropertyManager.*;
import com.arjuna.ats.jdbc.TransactionalDriver.*;

public class JDBCTest
{
public static void main (String[] args) throws Exception
{
Properties p = System.getProperties();
p.put("jdbc.drivers", "oracle.jdbc.driver.OracleDriver");
System.setProperties(p);

try
{
DriverManager.registerDriver(new com.arjuna.ats.jdbc.TransactionalDriver());
}
catch (Exception e)
{
e.printStackTrace();
System.exit(0);
}
Connection conn = null;
Connection conn2 = null;
Statement stmt = null;
Statement stmtx = null;
String url ="jdbc racle:thin:@192.168.0.230:1521:sevenora";
Properties dbProperties = new Properties();
try
{

System.out.println("\nCreating connection to database: "+url);
dbProperties.put(TransactionalDriver.userName, "scott");
dbProperties.put(TransactionalDriver.password, "tiger");
dbProperties.put(TransactionalDriver.dynamicClass,"com.arjuna.ats.internal.jdbc.drivers.oracle_8_1_6");
conn = DriverManager.getConnection(url, dbProperties);
conn2 = DriverManager.getConnection(url, dbProperties);
stmt = conn.createStatement();
try
{
stmt.executeUpdate("DROP TABLE test_table");
stmt.executeUpdate("DROP TABLE test_table2");
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
stmt.executeUpdate("CREATE TABLE test_table(a INTEGER,b INTEGER)");
stmt.executeUpdate("CREATE TABLE test_table2(a INTEGER,b INTEGER)");
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
System.out.println("Starting top-level transaction.");
com.arjuna.ats.jta.UserTransaction.userTransaction().begin();
stmtx = conn.createStatement();
System.out.println("\nAdding entries to table 1.");
stmtx.executeUpdate("INSERT INTO test_table (a, b) VALUES(1,2) ");
ResultSet res1 = null;
System.out.println("\nInspecting table 1.");
res1 = stmtx.executeQuery("SELECT * FROM test_table");
while (res1.next())
{
System.out.println("Column 1: "+res1.getInt(1));
System.out.println("Column 2: "+res1.getInt(2));
}
System.out.println("\nAdding entries to table 2.");
stmtx.executeUpdate("INSERT INTO test_table2 (a, b) VALUES (3,4)");
res1 = stmtx.executeQuery("SELECT * FROM test_table2");
System.out.println("\nInspecting table 2.");
while (res1.next())
{
System.out.println("Column 1: "+res1.getInt(1));
System.out.println("Column 2: "+res1.getInt(2));
}
System.out.print("\nNow attempting to rollback changes.");
com.arjuna.ats.jta.UserTransaction.userTransaction().rollback();
com.arjuna.ats.jta.UserTransaction.userTransaction().begin();
stmtx = conn.createStatement();
ResultSet res2 = null;
System.out.println("\nNow checking state of table 1.");
res2 = stmtx.executeQuery("SELECT * FROM test_table");
while (res2.next())
{
System.out.println("Column 1: "+res2.getInt(1));
System.out.println("Column 2: "+res2.getInt(2));
}
System.out.println("\nNow checking state of table 2.");
stmtx = conn.createStatement();
res2 = stmtx.executeQuery("SELECT * FROM test_table2");
while (res2.next())
{
System.out.println("Column 1: "+res2.getInt(1));
System.out.println("Column 2: "+res2.getInt(2));
}
//UserTransaction.transactionManager().commit(true);
com.arjuna.ats.jta.UserTransaction.userTransaction().commit();
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(0);
}
}
catch (Exception sysEx)
{
sysEx.printStackTrace();
System.exit(0);
}
}
}

runtime error is,

Exception in thread "main" java.lang.NoClassDefFoundError: com/arjuna/common/uti
l/propertyservice/PropertyManagerFactory
at com.arjuna.ats.jdbc.common.jdbcPropertyManager.<clinit>(jdbcPropertyM
anager.java:58)
at com.arjuna.ats.jdbc.logging.jdbcLogger.<clinit>(jdbcLogger.java:54)
at com.arjuna.ats.jdbc.TransactionalDriver.<init>(TransactionalDriver.ja
va:72)
at com.arjuna.ats.jdbc.TransactionalDriver.<clinit>(TransactionalDriver.
java:159)
at JDBCTest.main(JDBCTest.java:23)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

java.lang.NoClassDefFoundError: com/arjuna/common/util/propertyservice/PropertyManagerFactory


Looks like a classpath issue. Do you have the appropriate jars required for Arjuna transactions in your classpath?


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jboss arjuna transactions