Arquillian and PostgreSQL driver

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Arquillian and PostgreSQL driver

Makarov Alexey
Hello!
I try to use Arquillian with connection to PostgreSQL database but when I run test, it fail becouse server cannot find "org.postgresql.Driver":
...
13-Nov-2019 16:57:46.469 SEVERE [main] org.apache.tomee.catalina.ServerListener.lifecycleEvent TomEE Listener can't start OpenEJB
        org.apache.openejb.OpenEJBException: org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve class org.postgresql.Driver: Unable to resolve class org.postgresql.Driver
....


I check files in ShrinkWrap archive, file with driver exists ("/WEB-INF/lib/postgresql-42.2.8.jar"). I setup my datasource in arqullian.xml:

<property name="properties">
                myDS = new://Resource?type=DataSource
                myDS.JdbcUrl = jdbc:postgresql://localhost:5432/mydb
                myDS.JdbcDriver = org.postgresql.Driver
                myDS.UserName = abc
                myDS.Password = xyz
                myDS.JtaManaged = true
</property>

I can assume, datasource is loaded earlier than web-archive. I use Maven. How I can provide postgresql driver to TomEE is my case?

--
With best regards,
Alexey Makarov

Reply | Threaded
Open this post in threaded view
|

Re: Arquillian and PostgreSQL driver

Richard Monson-Haefel
Hi,

Here are a couple of links that show you how to configure TomEE for any
JDBC driver. The first is more tutorial in nature while the second link is
a property reference.

http://tomee.apache.org/configuring-datasources.html

http://tomee.apache.org/datasource-config.html

Hopefully that will help!

Richard

On Wed, Nov 13, 2019 at 6:03 AM Makarov Alexey <[hidden email]> wrote:

> Hello!
> I try to use Arquillian with connection to PostgreSQL database but when I
> run test, it fail becouse server cannot find "org.postgresql.Driver":
> ...
> 13-Nov-2019 16:57:46.469 SEVERE [main]
> org.apache.tomee.catalina.ServerListener.lifecycleEvent TomEE Listener
> can't start OpenEJB
>         org.apache.openejb.OpenEJBException:
> org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve
> class org.postgresql.Driver: Unable to resolve class org.postgresql.Driver
> ....
>
>
> I check files in ShrinkWrap archive, file with driver exists
> ("/WEB-INF/lib/postgresql-42.2.8.jar"). I setup my datasource in
> arqullian.xml:
>
> <property name="properties">
>                 myDS = new://Resource?type=DataSource
>                 myDS.JdbcUrl = jdbc:postgresql://localhost:5432/mydb
>                 myDS.JdbcDriver = org.postgresql.Driver
>                 myDS.UserName = abc
>                 myDS.Password = xyz
>                 myDS.JtaManaged = true
> </property>
>
> I can assume, datasource is loaded earlier than web-archive. I use Maven.
> How I can provide postgresql driver to TomEE is my case?
>
> --
> With best regards,
> Alexey Makarov
>
>

--
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.linkedin.com/in/monsonhaefel/
Reply | Threaded
Open this post in threaded view
|

Re: Arquillian and PostgreSQL driver

Makarov Alexey
Thank you for reply, Richard!
I investigate that postgresql driver should be copied to extracted tomee/lib directory, but I need to know path to this directory.
Here my pom.xml:

https://pastebin.com/FFPAE0CZ

I can specify "<outputDirectory>" for coping driver archive, but I don't know, where my Maven extracted TomEE (this place is not "<outputDirectory>target</outputDirectory>").

--
With best regards,
Alexey Makarov


13.11.2019, 16:19, "Richard Monson-Haefel" <[hidden email]>:

