5 Replies Latest reply on Dec 4, 2013 1:38 PM by wdfink

    loading jdbs

    mykhailo

      Hello.

      Sorry for stupid question. I'd like to know is it possible to load jdbc driver with jboss-deployment-structure or something like this

      <jboss-deployment-structure>

          <deployment>

              <dependencies>

                  <module name="org.postgresql" slot="main"/>

              </dependencies>

          </deployment>

      </jboss-deployment-structure>
      Thanks a lot.

      P.S. and I almost done it with editing datasource, but I have one problem:
      if I use web admin console jboss doesn't see driver till I put it in standalone/deployments/directory
      is it ok? I think no cause I should have 2 copies in modules and in deployments (actually I don't try create datasource in xml without using admin console)

        • 1. Re: loading jdbs
          wdfink

          If the module is installed correct you could set a dependency to your app and use it. Also you can add that module as driver and use it in a datasource.

          1 of 1 people found this helpful
          • 2. Re: loading jdbs
            mykhailo

            Could you please help me how can I add dependency?
            I set up module(it's works because datasource with it works)
            Then I add jboss-deployment-structure.xml (put it in WEB_INF):

            <jboss-deployment-structure>

                <deployment>

                    <dependencies>

                        <module name="org.postgresql"/>

                    </dependencies>

                </deployment>

            </jboss-deployment-structure>
            But looks like classloader doesn't load it. What do I do wrong?

            • 3. Re: loading jdbs
              wdfink

              Portable way is to use MANIFEST file.

              ou might have a look to Class Loading in AS7

              1 of 1 people found this helpful
              • 4. Re: loading jdbs
                mykhailo

                I read it and thats where i found about jboss-deployment-structure.xml
                bu I have problems
                jboss output: http://pastebin.com/ARmRykiD
                and

                persistance-unit from persistance.xml

                <persistence-unit name="PostgreSQLPU">

                        <provider>org.hibernate.ejb.HibernatePersistence</provider>

                        <properties>

                            <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/rentbusiness"/>

                            <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>

                            <property name="hibernate.connection.username" value="user"/>

                            <property name="hibernate.connection.password" value="password"/>

                            <property name="hibernate.connection.pool_size" value="10"/>

                            <property name="hibernate.archive.autodetection" value="class"/>

                            <property name="hibernate.show_sql" value="true"/>

                            <property name="hibernate.format_sql" value="true"/>

                            <property name="hibernate.hbm2ddl.auto" value="update"/>

                            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgresPlusDialect"/>

                        </properties>

                    </persistence-unit>

                don't know why it throws exception..

                • 5. Re: loading jdbs
                  wdfink

                  Not sure ATM, but I suppose that you need to add the dependency to the hibernate module if you havn't packed hibernate into the application