Quantcast

Datasource problem with TomEE 1.5.2. Works in 1.5.1

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal
I created a small application with datasource definition in resources.xml. It works without any error in TomEE 1.5.1 however, 1.5.2 does not recognize this and datasource does not get created. I am running both servers in Eclipse. Here is how it is done and error messages:

WEB-INF/resources.xml:
---------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<tomee>
<Resource id="defaultDS" type="DataSource">
        JdbcDriver com.mysql.jdbc.Driver
        JdbcUrl jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull
        UserName testdb
        Password SomePass
        JtaManaged false
        MaxActive 20
        MaxIdle 5
        MaxWait 10000
</Resource>
</tomee>

WEB-INF/web.xml
---------------------------------------------------------------------------------------------
. . .
<resource-ref>
                <description>DB Connection</description>
                <res-ref-name>defaultDS</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
        </resource-ref>
. . .

And my code goes something like this:
---------------------------------------------------------------------------------------------
. . .
private DataSource getDataSourceFromJNDI(String jndiDataSourceName) {
                try {
                         InitialContext initialContext = new InitialContext();
                        DataSource dataSource = (DataSource)
                        initialContext.lookup("java:comp/env/defaultDS");
                        return dataSource;
                } catch (NamingException e) {
                        log.error("JNDI error while retrieving " + "java:comp/env/defaultDS", e);
                        throw new AuthorizationException(e);
                }
        }
. . .

While this works great on 1.5.1, I get Exceptions in 1.5.2.
-----------------------------------------------------------------------------------
Error in database operation
java.lang.ClassCastException: org.apache.openejb.core.ivm.naming.IvmContext cannot be cast to javax.sql.DataSource
        at com.example.test.remoteapp.core.utils.DBUtils.getDefaultDataSource(DBUtils.java:48)
        at com.example.test.remoteapp.core.http.SystemContextInitilizer.cleanUserSessions(SystemContextInitilizer.java:95)
        at com.example.test.remoteapp.core.http.SystemContextInitilizer.contextInitialized(SystemContextInitilizer.java:35)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        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)


I'm running from Eclipse Juno SR1 on JDK 1.7.0.21 on Windows 7 64bit. Both 1.5.1 and 1.5.2 are configured in Eclipse. The project uses dependencies from 1.5.2. Tried removing all servers and creating from scratch.

Any help on this is appreciated.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

Romain Manni-Bucau
Hi

Did you try 1.6.0 snapshot?
Le 1 mai 2013 20:37, "OCal" <[hidden email]> a écrit :

> I created a small application with datasource definition in resources.xml.
> It
> works without any error in TomEE 1.5.1 however, 1.5.2 does not recognize
> this and datasource does not get created. I am running both servers in
> Eclipse. Here is how it is done and error messages:
>
> WEB-INF/resources.xml:
>
> ---------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <tomee>
> <Resource id="defaultDS" type="DataSource">
>         JdbcDriver com.mysql.jdbc.Driver
>         JdbcUrl
> jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull
>         UserName testdb
>         Password SomePass
>         JtaManaged false
>         MaxActive 20
>         MaxIdle 5
>         MaxWait 10000
> </Resource>
> </tomee>
>
> WEB-INF/web.xml
>
> ---------------------------------------------------------------------------------------------
> . . .
> <resource-ref>
>                 <description>DB Connection</description>
>                 <res-ref-name>defaultDS</res-ref-name>
>                 <res-type>javax.sql.DataSource</res-type>
>         </resource-ref>
> . . .
>
> And my code goes something like this:
>
> ---------------------------------------------------------------------------------------------
> . . .
> private DataSource getDataSourceFromJNDI(String jndiDataSourceName) {
>                 try {
>                          InitialContext initialContext = new
> InitialContext();
>                         DataSource dataSource = (DataSource)
>                         initialContext.lookup("java:comp/env/defaultDS");
>                         return dataSource;
>                 } catch (NamingException e) {
>                         log.error("JNDI error while retrieving " +
> "java:comp/env/defaultDS", e);
>                         throw new AuthorizationException(e);
>                 }
>         }
> . . .
>
> While this works great on 1.5.1, I get Exceptions in 1.5.2.
>
> -----------------------------------------------------------------------------------
> Error in database operation
> java.lang.ClassCastException: org.apache.openejb.core.ivm.naming.IvmContext
> cannot be cast to javax.sql.DataSource
>         at
>
> com.example.test.remoteapp.core.utils.DBUtils.getDefaultDataSource(DBUtils.java:48)
>         at
>
> com.example.test.remoteapp.core.http.SystemContextInitilizer.cleanUserSessions(SystemContextInitilizer.java:95)
>         at
>
> com.example.test.remoteapp.core.http.SystemContextInitilizer.contextInitialized(SystemContextInitilizer.java:35)
>         at
>
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
>         at
>
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>         at
>
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
>         at
>
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>         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)
>
>
> I'm running from Eclipse Juno SR1 on JDK 1.7.0.21 on Windows 7 64bit. Both
> 1.5.1 and 1.5.2 are configured in Eclipse. The project uses dependencies
> from 1.5.2. Tried removing all servers and creating from scratch.
>
> Any help on this is appreciated.
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Datasource-problem-with-TomEE-1-5-2-Works-in-1-5-1-tp4662607.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

