Death linked to hibernate JNDI query WebSphere

Operating Environment:
Aix + WebSphere 6.1 + Oracle + Quartz1.65 + Sping2.5.6 + Hibernate 3.3.1
Phenomenon:
Node & Server of WebSphere hanging dead, JVM stack overflow, WebSphere district where the JVM core dump file to be filled
Reasons:
Quartz managed threads running in a state of non-container hosting (from WebSphere control), access to less than a J2EE context, and the use of threads to Hibernete, in trying to java: comp / UserTransaction when JTA inquiries throw NamingException, and Hibernete JTATransactionFactory. the existence of the following java code BUG:
	protected UserTransaction getUserTransaction() {
		log.trace( "Attempting to locate UserTransaction via JNDI [{}]", getUserTransactionName() );

		try {
			UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( getUserTransactionName() );
			if ( ut == null ) {
				throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + getUserTransactionName() +"]" );
			}

			log.trace( "Obtained UserTransaction" );

			return ut;
		}
		catch ( NamingException ne ) {
			throw new TransactionException( "Could not find UserTransaction in JNDI [" + getUserTransaction() + "]", ne );
		}
	}

Which throw new TransactionException ( "Could not find UserTransaction in JNDI [" + getUserTransaction () + "]", according to the author's meaning should be getUserTransactionName () mistakenly written the getUserTransaction () lead to infinite recursive calls

Solutions:
Option 1:
JTATransactionFactory.java rewrite the getUserTransaction () method
Code is as follows
protected UserTransaction getUserTransaction() {
		log.trace( "Attempting to locate UserTransaction via JNDI [{}]", getUserTransactionName() );
		if(uTran != null)
			return uTran;
		try {
			uTran = ( UserTransaction ) getInitialContext().lookup( getUserTransactionName() );
			if ( uTran == null ) {
				uTran = ( UserTransaction ) getInitialContext().lookup( CLIENT_USER_TRANSACTION_NAME );
				if(uTran != null)
					return uTran;
				else
				throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + getUserTransactionName() +"]" );
			}

			log.trace( "Obtained UserTransaction" );

			return uTran;
		}
		catch ( NamingException ne ) {
			try {
				uTran = ( UserTransaction ) getInitialContext().lookup( CLIENT_USER_TRANSACTION_NAME );
			} catch (NamingException e) {
				e.printStackTrace();
			}
			if(uTran != null)
				return uTran;
			else
			throw new TransactionException( "Could not find UserTransaction in JNDI [" + getUserTransactionName() + "]", ne );
		}
	}


Which CLIENT_USER_TRANSACTION_NAME = "jta / usertransaction"

Option 2:
Custom category hibernate.transaction.factory_class
Spring into the use of usertransaction
Heavy getUserTransaction
 protected UserTransaction getUserTransaction() {
    return userTransaction;
   }
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Death linked to hibernate JNDI query WebSphere

  • Hibernate primary key strategy-sequence

    Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...

  • FLEX: integrating Spring + Hibernate

    Before a friend also wanted to study development of FLEX. Asked me to help him to be a small sample. Spent a weekend time, to integrate a sampleproject. Client: FLEX Server: Spring2.5 + Hibernate3.2 + Hibernate-annotations3.3.1 + MySQL5 FDS: BlazeDS3 ...

  • Oracle instant clent for ruby / rails on cygwin

    Environment: XP: oracle full client, ruby, rails, gem cygwin: ruby rails, gem (the version with the XP version) Needs: for cygwin is installed under the rails platform support oci Steps: <1> download oracle instant client (10.2.0.3 Instant Clie ...

  • spring + hibernate + oracle9i to read and write CLOB

    Database-driven update classes12-9i.jar Hibernate modify the configuration of the following code <bean/> <bean Lazy-init="true"> <property name="nativeJdbcExtractor"> <ref local="nativejdbcExtractor" ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.1 ...

  • can not be represented as java.sql.Timestamp

    Development of procedures for the use of hibernate when, some time there is no need to fill in the fields, but after the hibernate query time reported "Java.sql.SQLException: Value'0000-00-00 'can not be represented as java.sql.Timestamp ...

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Based on JDBC, JPA Annotation achieve simple CRUD Generic Dao

    The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq

  • The level Hibernate cache

    Hibernate cache level: (1) a cache is very short and the session life cycle consistent, also known as session-level cache-level cache or transaction-level cache (2) Ways of Supporting level cache: get (); load (); iterator (); only entity object cach ...

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries