After update tomee version ,getting error "jdbc/mydb is not bound in this Context"

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

After update tomee version ,getting error "jdbc/mydb is not bound in this Context"

ishwar
After updating the tomee version from apache-tomee-jaxrs-1.5.2 To
apache-tomee-jaxrs-1.7.4, Getting following exception on thread but there
are other code is executing without thread its working fine.

Name [jdbc/mydb] is not bound in this Context. Unable to find [jdbc].
com.test.test1.PolicyManager-:getUserPreferences: java.sql.SQLException:
PooledConnection has already been closed.


apache-tomee-jaxrs-1.5.2 ->tomee.xml file.

 
  <Resource id="jdbc/mydb1" type="DataSource">
  JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlDataSource    
  JdbcUrl jdbc:mysql://localhost:3306/demmo
  UserName root
  Password root
  JtaManaged false  
  InitialSize 50
  MaxActive 100
  MaxIdle 3
 LogAbandoned true
</Resource>

apache-tomee-jaxrs-1.7.4-> tomee.xml file.

<Resource id="jdbc/mydb" type="javax.sql.DataSource">
  JdbcDriver com.mysql.jdbc.Driver    
  JdbcUrl jdbc:mysql://localhost:3306/demo
  UserName root
  Password root
  JtaManaged false  
  InitialSize 50
  MaxActive 100
  MaxIdle 3
 LogAbandoned true
</Resource>

Web.xml is same. Likes following.
<resource-ref>
                <description>MySQL Datasource example</description>
                <res-ref-name>jdbc/mydb</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
</resource-ref>

The error is coming when the web Applicaiton creating the new thread for
sending the notificaiton.

The same code is working on older version of apache tomee but on new version
it is not working.

any suggestion?




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
Reply | Threaded
Open this post in threaded view
|

Re: After update tomee version ,getting error "jdbc/mydb is not bound in this Context"

Romain Manni-Bucau
Hi

did you ensure you have the right contextclassloader in the threads you
create - the webapp one? If not it can not work deterministicly.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>

2018-03-04 15:37 GMT+01:00 ishwar <[hidden email]>:

> After updating the tomee version from apache-tomee-jaxrs-1.5.2 To
> apache-tomee-jaxrs-1.7.4, Getting following exception on thread but there
> are other code is executing without thread its working fine.
>
> Name [jdbc/mydb] is not bound in this Context. Unable to find [jdbc].
> com.test.test1.PolicyManager-:getUserPreferences: java.sql.SQLException:
> PooledConnection has already been closed.
>
>
> apache-tomee-jaxrs-1.5.2 ->tomee.xml file.
>
>
>   <Resource id="jdbc/mydb1" type="DataSource">
>   JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlDataSource
>   JdbcUrl jdbc:mysql://localhost:3306/demmo
>   UserName root
>   Password root
>   JtaManaged false
>   InitialSize 50
>   MaxActive 100
>   MaxIdle 3
>  LogAbandoned true
> </Resource>
>
> apache-tomee-jaxrs-1.7.4-> tomee.xml file.
>
> <Resource id="jdbc/mydb" type="javax.sql.DataSource">
>   JdbcDriver com.mysql.jdbc.Driver
>   JdbcUrl jdbc:mysql://localhost:3306/demo
>   UserName root
>   Password root
>   JtaManaged false
>   InitialSize 50
>   MaxActive 100
>   MaxIdle 3
>  LogAbandoned true
> </Resource>
>
> Web.xml is same. Likes following.
> <resource-ref>
>                 <description>MySQL Datasource example</description>
>                 <res-ref-name>jdbc/mydb</res-ref-name>
>                 <res-type>javax.sql.DataSource</res-type>
> </resource-ref>
>
> The error is coming when the web Applicaiton creating the new thread for
> sending the notificaiton.
>
> The same code is working on older version of apache tomee but on new
> version
> it is not working.
>
> any suggestion?
>
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>