Estoy tratando de resolver este problema de dejar de fumar en algún momento ahora, estoy utilizando OSUSER api de simple acceso de usuario y grupo. Funciona bien con proveedores de JDBC(en OsUser.xml y PropertySet.xml)

Ahora cuando estoy tratando de usarlo con com.opensymphony.user.provider.hibernate.HibernateCredentialsProvider que me muestra el error:

  at net.sf.hibernate.HibernateException: Could not find datasource: Name jdbc2 is not bound in this Context
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:47)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:75)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:144)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:571)
at com.opensymphony.user.provider.hibernate.dao.SessionManager.<init>(SessionManager.java:34)
at com.opensymphony.user.provider.hibernate.impl.OSUserHibernateConfigurationProviderImpl.setupConfiguration(OSUserHibernateConfigurationProviderImpl.java:101)
at com.opensymphony.user.provider.hibernate.HibernateBaseProvider.init(HibernateBaseProvider.java:83)
at com.opensymphony.user.provider.hibernate.HibernateProfileProvider.init(HibernateProfileProvider.java:98)
at com.opensymphony.user.util.ConfigLoader.addProvider(ConfigLoader.java:113)
at com.opensymphony.user.util.ConfigLoader.access$100(ConfigLoader.java:39)
at com.opensymphony.user.util.ConfigLoader$ConfigHandler.endElement(ConfigLoader.java:144)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1742)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2900)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:302)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at com.opensymphony.user.util.ConfigLoader.load(ConfigLoader.java:61)
at com.opensymphony.user.UserManager.<init>(UserManager.java:108)
at com.opensymphony.user.UserManager.<init>(UserManager.java:60)
at com.opensymphony.user.UserManager.getInstance(UserManager.java:127)
at com.fhl.LoginPage$1.onSubmit(LoginPage.java:28)
at org.apache.wicket.markup.html.form.Form$10.component(Form.java:1157)
at org.apache.wicket.markup.html.form.Form$10.component(Form.java:1152)
at org.apache.wicket.util.visit.Visits.visitPostOrderHelper(Visits.java:273)
at org.apache.wicket.util.visit.Visits.visitPostOrder(Visits.java:244)
at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1150)
at org.apache.wicket.markup.html.form.Form.process(Form.java:803)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:728)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:670)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:179)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: javax.naming.NameNotFoundException: Name jdbc2 is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:43)

Por la consola parece que no es capaz de encontrar el origen de los datos, a pesar de que he añadido hibernate.cfg.xml en la ruta de clases y la cosa extraña es el mismo origen de datos funciona bien para la conexión de JDBC.

Aquí está mi 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 the 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 to stdout. -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- Drop and then re-create schema on SessionFactory build, for testing. -->
<property name="hbm2ddl.auto">create</property>
<!-- Bind the getCurrentSession() method to the 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>

Por favor, dime lo que me estoy perdiendo como soy nuevo en hibernate…

Gracias de antemano.

InformationsquelleAutor Ashish | 2013-07-15

3 Comentarios

  1. 5

    Finalmente consiguió con este,
    Antes de

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

    Después de

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

    funciona bien ahora..cheerz..!

  2. 0

    Su instalación parece incoherente. Por un lado está la creación de un local de origen de datos a través de hibernate.cfg.xml, sin embargo, el seguimiento de la pila indica en alguna otra parte de su código es la esperanza de un origen de datos está disponible a través de JNDI bajo el nombre de «jdbc2».

    Primero debe determinar si el uso de locales /JNDI origen de datos y la configuración de su entorno en consecuencia

Dejar respuesta

Please enter your comment!
Please enter your name here