-->
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.  [ 4 posts ] 
Author Message
 Post subject: WebSphere db2 datasource gets lost
PostPosted: Tue Sep 27, 2005 11:42 am 
Newbie

Joined: Tue Sep 27, 2005 5:20 am
Posts: 3
Hi,
I'm facing a strange phenomenon:

We're using Hibernate2.0 and a WebSphere Application Server(5.1.1.4) DB2 datasource.

The application starts and runs well.
After executing some app-use-cases hibernate "seems to lose the datasource" (although the datasource-test via the adminconsole verified datsource is working fine) and the following exception occurs:

Code:
Caused by: net.sf.hibernate.HibernateException: Could not find datasource: jdbc/DATASOURCENAME
        at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:59)
        at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:76
)
        at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:161)
        at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:613)
        at dataAccess.base.Connection.createSessionFactory(Connection.java:77)
        at dataAccess.base.Connection.createSession(Connection.java:89)
        at dataAccess.base.AbstractAccessImpl.loadVoList(AbstractAccessImpl.java:539)
        ... 14 more


The occurence of the phenomenon is non-determinsitic.
All I definetely know, is, when I stop and restart the application via the adminConsole, I'm not even able to run the application. Then I have to restart the whole WebSphere server to make the datasource available to the application.

Some days already went by without success...hopefully one of you can give me a hint. I think (hope) its a hibernate setting that I'm missing or doing wrong. please have a look at my hibernate.properties:

Code:
hibernate.connection.isolation=4
hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect
hibernate.max_fetch_depth=1
hibernate.jdbc.use_streams_for_binary=true
hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N'
hibernate.jdbc.batch_size=20
hibernate.use_outer_join=true
hibernate.connection.datasource=jdbc/DATASOURCENAME
hibernate.show_sql=true
hibernate.jdbc.batch_versioned_data=true
hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory
hibernate.connection.pool_size=10



Mapping documents:
-not relevant- Mapping correct. App runs accurately on JBoss.

Code between sessionFactory.openSession() and session.close():
Code:
            session = iConnection.createSession(); //opens the session
            tx = session.beginTransaction();
            result = finder.find(session, whereString, value, type);
            session.flush();
            tx.commit();
            session.close();


Full stack trace of any exception that occurs:
Code:
net.sf.hibernate.HibernateException: Could not find datasource: jdbc/DATASOURCENAME
   at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:59)
   at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:76)
   at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:161)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:613)
   at dataAccess.base.Connection.createSessionFactory(Connection.java:77)
   at dataAccess.base.Connection.createSession(Connection.java:89)
   at dataAccess.base.AbstractAccessImpl.loadVoList(AbstractAccessImpl.java:539)
   at components.projekt.dao.ProjektAccessImpl.readAntragstellerByPersonId(ProjektAccessImpl.java:242)
   at components.validierung.AntragstellerValidierungDelegate.validate(AntragstellerValidierungDelegate.java:213)
   at components.validierung.ValidierungVerwaltungComponent.validate(ValidierungVerwaltungComponent.java:224)
   at components.validierung.ValidierungVerwaltungBean.validate(ValidierungVerwaltungBean.java:84)
   at components.validierung.EJSRemoteStatelessValidierungVerwaltung_654a66ed.validate(Unknown Source)
   at components.validierung._EJSRemoteStatelessValidierungVerwaltung_654a66ed_Tie._invoke(Unknown Source)
   at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:608)
   at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:461)
   at com.ibm.rmi.iiop.ORB.process(ORB.java:432)
   at com.ibm.CORBA.iiop.ORB.process(ORB.java:1728)
   at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2227)
   at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:65)
   at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
SystemOut     O HibernateException Causenull


Name and version of the database you are using:
IBM DB2 8.1.4

Debug level Hibernate log excerpt:

#####LOG OF ACCURATE APP BEHAVIOUR#####
Collection I net.sf.hibernate.mapping.Collection Mapping collection: cs.vo.stammdaten.FlatfileTyp.finanzplanTypListe -> T_FINPLAN_TYP
Collection I net.sf.hibernate.mapping.Collection Mapping collection: cs.vo.projekt.Buchung.mittelgeberReferenzBuchungListe -> T_MG_BUCHUNG
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl building session factory
Dialect I net.sf.hibernate.dialect.Dialect Using dialect: net.sf.hibernate.dialect.DB2Dialect
NamingHelper I net.sf.hibernate.util.NamingHelper JNDI InitialContext properties:{}
DatasourceCon I net.sf.hibernate.connection.DatasourceConnectionProvider Using datasource: jdbc/DATASOURCENAME
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Use outer join fetching: true
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Use scrollable result sets: true
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl JDBC 2 max batch size: 20
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
NamingHelper I net.sf.hibernate.util.NamingHelper JNDI InitialContext properties:{}
JTATransactio I net.sf.hibernate.transaction.JTATransactionFactory Locating TransactionManager using: net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
WebSphereTran I net.sf.hibernate.transaction.WebSphereTransactionManagerLookup WebSphere 5.1
JTATransactio I net.sf.hibernate.transaction.JTATransactionFactory TransactionManager lookup successful
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl echoing all SQL to stdout
SessionFactor I net.sf.hibernate.impl.SessionFactoryObjectFactory no JDNI name configured
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Query language substitutions: {no='N', true=1, yes='Y', false=0}[/code]

