Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

zuo liao

Greenhorn
+ Follow
since Oct 11, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by zuo liao

Hi Ricky,

Thanks a lot for your valueable tip. I will try it.

Merry Christmas and happy new year.

George
11 years ago
We use websphere 6.1, fix pack 13 and web service feature pack 13. Now we want to remove web service feature pack 13 and fix pack 13 and update websphere with fix pack 15.

We used wesphere 6.1 19 update installer to uninstall web service feature pack 13 successfully. When we tried to install fix pack 15, we got:
prerequistie checking has failed.
The package associate with package name 6.1.1-WS-WAS-Linux32-FP0000015 requires following products to be upgraded to version 6.1.0.15. Otherwise, these depending products may not work properly.
IBM WebSphere Applicatior Server 6.1 Feature Pack for Web Services.

I attach the versionInfo output.

Do we need to install webservice feature pack 15 before update fixpack from 13 to 15?

We also tried to uninstall fix 13, but it didn't allow us to uninstall. We got: the package 6.1.0.13-WS-WASFeature-EP0000013 requires IBM Web Application Server fixpack with version equal to 6.1.0.13

Any idea? Thanks in advance.
11 years ago
Thanks,Edvins. You are right.

I find this: When configure() is called, Hibernate searches for a file named hibernate.cfg.xml in the root of the classpath
I have a jar(common.jar) file which will be used by all the J2EE applications. I put it under WebSphere\AppServer\lib\ext folder. The common.jar uses log4j.

If we have J2EE application which also use log4j, it has its own log4j.properties. Will log4j.properties in common.jar affect log4j.properties in the J2EE application? Thanks
I have a jar(common.jar) file which will be used by all the J2EE applications. I put it under WebSphere\AppServer\lib\ext folder. The hibernate.cfg.xml is in common.jar.

If we have J2EE application which also use hibernate, it has its own hibernate.cfg.xml. Will hibernate.cfg.xml in common.jar affect hibernate.cfg.xml in the J2EE application? Thanks.
Thanks Mark.


>They have to go hand in hand. a one to one relationship. And you have to make sure you commit your transaction when you want Hibernate to go to the database, when you are done (Well not exactly all the time, but for starting off we will say that). or rollback your transaction if an exception occurs.

>transaction.commit(); or transaction.rollback();


My code works without using jndi for the transaction:

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();

I do use transaction.commit(); and transaction.rollback();
Hi Paul,

Thanks for your reply.

//This statement is OK.
Session session=HibernateUtil.getSessionFactory().getCurrentSession();

//I get "save is not valid without active transaction" error.
session.save(extranetUserH);

George
I use hibernate3.2, oracle9.2 and websphere 5.1. After I try to configure jndi for the sessionfactory I get the error:

[10/11/07 10:07:33:212 EDT] 75667566 SessionFactor I org.hibernate.impl.SessionFactoryImpl building session factory
[10/11/07 10:07:33:961 EDT] 75667566 SessionFactor I org.hibernate.impl.SessionFactoryObjectFactory Factory name: java:comp/HibernateSessionFactory
[10/11/07 10:07:33:961 EDT] 75667566 NamingHelper I org.hibernate.util.NamingHelper JNDI InitialContext properties:{}
[10/11/07 10:07:33:961 EDT] 75667566 SessionFactor I org.hibernate.impl.SessionFactoryObjectFactory Bound factory to JNDI name: java:comp/HibernateSessionFactory
[10/11/07 10:07:33:961 EDT] 75667566 SessionFactor W org.hibernate.impl.SessionFactoryObjectFactory InitialContext did not implement EventContext[10/11/07 10:08:31:814 EDT] 75667566 SystemOut O !!!Error from HibernateUserDAO.setUserBean :save is not valid without active transaction

The followings are related files:

*hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>

<property name="hibernate.session_factory_name">
java:comp/HibernateSessionFactory
</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereTransactionManagerLookup
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>


<property name="hibernate.connection.datasource">
jdbc/NA_DEV1
</property>



* HibernateUtil.java:
public static SessionFactory getSessionFactory() {
String sfName = configuration.getProperty(Environment.SESSION_FACTORY_NAME);
if ( sfName != null) {
//log.debug("Looking up SessionFactory in JNDI");
try {
return (SessionFactory) new InitialContext().lookup(sfName);
} catch (NamingException ex) {
throw new RuntimeException(ex);
}
} else if (sessionFactory == null) {
rebuildSessionFactory();
}
return sessionFactory;
}

...

*My code
public static void setUserBean(ExtranetUserH extranetUserH
) throws Exception {

UserTransaction tx = null;

try {

tx = (UserTransaction) new InitialContext()
.lookup("java:comp/UserTransaction");

tx.begin();


//get save is not valid without active transaction at below statement

HibernateUtil.getSessionFactory().getCurrentSession().save(extranetUserH);

tx.commit();
} catch (Exception e) {
....


The code works without using jndi for sessionfactory. Thanks in advance.

George