-->
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.  [ 5 posts ] 
Author Message
 Post subject: JNDI with IBM RAD 6.0 and DB2 8.2.2
PostPosted: Fri Aug 25, 2006 11:24 am 
Newbie

Joined: Thu Jun 15, 2006 2:15 pm
Posts: 15
I have been using a non jndi session with db2 8.2.2 and my app works fine now I am trying to use jndi. I am using the HibernateUtil.java from the Hibernate in action book. I get some interesting messages when it initializes (see console output below). The message
SessionFactor I Not binding factory to JNDI, no JNDI name configured
is telling me the jndi look up failed?

When I try to get the session factory it gives a class cast exception on the bolded line in the excerpt from HibernateUtil.java below

[8/25/06 9:31:37:062 CDT] 00000046 jsf E com.sun.faces.lifecycle.InvokeApplicationPhase execute #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
javax.faces.FacesException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource



excerpt from HibernateUtil.java
/**
* Returns the SessionFactory used for this static class.
*
* @return SessionFactory
*/
public static SessionFactory getSessionFactory() {
/* Instead of a static variable, use JNDI: */
SessionFactory sessions = null;
try {
Context ctx = new InitialContext();
String jndiName = "jdbc/LifeClaims";
Object temp = ctx.lookup(jndiName);
sessions = (SessionFactory) ctx.lookup(jndiName);
} catch (NamingException ex) {
throw new InfrastructureException(ex);
}
return sessions;

Hibernate version:
Hibernate 3.1.3

Mapping documents: hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>

<!-- direct connection
<property name="hibernate.connection.url">jdbc:db2://MVSPROD.FBFS.COM:5203/DB2T</property>
<property name="hibernate.connection.username">uid</property>
<property name="hibernate.connection.password">password</property>
-->

<!-- jndi -->
<property name="hibernate.connection.datasource">jdbc/LifeClaims</property>
<property name="jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>
<property name="jndi.url">iiop://localhost:2809/</property>
<property name="hibernate.connection.username">uid</property>
<property name="hibernate.connection.password">password</property>

<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.DB2390Dialect</property>

<!-- Mapping files -->
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltbene.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltcaus.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltclam.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltclnt.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltdedc.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltplcy.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltprof.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltpymt.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltrcvr.hbm.xml" />
<mapping resource="com/fbfs/lf/claims/model/hibernate/Lcltaddr.hbm.xml" />
</session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():
Doesn't get that far

Full stack trace of any exception that occurs:
[8/25/06 9:29:21:172 CDT] 00000047 Environment I Hibernate 3.1.3
[8/25/06 9:29:21:172 CDT] 00000047 Environment I hibernate.properties not found
[8/25/06 9:29:21:188 CDT] 00000047 Environment I using CGLIB reflection optimizer
[8/25/06 9:29:21:188 CDT] 00000047 Environment I using JDK 1.4 java.sql.Timestamp handling
[8/25/06 9:29:21:375 CDT] 00000047 Configuration I configuring from resource: /hibernate.cfg.xml
[8/25/06 9:29:21:375 CDT] 00000047 Configuration I Configuration resource: /hibernate.cfg.xml
[8/25/06 9:29:21:516 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltbene.hbm.xml
[8/25/06 9:29:21:750 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Benefit -> LCLTBENE
[8/25/06 9:29:21:984 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltcaus.hbm.xml
[8/25/06 9:29:22:000 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Cause -> LCLTCAUS
[8/25/06 9:29:22:016 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltclam.hbm.xml
[8/25/06 9:29:22:031 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Claim -> LCLTCLAM
[8/25/06 9:29:22:031 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltclnt.hbm.xml
[8/25/06 9:29:22:062 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Client -> LCLTCLNT
[8/25/06 9:29:22:078 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltdedc.hbm.xml
[8/25/06 9:29:22:078 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Deduction -> LCLTDEDC
[8/25/06 9:29:22:094 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltplcy.hbm.xml
[8/25/06 9:29:22:094 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Policy -> LCLTPLCY
[8/25/06 9:29:22:109 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltprof.hbm.xml
[8/25/06 9:29:22:125 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Profile -> LCLTPROF
[8/25/06 9:29:22:125 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltpymt.hbm.xml
[8/25/06 9:29:22:141 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Payment -> LCLTPYMT
[8/25/06 9:29:22:141 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltrcvr.hbm.xml
[8/25/06 9:29:22:156 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Receiver -> LCLTRCVR
[8/25/06 9:29:22:156 CDT] 00000047 Configuration I Reading mappings from resource: com/fbfs/lf/claims/model/hibernate/Lcltaddr.hbm.xml
[8/25/06 9:29:22:172 CDT] 00000047 HbmBinder I Mapping class: com.fbfs.lf.claims.model.hibernate.Address -> LCLTADDR
[8/25/06 9:29:22:172 CDT] 00000047 Configuration I Configured SessionFactory: null
[8/25/06 9:29:22:188 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Cause.lcltclams -> LCLTCLAM
[8/25/06 9:29:22:188 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Claim.lcltplcies -> LCLTPLCY
[8/25/06 9:29:22:188 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Claim.lcltclams -> LCLTCLAM
[8/25/06 9:29:22:188 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Client.lcltclams -> LCLTCLAM
[8/25/06 9:29:22:188 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Client.lcltprofs -> LCLTPROF
[8/25/06 9:29:22:203 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Client.lcltaddrs -> LCLTADDR
[8/25/06 9:29:22:203 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Policy.lcltprofs -> LCLTPROF
[8/25/06 9:29:22:203 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Policy.lcltbenes -> LCLTBENE
[8/25/06 9:29:22:203 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Profile.lcltrcvrs -> LCLTRCVR
[8/25/06 9:29:22:203 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Payment.lcltdedcs -> LCLTDEDC
[8/25/06 9:29:22:203 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Receiver.lcltpymts -> LCLTPYMT
[8/25/06 9:29:22:219 CDT] 00000047 HbmBinder I Mapping collection: com.fbfs.lf.claims.model.hibernate.Address.lcltpymts -> LCLTPYMT
[8/25/06 9:29:22:672 CDT] 00000047 NamingHelper I JNDI InitialContext properties:{java.naming.provider.url=iiop://localhost:2809/, java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory}
[8/25/06 9:29:22:688 CDT] 00000047 ConnectionFac W J2CA0294W: Deprecated usage of direct JNDI lookup of resource jdbc/LifeClaims. The following default values are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
loginConfigurationName: null
loginConfigProperties: null
[Other attributes]

res-resolution-control: 999 (undefined)
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)

[8/25/06 9:29:22:688 CDT] 00000047 DatasourceCon I Using datasource: jdbc/LifeClaims
[8/25/06 9:29:22:688 CDT] 00000047 SettingsFacto I RDBMS: DB2, version: DSN07012
[8/25/06 9:29:22:703 CDT] 00000047 SettingsFacto I JDBC driver: IBM DB2 JDBC Universal Driver Architecture, version: 2.3.63
[8/25/06 9:29:22:734 CDT] 00000047 Dialect I Using dialect: org.hibernate.dialect.DB2Dialect
[8/25/06 9:29:22:750 CDT] 00000047 TransactionFa I Using default transaction strategy (direct JDBC transactions)
[8/25/06 9:29:22:766 CDT] 00000047 TransactionMa I No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[8/25/06 9:29:22:766 CDT] 00000047 SettingsFacto I Automatic flush during beforeCompletion(): disabled
[8/25/06 9:29:22:766 CDT] 00000047 SettingsFacto I Automatic session close at end of transaction: disabled
[8/25/06 9:29:22:766 CDT] 00000047 SettingsFacto I Scrollable result sets: enabled
[8/25/06 9:29:22:766 CDT] 00000047 SettingsFacto I JDBC3 getGeneratedKeys(): disabled
[8/25/06 9:29:22:781 CDT] 00000047 SettingsFacto I Connection release mode: auto
[8/25/06 9:29:22:781 CDT] 00000047 SettingsFacto I Default batch fetch size: 1
[8/25/06 9:29:22:781 CDT] 00000047 SettingsFacto I Generate SQL with comments: disabled
[8/25/06 9:29:22:781 CDT] 00000047 SettingsFacto I Order SQL updates by primary key: disabled
[8/25/06 9:29:22:781 CDT] 00000047 SettingsFacto I Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[8/25/06 9:29:22:797 CDT] 00000047 ASTQueryTrans I Using ASTQueryTranslatorFactory
[8/25/06 9:29:22:797 CDT] 00000047 SettingsFacto I Query language substitutions: {}
[8/25/06 9:29:22:797 CDT] 00000047 SettingsFacto I Second-level cache: enabled
[8/25/06 9:29:22:812 CDT] 00000047 SettingsFacto I Query cache: disabled
[8/25/06 9:29:22:812 CDT] 00000047 SettingsFacto I Cache provider: org.hibernate.cache.EhCacheProvider
[8/25/06 9:29:22:828 CDT] 00000047 SettingsFacto I Optimize cache for minimal puts: disabled
[8/25/06 9:29:22:828 CDT] 00000047 SettingsFacto I Structured second-level cache entries: disabled
[8/25/06 9:29:22:844 CDT] 00000047 SettingsFacto I Echoing all SQL to stdout
[8/25/06 9:29:22:859 CDT] 00000047 SettingsFacto I Statistics: disabled
[8/25/06 9:29:22:859 CDT] 00000047 SettingsFacto I Deleted entity synthetic identifier rollback: disabled
[8/25/06 9:29:22:859 CDT] 00000047 SettingsFacto I Default entity-mode: pojo
[8/25/06 9:29:22:922 CDT] 00000047 SessionFactor I building session factory
[8/25/06 9:29:22:953 CDT] 00000047 Configurator W No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: wsjar:file:/C:/RAD6_0/ClearCaseProjects/LifeClaimsDev/LifeClaims/Source/LifeClaimsView/WebContent/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
[8/25/06 9:29:23:969 CDT] 00000047 SessionFactor I Not binding factory to JNDI, no JNDI name configured
[8/25/06 9:29:23:984 CDT] 00000047 SystemOut O *******************************************filter!!!!!!!!!!!!
[8/25/06 9:31:29:281 CDT] 00000048 ServletWrappe A SRVE0242I: [/ClientSearch.jsp]: Initialization successful.
[8/25/06 9:31:29:328 CDT] 00000048 SystemOut O *******************************************filter!!!!!!!!!!!!
[8/25/06 9:31:29:328 CDT] 00000048 SystemOut O *******************************************filter!!!!!!!!!!!!
[8/25/06 9:31:37:047 CDT] 00000046 ConnectionFac W J2CA0294W: Deprecated usage of direct JNDI lookup of resource jdbc/LifeClaims. The following default values are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
loginConfigurationName: null
loginConfigProperties: null
[Other attributes]

res-resolution-control: 999 (undefined)
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)

[8/25/06 9:31:37:047 CDT] 00000046 ConnectionFac W J2CA0294W: Deprecated usage of direct JNDI lookup of resource jdbc/LifeClaims. The following default values are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
loginConfigurationName: null
loginConfigProperties: null
[Other attributes]

res-resolution-control: 999 (undefined)
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)

[8/25/06 9:31:37:062 CDT] 00000046 jsf E com.sun.faces.lifecycle.InvokeApplicationPhase execute #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
javax.faces.FacesException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:416)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1217)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.fbfs.lf.claims.hibernate.util.HibernateFilter.doFilter(HibernateFilter.java:40)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:131)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
... 27 more
Caused by: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSessionFactory(HibernateUtil.java:66)
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSession(HibernateUtil.java:133)
at com.fbfs.lf.claims.model.dao.ClaimDAO.getClaimsList(ClaimDAO.java:365)
at pagecode.ClientSearch.clientSearch(ClientSearch.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
... 28 more

[8/25/06 9:31:37:156 CDT] 00000046 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet Faces Servlet. Exception thrown : javax.servlet.ServletException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1217)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.fbfs.lf.claims.hibernate.util.HibernateFilter.doFilter(HibernateFilter.java:40)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
---- Begin backtrace for Nested Throwables
javax.faces.FacesException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:416)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1217)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.fbfs.lf.claims.hibernate.util.HibernateFilter.doFilter(HibernateFilter.java:40)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:131)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
... 27 more
Caused by: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSessionFactory(HibernateUtil.java:66)
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSession(HibernateUtil.java:133)
at com.fbfs.lf.claims.model.dao.ClaimDAO.getClaimsList(ClaimDAO.java:365)
at pagecode.ClientSearch.clientSearch(ClientSearch.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
... 28 more

[8/25/06 9:31:37:172 CDT] 00000046 ServletWrappe E SRVE0014E: Uncaught service() exception root cause Faces Servlet: javax.faces.FacesException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:416)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1217)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.fbfs.lf.claims.hibernate.util.HibernateFilter.doFilter(HibernateFilter.java:40)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:131)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
... 27 more
Caused by: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSessionFactory(HibernateUtil.java:66)
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSession(HibernateUtil.java:133)
at com.fbfs.lf.claims.model.dao.ClaimDAO.getClaimsList(ClaimDAO.java:365)
at pagecode.ClientSearch.clientSearch(ClientSearch.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
... 28 more

[8/25/06 9:31:37:172 CDT] 00000046 WebApp E SRVE0026E: [Servlet Error]-[Faces Servlet]: javax.faces.FacesException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:79)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:416)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:201)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1217)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.fbfs.lf.claims.hibernate.util.HibernateFilter.doFilter(HibernateFilter.java:40)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:131)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
... 27 more
Caused by: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSessionFactory(HibernateUtil.java:66)
at com.fbfs.lf.claims.hibernate.util.HibernateUtil.getSession(HibernateUtil.java:133)
at com.fbfs.lf.claims.model.dao.ClaimDAO.getClaimsList(ClaimDAO.java:365)
at pagecode.ClientSearch.clientSearch(ClientSearch.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
... 28 more

Name and version of the database you are using:
db2 8.2.2


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 25, 2006 12:18 pm 
Regular
Regular

Joined: Mon Jun 13, 2005 12:21 pm
Posts: 61
Location: Hannover
Guess you're mixing to things:
1. The JNDI Name of the Datasource
2. The JNDI Name of the SessionFactory

You're proving a JNDI name for a datasource (hibernate.connection.datasource) but are looking up a SessionFactory with this name. To use a JNDI bound session Factory you've got to use hibernate.session_factory_name


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 25, 2006 1:19 pm 
Newbie

Joined: Thu Jun 15, 2006 2:15 pm
Posts: 15
Thanks, that got rid of the not binding to jndi message and now I don't need the userid and password.

When I try to run a query though I get this:
E com.sun.faces.lifecycle.InvokeApplicationPhase execute #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.UnsupportedOperationException: The user must supply a JDBC connection
javax.faces.FacesException: #{pc_ClientSearch.clientSearch}: javax.faces.el.EvaluationException: java.lang.UnsupportedOperationException: The user must supply a JDBC connection


Below is the HibernateUtil I am using to handle sessions. Should I change something sessionFactory declaration or getSessionFactory?

package com.fbfs.lf.claims.hibernate.util;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

import com.fbfs.lf.claims.hibernate.exceptions.InfrastructureException;



/**
* Basic Hibernate helper class, handles SessionFactory, Session and Transaction.
* <p>
* Uses a static initializer for the initial SessionFactory creation
* and holds Session and Transactions in thread local variables. All
* exceptions are wrapped in an unchecked InfrastructureException.
*
* @author christian@hibernate.org
*/
public class HibernateUtil {

private static Log log = LogFactory.getLog(HibernateUtil.class);

private static Configuration configuration;
private static SessionFactory sessionFactory;
private static final ThreadLocal threadSession = new ThreadLocal();
private static final ThreadLocal threadTransaction = new ThreadLocal();
private static final ThreadLocal threadInterceptor = new ThreadLocal();

// Create the initial SessionFactory from the default configuration files
static {
try {
configuration = new Configuration();
sessionFactory = configuration.configure().buildSessionFactory();
// We could also let Hibernate bind it to JNDI:
//configuration.configure().buildSessionFactory();
} catch (Throwable ex) {
// We have to catch Throwable, otherwise we will miss
// NoClassDefFoundError and other subclasses of Error
log.error("Building SessionFactory failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}

/**
* Returns the SessionFactory used for this static class.
*
* @return SessionFactory
*/
public static SessionFactory getSessionFactory() {
/* Instead of a static variable, use JNDI:
SessionFactory sessions = null;
try {
Context ctx = new InitialContext();
String jndiName = "jdbc/LifeClaims";
Object temp = ctx.lookup(jndiName);
sessions = (SessionFactory) ctx.lookup(jndiName);
} catch (NamingException ex) {
throw new InfrastructureException(ex);
}
return sessions;
*/
return sessionFactory;
}
/**
* Returns the original Hibernate configuration.
*
* @return Configuration
*/
public static Configuration getConfiguration() {
return configuration;
}

/**
* Rebuild the SessionFactory with the static Configuration.
*
*/
public static void rebuildSessionFactory()
throws InfrastructureException {
synchronized(sessionFactory) {
try {
sessionFactory = getConfiguration().buildSessionFactory();
} catch (Exception ex) {
throw new InfrastructureException(ex);
}
}
}

/**
* Rebuild the SessionFactory with the given Hibernate Configuration.
*
* @param cfg
*/
public static void rebuildSessionFactory(Configuration cfg)
throws InfrastructureException {
synchronized(sessionFactory) {
try {
sessionFactory = cfg.buildSessionFactory();
configuration = cfg;
} catch (Exception ex) {
throw new InfrastructureException(ex);
}
}
}

/**
* Retrieves the current Session local to the thread.
* <p/>
* If no Session is open, opens a new Session for the running thread.
*
* @return Session
*/
public static Session getSession()
throws InfrastructureException {
Session s = (Session) threadSession.get();
try {
if (s == null) {
log.debug("Opening new Session for this thread.");
if (getInterceptor() != null) {
log.debug("Using interceptor: " + getInterceptor().getClass());
s = getSessionFactory().openSession(getInterceptor());
} else {
s = getSessionFactory().openSession();
}
threadSession.set(s);
}
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
return s;
}

/**
* Closes the Session local to the thread.
*/
public static void closeSession()
throws InfrastructureException {
try {
Session s = (Session) threadSession.get();
threadSession.set(null);
if (s != null && s.isOpen()) {
log.debug("Closing Session of this thread.");
s.close();
}
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
}

/**
* Start a new database transaction.
*/
public static void beginTransaction()
throws InfrastructureException {
Transaction tx = (Transaction) threadTransaction.get();
try {
if (tx == null) {
log.debug("Starting new database transaction in this thread.");
tx = getSession().beginTransaction();
threadTransaction.set(tx);
}
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
}

/**
* Commit the database transaction.
*/
public static void commitTransaction()
throws InfrastructureException {
Transaction tx = (Transaction) threadTransaction.get();
try {
if ( tx != null && !tx.wasCommitted()
&& !tx.wasRolledBack() ) {
log.debug("Committing database transaction of this thread.");
tx.commit();
}
threadTransaction.set(null);
} catch (HibernateException ex) {
rollbackTransaction();
throw new InfrastructureException(ex);
}
}

/**
* Commit the database transaction.
*/
public static void rollbackTransaction()
throws InfrastructureException {
Transaction tx = (Transaction) threadTransaction.get();
try {
threadTransaction.set(null);
if ( tx != null && !tx.wasCommitted() && !tx.wasRolledBack() ) {
log.debug("Tyring to rollback database transaction of this thread.");
tx.rollback();
}
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
} finally {
closeSession();
}
}

/**
* Reconnects a Hibernate Session to the current Thread.
*
* @param session The Hibernate Session to be reconnected.
*/
public static void reconnect(Session session)
throws InfrastructureException {
try {
session.reconnect();
threadSession.set(session);
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
}

/**
* Disconnect and return Session from current Thread.
*
* @return Session the disconnected Session
*/
public static Session disconnectSession()
throws InfrastructureException {

Session session = getSession();
try {
threadSession.set(null);
if (session.isConnected() && session.isOpen())
session.disconnect();
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}
return session;
}

/**
* Register a Hibernate interceptor with the current thread.
* <p>
* Every Session opened is opened with this interceptor after
* registration. Has no effect if the current Session of the
* thread is already open, effective on next close()/getSession().
*/
public static void registerInterceptor(Interceptor interceptor) {
threadInterceptor.set(interceptor);
}

private static Interceptor getInterceptor() {
Interceptor interceptor =
(Interceptor) threadInterceptor.get();
return interceptor;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 25, 2006 2:43 pm 
Newbie

Joined: Thu Jun 15, 2006 2:15 pm
Posts: 15
Thanks again for your help jherbst.

I got it to work by changing Hibernate.cfg.xml

<property name="hibernate.session_factory_name">hibernate/HibernateFactory</property>
<property name="hibernate.connection.datasource">iiop://localhost:2809/jdbc/LifeClaims</property>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 12:24 pm 
Newbie

Joined: Thu Jun 15, 2006 2:15 pm
Posts: 15
Actually should be this:

<property name="hibernate.session_factory_name">hibernate/HibernateFactory</property>
<property name="hibernate.connection.datasource">jdbc/LifeClaims</property>


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