Configuration I net.sf.hibernate.cfg.Configuration Mapping resource: components/stammdaten/dao/EuCode.hbm.xml
... some mappings...
Collection I net.sf.hibernate.mapping.Collection Mapping class: cs.vo.uam.BenutzerRolle -> T_BENUTZER_ROLLE

Quote:
#####Testing Applications usecases#####
##########time went by##########
######suddenly the following occurs:#####


#####LOG OF FAULTY APP BEHAVIOUR#####
Collection I net.sf.hibernate.mapping.Collection Mapping collection: cs.vo.stammdaten.FlatfileTyp.finanzplanTypListe -> T_FINPLAN_TYP
Collection I net.sf.hibernate.mapping.Collection Mapping collection: cs.vo.projekt.Buchung.mittelgeberReferenzBuchungListe -> T_MG_BUCHUNG
SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl building session factory
Dialect I net.sf.hibernate.dialect.Dialect Using dialect: net.sf.hibernate.dialect.DB2Dialect
NamingHelper I net.sf.hibernate.util.NamingHelper JNDI InitialContext properties:{}
net.sf.hibernate.HibernateException: Could not find datasource: jdbc/efREporterDB2



It's not that I didn't try to solve it on my own. If I didn't consider this forum to be one of the last chances, I wouldn't post here.
PLEASE, if somebody came across such a problem, or has a clue what's going on...let me know. And let me know, if I kept too much problemcontext on my own.

Big thx in advance for your time
ulli


Quote:
Quote:

_________________
-----------------------
warum verstehen, wenn man weiß wie's geht?
(Ben R. Uka)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 4:33 am 
Newbie

Joined: Tue Sep 27, 2005 5:20 am
Posts: 3
let me re-phrase:

When does the

Code:
ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndiName)

in Class net.sf.hibernate.connection.DataSourceConnectionProvider.configure(DataSourceConnectionProvider.java:51)
return null??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 3:29 am 
Newbie

Joined: Tue Sep 27, 2005 5:20 am
Posts: 3
I found out some new details:

Whenever the InitialContext.lookup
(in net.sf.hibernate.connection.DatasourceConnectionProvider.configure(Properties props))
returns null, the InitialContext.Environment Hashtable looks like this:

faulty InitialContext.Environment:
Code:
InitialContext.Environment=
{java.naming.provider.url:iiop://XXX.X.X.X:2809/nodes/oo-websphere/servers/server1/;
java.naming.factory.initial:com.sun.jndi.cosnaming.CNCtxFactory;
java.naming.factory.url.pkgs:com.ibm.ws.runtime:com.ibm.ws.naming}
Context: This structure of the InitialContext.Environment Hashtable is on hand,
when running the deployed application after it got stopped an restarted over the adminconsole.


Whereas the InitialContext.Environment Hashtable after restarting the WebSphere Application Server
during the same operation, that failed before but after restart runs fine,
now looks like this:

accurate IntialContext.Environment:
Code:
InitialContext.Environment=
{com.ibm.websphere.naming.hostname.normalizer:com.ibm.ws.naming.util.DefaultHostnameNormalizer; java.naming.factory.initial:com.ibm.websphere.naming.WsnInitialContextFactory;
com.ibm.websphere.naming.name.syntax:jndi; com.ibm.websphere.naming.namespace.connection:lazy;
com.ibm.ws.naming.ldap.ldapinitctxfactory:com.sun.jndi.ldap.LdapCtxFactory;
com.ibm.websphere.naming.jndicache.cacheobject:populated; com.ibm.websphere.naming.namespaceroot:defaultroot;
com.ibm.ws.naming.implementation:WsnIpCos;
com.ibm.ws.naming.wsn.factory.initial:com.ibm.ws.naming.util.WsnInitCtxFactory;
com.ibm.websphere.naming.jndicache.maxcachelife:0; com.ibm.websphere.naming.jndicache.maxentrylife:0;
com.ibm.websphere.naming.jndicache.cachename:providerURL;
java.naming.provider.url:corbaloc:rir:/NameServiceServerRoot;
java.naming.factory.url.pkgs:com.ibm.ws.runtime:com.ibm.ws.naming}
Context: This structure of the InitialContext.Environment Hashtable is on hand,
when running the application after the WebSphere Application Server got completely restarted.