> Hi,
>
> Here are a couple of links that show you how to configure TomEE for any
> JDBC driver. The first is more tutorial in nature while the second link is
> a property reference.
>
> http://tomee.apache.org/configuring-datasources.html
>
> http://tomee.apache.org/datasource-config.html
>
> Hopefully that will help!
>
> Richard
>
> On Wed, Nov 13, 2019 at 6:03 AM Makarov Alexey <[hidden email]> wrote:
>
>>  Hello!
>>  I try to use Arquillian with connection to PostgreSQL database but when I
>>  run test, it fail becouse server cannot find "org.postgresql.Driver":
>>  ...
>>  13-Nov-2019 16:57:46.469 SEVERE [main]
>>  org.apache.tomee.catalina.ServerListener.lifecycleEvent TomEE Listener
>>  can't start OpenEJB
>>          org.apache.openejb.OpenEJBException:
>>  org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve
>>  class org.postgresql.Driver: Unable to resolve class org.postgresql.Driver
>>  ....
>>
>>  I check files in ShrinkWrap archive, file with driver exists
>>  ("/WEB-INF/lib/postgresql-42.2.8.jar"). I setup my datasource in
>>  arqullian.xml:
>>
>>  <property name="properties">
>>                  myDS = new://Resource?type=DataSource
>>                  myDS.JdbcUrl = jdbc:postgresql://localhost:5432/mydb
>>                  myDS.JdbcDriver = org.postgresql.Driver
>>                  myDS.UserName = abc
>>                  myDS.Password = xyz
>>                  myDS.JtaManaged = true
>>  </property>
>>
>>  I can assume, datasource is loaded earlier than web-archive. I use Maven.
>>  How I can provide postgresql driver to TomEE is my case?
>>
>>  --
>>  With best regards,
>>  Alexey Makarov
>
> --
> Richard Monson-Haefel
> https://twitter.com/rmonson
> https://www.linkedin.com/in/monsonhaefel/
Reply | Threaded
Open this post in threaded view
|

Re: Arquillian and PostgreSQL driver

Makarov Alexey
Solved!
I removed datasource definition from arquillian.xml, placed resource.xml for tesing purposes in "./src/test/resources/" and included this file in WAR.

--
Прошу не менять тему при ответе или пересылке сообщения.

С Уважением,
Макаров Алексей


14.11.2019, 00:58, "Makarov Alexey" <[hidden email]>:

> Thank you for reply, Richard!
> I investigate that postgresql driver should be copied to extracted tomee/lib directory, but I need to know path to this directory.
> Here my pom.xml:
>
> https://pastebin.com/FFPAE0CZ
>
> I can specify "<outputDirectory>" for coping driver archive, but I don't know, where my Maven extracted TomEE (this place is not "<outputDirectory>target</outputDirectory>").
>
> --
> With best regards,
> Alexey Makarov
>
> 13.11.2019, 16:19, "Richard Monson-Haefel" <[hidden email]>:
>>  Hi,
>>
>>  Here are a couple of links that show you how to configure TomEE for any
>>  JDBC driver. The first is more tutorial in nature while the second link is
>>  a property reference.
>>
>>  http://tomee.apache.org/configuring-datasources.html
>>
>>  http://tomee.apache.org/datasource-config.html
>>
>>  Hopefully that will help!
>>
>>  Richard
>>
>>  On Wed, Nov 13, 2019 at 6:03 AM Makarov Alexey <[hidden email]> wrote:
>>
>>>   Hello!
>>>   I try to use Arquillian with connection to PostgreSQL database but when I
>>>   run test, it fail becouse server cannot find "org.postgresql.Driver":
>>>   ...
>>>   13-Nov-2019 16:57:46.469 SEVERE [main]
>>>   org.apache.tomee.catalina.ServerListener.lifecycleEvent TomEE Listener
>>>   can't start OpenEJB
>>>           org.apache.openejb.OpenEJBException:
>>>   org.apache.xbean.propertyeditor.PropertyEditorException: Unable to resolve
>>>   class org.postgresql.Driver: Unable to resolve class org.postgresql.Driver
>>>   ....
>>>
>>>   I check files in ShrinkWrap archive, file with driver exists
>>>   ("/WEB-INF/lib/postgresql-42.2.8.jar"). I setup my datasource in
>>>   arqullian.xml:
>>>
>>>   <property name="properties">
>>>                   myDS = new://Resource?type=DataSource
>>>                   myDS.JdbcUrl = jdbc:postgresql://localhost:5432/mydb
>>>                   myDS.JdbcDriver = org.postgresql.Driver
>>>                   myDS.UserName = abc
>>>                   myDS.Password = xyz
>>>                   myDS.JtaManaged = true
>>>   </property>
>>>
>>>   I can assume, datasource is loaded earlier than web-archive. I use Maven.
>>>   How I can provide postgresql driver to TomEE is my case?
>>>
>>>   --
>>>   With best regards,
>>>   Alexey Makarov
>>
>>  --
>>  Richard Monson-Haefel
>>  https://twitter.com/rmonson
>>  https://www.linkedin.com/in/monsonhaefel/
Reply | Threaded
Open this post in threaded view
|

