NestedSQLException: Unable to get managed connection

3,826 views
Skip to first unread message

Arnaud MORIN

unread,
Mar 8, 2011, 11:17:49 AM3/8/11
to mobicent...@googlegroups.com
Hi all,

I am using JBOSS + Mobicent and would like my project to connect to MySQL databases. For this, I added the MySQL connector (jar file) to my server/default/lib/ folder.
I also added a mysql-ds.xml file with the following values:

# cat mysql-ds.xml
<datasources>
     <local-tx-datasource>
          <jndi-name>l4ecJdbcResource</jndi-name>
          <use-java-context>false</use-java-context>
          <connection-url>jdbc:mysql://db.emerginov.local:3306/moodle</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>root</user-name>
          <password>password</password>
     </local-tx-datasource>
</datasources>

Unfortunately, when a deployed application tried to connect to the locale datasource, I got the following error:

org.jboss.util.NestedSQLException: Unable to get managed connection for l4ecJdbcResource; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for l4ecJdbcResource)
     at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
     at net.genaker.lms.database.DBManager.getConnection(DBManager.java:90)
     at net.genaker.lms.authentication.UserSessionManager.login(UserSessionManager.java:106)
     at net.genaker.oki.osids.authentication.AuthenticationManager.authenticateUser(AuthenticationManager.java:72)
     at net.genaker.l4ec.beans.UserBean.checkAuthentication(UserBean.java:102)
     at net.genaker.l4ec.beans.UserBean.answerAction(UserBean.java:139)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...


Did anyone already had this kind of error? How can I solve it?

Regards,
Arnaud.

Amit Bhayani

unread,
Mar 8, 2011, 12:05:54 PM3/8/11
to mobicent...@googlegroups.com, Arnaud MORIN
Can you show how you doing lookup of datasource?

Most probably its because you have specified <use-java-contextType>false</use-java-context> and in lookup you would have java:

aayush

unread,
Mar 8, 2011, 12:08:52 PM3/8/11
to mobicents-public
May be due to a variety of reasons.

Does db.emerginov.local resolve to an IP address ? Do you have a DNS
configured?

It will be helpful if you can print the whole stack trace.

Possible causes:

-- No GRANTs provided by the DBA to your ip/username
-- Connection refusal (broken connection)


On Mar 8, 9:17 pm, Arnaud MORIN <arnaud.mo...@gmail.com> wrote:
> Hi all,
>
> I am using JBOSS + Mobicent and would like my project to connect to MySQL
> databases. For this, I added the MySQL connector (jar file) to my
> server/default/lib/ folder.
> I also added a mysql-ds.xml file with the following values:
>
> # cat mysql-ds.xml
> <datasources>
>      <local-tx-datasource>
>           <jndi-name>l4ecJdbcResource</jndi-name>
>           <use-java-context>false</use-java-context>
>
> <connection-url>jdbc:mysql://db.emerginov.local:3306/moodle</connection-url >
>
>           <driver-class>com.mysql.jdbc.Driver</driver-class>
>           <user-name>root</user-name>
>           <password>password</password>
>      </local-tx-datasource>
> </datasources>
>
> Unfortunately, when a deployed application tried to connect to the locale
> datasource, I got the following error:
>
> org.jboss.util.NestedSQLException: Unable to get managed connection for
> l4ecJdbcResource; - nested throwable: (javax.resource.ResourceException:
> Unable to get managed connection for l4ecJdbcResource)
>      at
> org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperData Source.java:95)
>
>      at net.genaker.lms.database.DBManager.getConnection(DBManager.java:90)
>      at
> net.genaker.lms.authentication.UserSessionManager.login(UserSessionManager. java:106)
>
>      at
> net.genaker.oki.osids.authentication.AuthenticationManager.authenticateUser (AuthenticationManager.java:72)

Arnaud MORIN

unread,
Mar 9, 2011, 8:40:30 AM3/9/11
to mobicent...@googlegroups.com, aayush
Hi all,

Thanks for the reply.

The db.emerginov.local resolve to an IP address  (and yes, I have a DNS configured in my network).
I can connect on db.emerginov.local from this server. But you were right, my user (root) did not have the right to connect over the DB from this machine.

Moreover, the machine was overloaded (disk space) and JBOSS was not working well because of that.

I am currently resolving this two issues and I'll let you know if everything is working well.

Cheers,
Arnaud.
Reply all
Reply to author
Forward
0 new messages