2 Replies Latest reply on Feb 26, 2018 12:03 PM by Alexandre Albuquerque

    Hibernate using datasource

    Alexandre Albuquerque Newbie

      Hi,

       

      I have a system using hibernate. But one cliente need made a  deploy at wildfly and force the conection using datasources configurated at wildfly

       

      Can I change my actual configuration file applicationContext.xml with this setup below to use the datasouces? How I can do that ?

       

      <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"

      destroy-method="close">

      <beans:property name="driverClassName" value="org.postgresql.Driver" />

      <beans:property name="url"

      value="jdbc:postgresql://saojose2.recife/dbpothomologa_utf8" />

      <beans:property name="username" value="udssgrs" />

      <beans:property name="password" value="udssgrs" />

      </beans:bean>

       

      Regards,

       

       

      Alexandre A.

        • 1. Re: Hibernate using datasource
          Tomaz Cerar Master

          Just configure spring app to use proper datasource.

          for example:

          <beans>
          ...
          <jee:jndi-lookup
          id="dataSource" jndi-name="java:jboss/datasources/ExampleDS"/>

          ...
          </beans>

          to use ExampleDB,

           

          for full docs see https://docs.spring.io/spring/docs/current/spring-framework-reference/data-access.html#orm-session-factory-setup

          • 2. Re: Hibernate using datasource
            Alexandre Albuquerque Newbie

            I got this error !

            Cannot upload deployment: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./Pesagem" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./Pesagem: java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 20 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 76; The prefix \"jee\" for element \"jee:jndi-lookup\" is not bound. Caused by: java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 20 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 76; The prefix \"jee\" for element \"jee:jndi-lookup\" is not bound. Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 20 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 76; The prefix \"jee\" for element \"jee:jndi-lookup\" is not bound. Caused by: org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 76; The prefix \"jee\" for element \"jee:jndi-lookup\" is not bound."},"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./Pesagem"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}