Note: The properties passed to the getInitialContext(Properties props)
(in net.sf.hibernate.util.NamingHelper)
were in both szenarios (faulty and accurate InitialContext.Environment) of the same structure
(like hibernate.properties I described 2 posts above).

What could be the reason for the IntialContext to differ in its
Environment Hashtable from time to time?? This must be the reason for my prob.
Seems to me like a caching thing...could anybody agreee to that?
Does anybody now have a clue??

...hopeful still searching for the red herring
greetz U

_________________
-----------------------
warum verstehen, wenn man weiß wie's geht?
(Ben R. Uka)


Top
 Profile  
 
 Post subject: Experiencing similar issue using JBoss4.0.4
PostPosted: Tue Jan 16, 2007 5:51 pm 
Newbie

Joined: Sat Jan 13, 2007 9:42 am
Posts: 1
Hi All,
I am also experiencing a similar issue

We're using Hibernate-Version: 3.1.3 , JBOSS 4.0.4 Application Server and Oracle9 datasource.

Similarly the application starts and runs well and after some time,
we also "seems to lose the datasource" and the following exception occurs:

Code:
2007-01-12 16:01:09,812 INFO  [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2007-01-12 16:01:09,813 FATAL [org.hibernate.connection.DatasourceConnectionProvider] Could not find datasource: java:/cgemscsm
javax.naming.NamingException: Failed to find j2ee.clientName in jndi env
   at org.jboss.naming.client.java.javaURLContextFactory.getObjectInstance(javaURLContextFactory.java:81)
   at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:584)
   at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:533)
   at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:279)
   at javax.naming.InitialContext.lookup(InitialContext.java:351)
   at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
   at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
   at gov.nih.nci.security.system.ApplicationSessionFactory.initSessionFactory(ApplicationSessionFactory.java:195)
   at gov.nih.nci.security.system.ApplicationSessionFactory.<clinit>(ApplicationSessionFactory.java:153)
   at gov.nih.nci.security.provisioning.UserProvisioningManagerImpl.<init>(UserProvisioningManagerImpl.java:167)
   at gov.nih.nci.security.SecurityServiceProvider.getUserProvisioningManager(SecurityServiceProvider.java:129)
   at gov.nih.nci.security.authorization.AuthorizationManagerFactory.getAuthorizationManager(AuthorizationManagerFactory.java:159)
   at gov.nih.nci.security.SecurityServiceProvider.getAuthorizationManager(SecurityServiceProvider.java:155)
   at gov.nih.nci.caintegrator.security.SecurityManager.getAuthorizationManager(SecurityManager.java:298)
   at gov.nih.nci.caintegrator.security.SecurityManager.authorization(SecurityManager.java:155)
   at gov.nih.nci.cgems.web.action.LoginAction.execute(LoginAction.java:64)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
   at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
   at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
   at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
   at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
2007-01-12 16:01:09,821 ERROR [STDERR] org.hibernate.HibernateException: Could not find datasource
   at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
   at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
   at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
   at gov.nih.nci.security.system.ApplicationSessionFactory.initSessionFactory(ApplicationSessionFactory.java:195)
   at gov.nih.nci.security.system.ApplicationSessionFactory.<clinit>(ApplicationSessionFactory.java:153)
   at gov.nih.nci.security.provisioning.UserProvisioningManagerImpl.<init>(UserProvisioningManagerImpl.java:167)
   at gov.nih.nci.security.SecurityServiceProvider.getUserProvisioningManager(SecurityServiceProvider.java:129)
   at gov.nih.nci.security.authorization.AuthorizationManagerFactory.getAuthorizationManager(AuthorizationManagerFactory.java:159)
   at gov.nih.nci.security.SecurityServiceProvider.getAuthorizationManager(SecurityServiceProvider.java:155)
   at gov.nih.nci.caintegrator.security.SecurityManager.getAuthorizationManager(SecurityManager.java:298)
   at gov.nih.nci.caintegrator.security.SecurityManager.authorization(SecurityManager.java:155)
   at gov.nih.nci.cgems.web.action.LoginAction.execute(LoginAction.java:64)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
   at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
   at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
   at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
   at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: javax.naming.NamingException: Failed to find j2ee.clientName in jndi env
   at org.jboss.naming.client.java.javaURLContextFactory.getObjectInstance(javaURLContextFactory.java:81)
   at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:584)
   at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:533)
   at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:279)
   at javax.naming.InitialContext.lookup(InitialContext.java:351)
   at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)

PS: We have NOT modified the JNDI.properties on the Jboss server.

Any and all help will be greatly appreciated.
Himanso


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.