java - Could not find datasource in hibernate -


i trying solve issue quit sometime now, using osuser api simple user , group access. works fine jdbc providers(in osuser.xml , propertyset.xml)

now when trying use com.opensymphony.user.provider.hibernate.hibernatecredentialsprovider shows me error:

  @ net.sf.hibernate.hibernateexception: not find datasource: name jdbc2 not bound in context   @ net.sf.hibernate.connection.datasourceconnectionprovider.configure(datasourceconnectionprovider.java:47)   @ net.sf.hibernate.connection.connectionproviderfactory.newconnectionprovider(connectionproviderfactory.java:75)   @ net.sf.hibernate.impl.sessionfactoryimpl.<init>(sessionfactoryimpl.java:144)   @ net.sf.hibernate.cfg.configuration.buildsessionfactory(configuration.java:571)   @ com.opensymphony.user.provider.hibernate.dao.sessionmanager.<init>(sessionmanager.java:34)   @ com.opensymphony.user.provider.hibernate.impl.osuserhibernateconfigurationproviderimpl.setupconfiguration(osuserhibernateconfigurationproviderimpl.java:101)   @ com.opensymphony.user.provider.hibernate.hibernatebaseprovider.init(hibernatebaseprovider.java:83)   @ com.opensymphony.user.provider.hibernate.hibernateprofileprovider.init(hibernateprofileprovider.java:98)   @ com.opensymphony.user.util.configloader.addprovider(configloader.java:113)   @ com.opensymphony.user.util.configloader.access$100(configloader.java:39)   @ com.opensymphony.user.util.configloader$confighandler.endelement(configloader.java:144)   @ com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.endelement(abstractsaxparser.java:606)   @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scanendelement(xmldocumentfragmentscannerimpl.java:1742)   @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(xmldocumentfragmentscannerimpl.java:2900)   @ com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(xmldocumentscannerimpl.java:607)   @ com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(xmldocumentfragmentscannerimpl.java:489)   @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:835)   @ com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(xml11configuration.java:764)   @ com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(xmlparser.java:123)   @ com.sun.org.apache.xerces.internal.parsers.abstractsaxparser.parse(abstractsaxparser.java:1210)   @ com.sun.org.apache.xerces.internal.jaxp.saxparserimpl$jaxpsaxparser.parse(saxparserimpl.java:568)   @ com.sun.org.apache.xerces.internal.jaxp.saxparserimpl.parse(saxparserimpl.java:302)   @ javax.xml.parsers.saxparser.parse(saxparser.java:195)   @ com.opensymphony.user.util.configloader.load(configloader.java:61)   @ com.opensymphony.user.usermanager.<init>(usermanager.java:108)   @ com.opensymphony.user.usermanager.<init>(usermanager.java:60)   @ com.opensymphony.user.usermanager.getinstance(usermanager.java:127)   @ com.fhl.loginpage$1.onsubmit(loginpage.java:28)   @ org.apache.wicket.markup.html.form.form$10.component(form.java:1157)   @ org.apache.wicket.markup.html.form.form$10.component(form.java:1152)   @ org.apache.wicket.util.visit.visits.visitpostorderhelper(visits.java:273)   @ org.apache.wicket.util.visit.visits.visitpostorder(visits.java:244)   @ org.apache.wicket.markup.html.form.form.delegatesubmit(form.java:1150)   @ org.apache.wicket.markup.html.form.form.process(form.java:803)   @ org.apache.wicket.markup.html.form.form.onformsubmitted(form.java:728)   @ org.apache.wicket.markup.html.form.form.onformsubmitted(form.java:670)   @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)   @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)   @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)   @ java.lang.reflect.method.invoke(method.java:601)   @ org.apache.wicket.requestlistenerinterface.internalinvoke(requestlistenerinterface.java:260)   @ org.apache.wicket.requestlistenerinterface.invoke(requestlistenerinterface.java:216)   @ org.apache.wicket.request.handler.listenerinterfacerequesthandler.invokelistener(listenerinterfacerequesthandler.java:179)   @ org.apache.wicket.request.handler.listenerinterfacerequesthandler.respond(listenerinterfacerequesthandler.java:165)   @ org.apache.wicket.request.cycle.requestcycle$handlerexecutor.respond(requestcycle.java:719)   @ org.apache.wicket.request.requesthandlerstack.execute(requesthandlerstack.java:63)   @ org.apache.wicket.request.cycle.requestcycle.processrequest(requestcycle.java:210)   @ org.apache.wicket.request.cycle.requestcycle.processrequestanddetach(requestcycle.java:253)   @ org.apache.wicket.protocol.http.wicketfilter.processrequest(wicketfilter.java:162)   @ org.apache.wicket.protocol.http.wicketfilter.dofilter(wicketfilter.java:218)   @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:243)   @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)   @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:224)   @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:169)   @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:472)   @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:168)   @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:100)   @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:929)   @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118)   @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:405)   @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:964)   @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:515)   @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:304)   @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)   @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)   @ java.lang.thread.run(thread.java:722)  caused by: javax.naming.namenotfoundexception: name jdbc2 not bound in context   @ org.apache.naming.namingcontext.lookup(namingcontext.java:803)   @ org.apache.naming.namingcontext.lookup(namingcontext.java:159)   @ org.apache.naming.selectorcontext.lookup(selectorcontext.java:158)   @ javax.naming.initialcontext.lookup(initialcontext.java:411)   @ net.sf.hibernate.connection.datasourceconnectionprovider.configure(datasourceconnectionprovider.java:43) 

by console seems not able find datasource, though have added hibernate.cfg.xml class path , strange thing same datasource works fine jdbc connection.

here hibernate.cfg.xml:

<!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration>     <session-factory>         <property name="dialect">org.hibernate.dialect.mysqldialect</property>         <property name="connection.driver_class">com.mysql.jdbc.driver</property>         <property name="connection.url">jdbc:mysql://localhost/tmpdb2</property>         <property name="connection.username">root</property>         <property name="connection.password">fhl</property>          <!-- use c3p0 connection pool. -->         <property name="c3p0.min_size">3</property>         <property name="c3p0.max_size">5</property>         <property name="c3p0.timeout">1800</property>          <!-- disable second-level cache. -->         <property name="cache.provider_class">org.hibernate.cache.nocacheprovider</property>         <property name="cache.use_query_cache">false</property>         <property name="cache.use_minimal_puts">false</property>         <property name="max_fetch_depth">3</property>          <!-- print sql stdout. -->         <property name="show_sql">true</property>         <property name="format_sql">true</property>          <!-- drop , re-create schema on sessionfactory build, testing. -->         <property name="hbm2ddl.auto">create</property>          <!-- bind getcurrentsession() method thread. -->         <property name="current_session_context_class">thread</property>          <!-- hibernate xml mapping files -->         <mapping resource="org/myclass.hbm.xml" />          <!-- hibernate annotations (and package-info.java) <mapping package="org.mypackage"/>              <mapping class="org.myclass/> -->     </session-factory> </hibernate-configuration> 

please tell me missing new hibernate...

thanks in advance.

finally got on this, before

    <property name="connection.datasource">fhlabs</property> 

after

    <property name="connection.datasource">java:comp/env/fhlabs</property> 

works fine now..cheerz..!


Comments