Romain Manni-Bucau
PS: root tag of resources.xml is resources and not tomee

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/5/1 Romain Manni-Bucau <[hidden email]>

> Hi
>
> Did you try 1.6.0 snapshot?
> Le 1 mai 2013 20:37, "OCal" <[hidden email]> a écrit :
>
> I created a small application with datasource definition in resources.xml.
>> It
>> works without any error in TomEE 1.5.1 however, 1.5.2 does not recognize
>> this and datasource does not get created. I am running both servers in
>> Eclipse. Here is how it is done and error messages:
>>
>> WEB-INF/resources.xml:
>>
>> ---------------------------------------------------------------------------------------------
>> <?xml version="1.0" encoding="UTF-8"?>
>> <tomee>
>> <Resource id="defaultDS" type="DataSource">
>>         JdbcDriver com.mysql.jdbc.Driver
>>         JdbcUrl
>> jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull
>>         UserName testdb
>>         Password SomePass
>>         JtaManaged false
>>         MaxActive 20
>>         MaxIdle 5
>>         MaxWait 10000
>> </Resource>
>> </tomee>
>>
>> WEB-INF/web.xml
>>
>> ---------------------------------------------------------------------------------------------
>> . . .
>> <resource-ref>
>>                 <description>DB Connection</description>
>>                 <res-ref-name>defaultDS</res-ref-name>
>>                 <res-type>javax.sql.DataSource</res-type>
>>         </resource-ref>
>> . . .
>>
>> And my code goes something like this:
>>
>> ---------------------------------------------------------------------------------------------
>> . . .
>> private DataSource getDataSourceFromJNDI(String jndiDataSourceName) {
>>                 try {
>>                          InitialContext initialContext = new
>> InitialContext();
>>                         DataSource dataSource = (DataSource)
>>                         initialContext.lookup("java:comp/env/defaultDS");
>>                         return dataSource;
>>                 } catch (NamingException e) {
>>                         log.error("JNDI error while retrieving " +
>> "java:comp/env/defaultDS", e);
>>                         throw new AuthorizationException(e);
>>                 }
>>         }
>> . . .
>>
>> While this works great on 1.5.1, I get Exceptions in 1.5.2.
>>
>> -----------------------------------------------------------------------------------
>> Error in database operation
>> java.lang.ClassCastException:
>> org.apache.openejb.core.ivm.naming.IvmContext
>> cannot be cast to javax.sql.DataSource
>>         at
>>
>> com.example.test.remoteapp.core.utils.DBUtils.getDefaultDataSource(DBUtils.java:48)
>>         at
>>
>> com.example.test.remoteapp.core.http.SystemContextInitilizer.cleanUserSessions(SystemContextInitilizer.java:95)
>>         at
>>
>> com.example.test.remoteapp.core.http.SystemContextInitilizer.contextInitialized(SystemContextInitilizer.java:35)
>>         at
>>
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
>>         at
>>
>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
>>         at
>> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>>         at
>>
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
>>         at
>>
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
>>         at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>         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)
>>
>>
>> I'm running from Eclipse Juno SR1 on JDK 1.7.0.21 on Windows 7 64bit. Both
>> 1.5.1 and 1.5.2 are configured in Eclipse. The project uses dependencies
>> from 1.5.2. Tried removing all servers and creating from scratch.
>>
>> Any help on this is appreciated.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Datasource-problem-with-TomEE-1-5-2-Works-in-1-5-1-tp4662607.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal
>> PS: root tag of resources.xml is resources and not tomee

Done. However, it does not have any effect on 1.5.2, it continues to throw the same error.

Built 1.6.0 snapshot today fresh. Now I do not get that error and Datasource gets initialized. However, there are some other problems with JAX-RS. Even when I tried to access my login page, which works perfectly in 1.5.1, it seems to resolve it to a REST URL... But all my rest endpoints are under /rest/.

When I type http://localhost:8080/dbapp1/login.xhtml, i get this. This works in 1.5.1 though.