Re: Arquillian and PostgreSQL driver

Richard Monson-Haefel
Woot!  Glad you figured it out!

On Fri, Nov 15, 2019 at 9:07 PM Makarov Alexey <[hidden email]> wrote:

> Solved!
> I removed datasource definition from arquillian.xml, placed resource.xml
> for tesing purposes in "./src/test/resources/" and included this file in
> WAR.
>
> --
> Прошу не менять тему при ответе или пересылке сообщения.
>
> С Уважением,
> Макаров Алексей
>
>
> 14.11.2019, 00:58, "Makarov Alexey" <[hidden email]>:
> > Thank you for reply, Richard!
> > I investigate that postgresql driver should be copied to extracted
> tomee/lib directory, but I need to know path to this directory.
> > Here my pom.xml:
> >
> > https://pastebin.com/FFPAE0CZ
> >
> > I can specify "<outputDirectory>" for coping driver archive, but I don't
> know, where my Maven extracted TomEE (this place is not
> "<outputDirectory>target</outputDirectory>").
> >
> > --
> > With best regards,
> > Alexey Makarov
> >
> > 13.11.2019, 16:19, "Richard Monson-Haefel" <[hidden email]>:
> >>  Hi,
> >>
> >>  Here are a couple of links that show you how to configure TomEE for any
> >>  JDBC driver. The first is more tutorial in nature while the second
> link is
> >>  a property reference.
> >>
> >>  http://tomee.apache.org/configuring-datasources.html
> >>
> >>  http://tomee.apache.org/datasource-config.html
> >>
> >>  Hopefully that will help!
> >>
> >>  Richard
> >>
> >>  On Wed, Nov 13, 2019 at 6:03 AM Makarov Alexey <[hidden email]>
> wrote:
> >>
> >>>   Hello!
> >>>   I try to use Arquillian with connection to PostgreSQL database but
> when I
> >>>   run test, it fail becouse server cannot find "org.postgresql.Driver":
> >>>   ...
> >>>   13-Nov-2019 16:57:46.469 SEVERE [main]
> >>>   org.apache.tomee.catalina.ServerListener.lifecycleEvent TomEE
> Listener
> >>>   can't start OpenEJB
> >>>           org.apache.openejb.OpenEJBException:
> >>>   org.apache.xbean.propertyeditor.PropertyEditorException: Unable to
> resolve
> >>>   class org.postgresql.Driver: Unable to resolve class
> org.postgresql.Driver
> >>>   ....
> >>>
> >>>   I check files in ShrinkWrap archive, file with driver exists
> >>>   ("/WEB-INF/lib/postgresql-42.2.8.jar"). I setup my datasource in
> >>>   arqullian.xml:
> >>>
> >>>   <property name="properties">
> >>>                   myDS = new://Resource?type=DataSource
> >>>                   myDS.JdbcUrl = jdbc:postgresql://localhost:5432/mydb
> >>>                   myDS.JdbcDriver = org.postgresql.Driver
> >>>                   myDS.UserName = abc
> >>>                   myDS.Password = xyz
> >>>                   myDS.JtaManaged = true
> >>>   </property>
> >>>
> >>>   I can assume, datasource is loaded earlier than web-archive. I use
> Maven.
> >>>   How I can provide postgresql driver to TomEE is my case?
> >>>
> >>>   --
> >>>   With best regards,
> >>>   Alexey Makarov
> >>
> >>  --
> >>  Richard Monson-Haefel
> >>  https://twitter.com/rmonson
> >>  https://www.linkedin.com/in/monsonhaefel/
>


--
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.linkedin.com/in/monsonhaefel/