You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Makarov Alexey <al...@yandex.ru> on 2019/11/13 12:03:45 UTC

Arquillian and PostgreSQL driver

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


Re: Arquillian and PostgreSQL driver

Posted by Richard Monson-Haefel <mo...@gmail.com>.
Woot!  Glad you figured it out!

On Fri, Nov 15, 2019 at 9:07 PM Makarov Alexey <al...@yandex.ru> 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" <al...@yandex.ru>:
> > 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" <mo...@gmail.com>:
> >>  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 <al...@yandex.ru>
> 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/

Re: Arquillian and PostgreSQL driver

Posted by Makarov Alexey <al...@yandex.ru>.
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" <al...@yandex.ru>:
> 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" <mo...@gmail.com>:
>>  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 <al...@yandex.ru> 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/

Re: Arquillian and PostgreSQL driver

Posted by Makarov Alexey <al...@yandex.ru>.
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" <mo...@gmail.com>:
> 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 <al...@yandex.ru> 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/

Re: Arquillian and PostgreSQL driver

Posted by Richard Monson-Haefel <mo...@gmail.com>.
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 <al...@yandex.ru> 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/