May 02, 2013 8:12:09 PM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor processRequest
WARNING: No root resource matching request path  has been found, Relative Path: /. Please enable FINE/TRACE log level for more details.
May 02, 2013 8:12:09 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: javax.ws.rs.WebApplicationException
        at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:158)
        at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:90)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
        at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java:132)
        at org.apache.openejb.server.rest.RsServlet.service(RsServlet.java:53)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

I will try to put up a small application which might be useful.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

Romain Manni-Bucau
Hi,

any rest subclass of Application? if yes any @ApplicationPath or mapping of
this class in the web.xml? if no that's normal, the rest servlet will be
mapped to /* as the spec requires

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/5/2 OCal <[hidden email]>

> >> PS: root tag of resources.xml is resources and not tomee
>
> Done. However, it does not have any effect on 1.5.2, it continues to throw
> the same error.
>
> Built 1.6.0 snapshot today fresh. Now I do not get that error and
> Datasource
> gets initialized. However, there are some other problems with JAX-RS. Even
> when I tried to access my login page, which works perfectly in 1.5.1, it
> seems to resolve it to a REST URL... But all my rest endpoints are under
> /rest/.
>
> When I type http://localhost:8080/dbapp1/login.xhtml, i get this. This
> works
> in 1.5.1 though.
>
> May 02, 2013 8:12:09 PM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor
> processRequest
> WARNING: No root resource matching request path  has been found, Relative
> Path: /. Please enable FINE/TRACE log level for more details.
> May 02, 2013 8:12:09 PM
> org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
> WARNING: javax.ws.rs.WebApplicationException
>         at
>
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:158)
>         at
>
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:90)
>         at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
>         at
>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>         at
>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
>         at
>
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java:132)
>         at
> org.apache.openejb.server.rest.RsServlet.service(RsServlet.java:53)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>         at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>
> I will try to put up a small application which might be useful.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Datasource-problem-with-TomEE-1-5-2-Works-in-1-5-1-tp4662607p4662653.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal
This post was updated on .
Hi,

Romain Manni-Bucau wrote
any rest subclass of Application? if yes any @ApplicationPath or mapping of
this class in the web.xml? if no that's normal, the rest servlet will be
mapped to /* as the spec requires
...
No subclass and entry in the web.xml. I just trimmed my application, there is an .war file which shows the behaviors which helps in testing. That war includes the sources. Also, here are the links:

https://www.dropbox.com/s/16sk7lfg5mqpzlf/tomeetest.war
https://www.dropbox.com/s/0oov9hh2jwdq7ic/tomeetest.zip (Eclipse project)

After deploying the war, one needs to do three things:

1. Check at startup about the datasource creation. There are some messages in console with prefix ">>>>>>> " This happens in startup as implementation of ServletContextListener
1. Access localhost:8080/tomeetest
2. Access localhost:8080/rest/test. By default html response will come.

TomEE 1.5.1 : Everything works when ran from Eclipse. Standalone war deployment fails (just now discovered).

TomEE 1.5.2 : #1 Datasource creation fails. Application undeploys. Both Eclipse and standalone.

TomEE 1.6.0 Snapshot: #1,3 works. #2 fails. It seems to map those JSF pages to rest endpoints. Both Eclipse and standalone.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

Romain Manni-Bucau
that's the case,

map rest endpoints with @ApplicationPath/web.xml and all will be fine

or set the system property openejb.jaxrs.application to false (but i rather
advise you to fix the sub context used by rest part of your app)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/5/2 OCal <[hidden email]>

> Hi,
>
>
> Romain Manni-Bucau wrote
> > any rest subclass of Application? if yes any @ApplicationPath or mapping
> > of
> > this class in the web.xml? if no that's normal, the rest servlet will be
> > mapped to /* as the spec requires
> > ...
>
> No subclass and entry in the web.xml. I just trimmed my application, there
> is an .war file which shows the behaviors which helps in testing. That war
> includes the sources. Also, here are the links:
>
> https://www.dropbox.com/s/16sk7lfg5mqpzlf/tomeetest.war
> https://www.dropbox.com/s/0oov9hh2jwdq7ic/tomeetest.zip (Eclipse project)
>
> After deploying the war, one needs to do three things:
>
> 1. Check at startup about the datasource creation. There are some messages
> in console with prefix ">>>>>>> " This happens in startup as implementation
> of ServletContextListener
> 1. Access localhost:8080/tomeetest
> 2. Access localhost:8080/rest/test. By default html response will come.
>
> TomEE 1.5.1 : Everything works when ran from Eclipse. Standalone it fails
> (just now discovered).
>
> TomEE 1.5.2 : #1 Datasource creation fails. Application undeploys. Both
> Eclipse and standalone.
>
> TomEE 1.6.0 Snapshot: #1,3 works. #2 fails. It seems to map those JSF pages
> to rest endpoints. Both Eclipse and standalone.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Datasource-problem-with-TomEE-1-5-2-Works-in-1-5-1-tp4662607p4662658.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal
Thanks Romain. I will try that and update. Any idea about the DataSource
issue with 1.5.2?

I put the exploded war under apps/ and it seems to be all fine now in 1.5.1
standalone.

OCal.
On May 2, 2013 10:40 PM, "Romain Manni-Bucau" <[hidden email]> wrote:

> that's the case,
>
> map rest endpoints with @ApplicationPath/web.xml and all will be fine
>
> or set the system property openejb.jaxrs.application to false (but i rather
> advise you to fix the sub context used by rest part of your app)
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/5/2 OCal <[hidden email]>
>
> > Hi,
> >
> >
> > Romain Manni-Bucau wrote
> > > any rest subclass of Application? if yes any @ApplicationPath or
> mapping
> > > of
> > > this class in the web.xml? if no that's normal, the rest servlet will
> be
> > > mapped to /* as the spec requires
> > > ...
> >
> > No subclass and entry in the web.xml. I just trimmed my application,
> there
> > is an .war file which shows the behaviors which helps in testing. That
> war
> > includes the sources. Also, here are the links:
> >
> > https://www.dropbox.com/s/16sk7lfg5mqpzlf/tomeetest.war
> > https://www.dropbox.com/s/0oov9hh2jwdq7ic/tomeetest.zip (Eclipse
> project)
> >
> > After deploying the war, one needs to do three things:
> >
> > 1. Check at startup about the datasource creation. There are some
> messages
> > in console with prefix ">>>>>>> " This happens in startup as
> implementation
> > of ServletContextListener
> > 1. Access localhost:8080/tomeetest
> > 2. Access localhost:8080/rest/test. By default html response will come.
> >
> > TomEE 1.5.1 : Everything works when ran from Eclipse. Standalone it fails
> > (just now discovered).
> >
> > TomEE 1.5.2 : #1 Datasource creation fails. Application undeploys. Both
> > Eclipse and standalone.
> >
> > TomEE 1.6.0 Snapshot: #1,3 works. #2 fails. It seems to map those JSF
> pages
> > to rest endpoints. Both Eclipse and standalone.
> >
> > Thanks.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://openejb.979440.n4.nabble.com/Datasource-problem-with-TomEE-1-5-2-Works-in-1-5-1-tp4662607p4662658.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

davidmsalter
I've seen DataSource issues with MySQL when trying to access a datasource this way, which don't seem to happen when you define the datasource in the web.xml file.

I've got an example of defining the datasoure in web.xml at https://github.com/doobrie/todoee

What version of MySQL driver are you using are you using?

Have you tried running against hsql instead of MySQL to see if the problem exists there?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal

Hi David, its not due to mysql. I uploaded a sample app (there are links in this thread). Its happening with hsqldb too in 1.5.2. 1.5.1 and 1.6 snapshot are fine.

On May 3, 2013 1:27 AM, "davidmsalter [via OpenEJB]" <[hidden email]> wrote:
I've seen DataSource issues with MySQL when trying to access a datasource this way, which don't seem to happen when you define the datasource in the web.xml file.

I've got an example of defining the datasoure in web.xml at https://github.com/doobrie/todoee

What version of MySQL driver are you using are you using?

Have you tried running against hsql instead of MySQL to see if the problem exists there?


If you reply to this email, your message will be added to the discussion below:
http://openejb.979440.n4.nabble.com/Datasource-problem-with-TomEE-1-5-2-Works-in-1-5-1-tp4662607p4662667.html
To unsubscribe from Datasource problem with TomEE 1.5.2. Works in 1.5.1, click here.
NAML
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

davidmsalter
Hi,

I've just downloaded your sample app and tried it out and it seemed to work fine on 1.5.2

The only difference I can see is that I defined my datasource in the conf/tomee.xml file

<?xml version="1.0" encoding="UTF-8"?>
<tomee>
 
  <Resource id="ToDoDataSource" type="DataSource">
          JdbcDriver org.hsqldb.jdbcDriver
                  JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
                  UserName sa
                  Password
                  JtaManaged true
  </Resource>
</tomee>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal
I guess then the problem appears when you define it in resources.xml. I will try the tomee.xml approach.

OCal.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

OCal
Yes, defining in tomee.xml works in 1.5.2. Resources.xml works in 1.5.1 and 1.6 snapshot.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Datasource problem with TomEE 1.5.2. Works in 1.5.1

davidmsalter
I'm pleased its now working in 1.5.2 although with changes.

I've created a JIRA issue about this.

https://issues.apache.org/jira/browse/TOMEE-924
Loading...