-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate.cfg.xml and datasoure problem
PostPosted: Fri Mar 12, 2004 5:38 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2004 4:56 pm
Posts: 29
Hi

I am working on J2EE application. When I add following line to the hibernate.cfg.xml, it works and inserts a record. But when datasource is configured and that JNDI name is mentioned then it gives exceptions posted at the end.

<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@10.x.x.x:1521:dbname</property>
<property name="hibernate.connection.username">user_common</property>
<property name="hibernate.connection.password">user_common</property>

<!-- Database Settings -->
<property name="default_schema">BGM_COMMON</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>



Why the code doesn't work when you give below line to hibernate.cfg.xml?

<property name="hibernate.connection.datasource">COMMONDS</property>

Hibernate: select PLANT_SEQ.nextval from dual
[3/11/04 14:46:01:595 EST] 7a769a68 SystemOut O Hibernate: select PLANT_COMMODITY_SEQ.nextval from dual
[3/11/04 14:46:01:595 EST] 7a769a68 SystemOut O Hibernate: select PLANT_COMMODITY_SEQ.nextval from dual
[3/11/04 14:46:01:611 EST] 7a769a68 SystemOut O Hibernate: select PLANT_CAPACITY_SEQ.nextval from dual
[3/11/04 14:46:01:611 EST] 7a769a68 SystemOut O Hibernate: select PLANT_CAPACITY_SEQ.nextval from dual
[3/11/04 14:46:01:611 EST] 7a769a68 SystemOut O Hibernate: select PLANT_CAPACITY_SEQ.nextval from dual
[3/11/04 14:46:01:627 EST] 7a769a68 SystemOut O Hibernate: select PLANT_CAPACITY_SEQ.nextval from dual
[3/11/04 14:46:01:627 EST] 7a769a68 SystemOut O Hibernate: select PLANT_MARKET_SEQ.nextval from dual
[3/11/04 14:46:01:627 EST] 7a769a68 SystemOut O Hibernate: select PLANT_MARKET_SEQ.nextval from dual
[3/11/04 14:46:01:627 EST] 7a769a68 SystemOut O Hibernate: select PLANT_PORT_SEQ.nextval from dual
[3/11/04 14:46:01:642 EST] 7a769a68 SystemOut O Hibernate: select PLANT_PORT_SEQ.nextval from dual
[3/11/04 14:46:01:642 EST] 7a769a68 SystemOut O Hibernate: insert into BGM_COMMON.PLANT (LOCATION_ID, PLANT_NAME, COMPANY_CODE, START_OF_CROP_YEAR, PLANT_STATUS, UPDATE_DATE, UPDATED_BY, CREATE_DATE, CREATED_BY, PLANT_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[3/11/04 14:46:01:673 EST] 7a769a68 SystemOut O Hibernate: insert into BGM_COMMON.PLANT_COMMODITY (PLANT_ID, COMMODITY_CODE, UPDATE_DATE, UPDATED_BY, CREATE_DATE, CREATED_BY, PLANT_COMMODITY_ID) values (?, ?, ?, ?, ?, ?, ?)
[3/11/04 14:46:01:673 EST] 7a769a68 ExceptionUtil E CNTR0020E: Non-application exception occurred while processing method "handle" on bean "BeanId(CrushMargin#CrushMargin_Business.jar#PlantCreate, null)". Exception data: java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.resetStatement(WSJdbcConnection.java:1719)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1415)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1381)
at net.sf.hibernate.impl.SessionFactoryImpl.getPreparedStatement(SessionFactoryImpl.java:537)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:52)
at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:93)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:469)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:454)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:20)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2100)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2061)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2005)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:57)
at com.bunge.bgm.crushmargin.plant.ejb.PlantCreateBean.handle(PlantCreateBean.java:39)
at com.bunge.bgm.crushmargin.plant.ejb.EJSRemoteStatelessPlantCreate_72136c1c.handle(EJSRemoteStatelessPlantCreate_72136c1c.java:22)
at com.bunge.bgm.crushmargin.plant.ejb._PlantCreate_Stub.handle(_PlantCreate_Stub.java:257)
at com.bunge.bgm.crushmargin.plant.handler.PlantEJBHandler.handle(PlantEJBHandler.java:44)
at com.bunge.bgm.common.servicefacade.PlainKilimServiceFacade.process(PlainKilimServiceFacade.java:33)
at com.bunge.bgm.common.accessor.PlainKilimAccessor.access(Unknown Source)
at com.bunge.bgm.crushmargin.action.common.AbstActionBase.receiveResult(AbstActionBase.java:69)
at com.bunge.bgm.crushmargin.action.common.LoginAction.addPlant(LoginAction.java:441)
at com.bunge.bgm.crushmargin.action.common.LoginAction.execute(LoginAction.java:49)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 6:31 pm 
Beginner
Beginner

Joined: Tue Nov 11, 2003 4:49 am
Posts: 47
Location: Florence, Italy
This problem is a side effect of the use of the JDBC driver the Application Server do. In the first case, no connection pooling, and Hibernate never do a clearStatement. In the second case, to reuse a PreparedStatement, it calls
Code:
DBData.clearItem
, that generate the exception.
Have you tried another version of the JDBC driver from Oracle ?

_________________
Ciao.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


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

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.