[Persistence, JBoss/CMP, Hibernate, Database] - "The result set is closed." error on SQL Server
by ro.dondi
I have a problem with my application running in jboss 4.2.2. I recive randomly the following error:
java.sql.SQLException: The result set is closed.
| at org.jboss.resource.adapter.jdbc.WrappedResultSet.checkState(WrappedResultSet.java:1939)
| at org.jboss.resource.adapter.jdbc.WrappedResultSet.next(WrappedResultSet.java:1181)
while processing a resultset in a stateless session bean. The bean is invoked by a web layer not directly, but through a session facade. I can reproduce this error running a test application made with Selenium. This test case reproduce several time the same user navigation flow. The test case uses few stateless session bean: everyone makes a query to the db using stored procedures. The error occurs not in the same piece of code everytime, but in different db call. Every call to ejb layer is synchronized. I check that every connections is closed after the use.
Checking the connection pool i verified that only one connection is used.
Follows the datasource definition.
<local-tx-datasource>
| <jndi-name>myDS</jndi-name>
| <connection-url>jdbc:microsoft:sqlserver://dbserver:1433;SelectMethod=cursor;DatabaseName=myDBSchema</connection-url>
| <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
| <user-name>user</user-name>
| <password>password</password>
| <!-- sql to call when connection is created
| <new-connection-sql>some arbitrary sql</new-connection-sql>
| -->
| <min-pool-size>1</min-pool-size>
| <max-pool-size>10</max-pool-size>
| <idle-timeout-minutes>15</idle-timeout-minutes>
| <blocking-timeout-millis>5000</blocking-timeout-millis>
|
| <!-- sql to call on an existing pooled connection when it is obtained from pool
| <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
| -->
|
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
| <metadata>
| <type-mapping>MS SQLSERVER2000</type-mapping>
| </metadata>
| </local-tx-datasource>
This error occurs using also Sql Server 2005.
Any suggestions?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145076#4145076
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145076
18 years, 3 months
[Beginners Corner] - ClassCastException accessing a DataSource
by riflevolunteer
Hi
I know this as been discussed elsewhere loads of times and I have searched and searched and tried everything and still I get the same error. I'm sure its something simple but I just don't know enough to figure it out.
I have a MySql database which I am trying to get the DataSource for using JNDI on a JBOSS 4.2.2 see all details below:
JBoss 4.2.2
MySQL 5.0
Eclipse 3.3.2
JNDI Properties
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
server/deploy/mysql-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://localhost:3306/andy_test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>user</user-name>
pword
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<type-mapping>mySQL</type-mapping>
</local-tx-datasource>
simple code
import java.sql.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class DataSource {
public static void main(String[] args) {
InitialContext ic;
try {
InitialContext ic;
DataSource ds =(DataSource)ic.lookup("MySqlDS");
} catch (NamingException e) {
e.printStackTrace();
}
catch (ClassCastException e){
e.printStackTrace();
}
}
}
When I run this I get this error:
java.lang.ClassCastException: $Proxy0
at DataSource.main(DataSource.java:12)
If anyone can advise me whether I'm doing something fundamentally wrong or a configuration error.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145071#4145071
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145071
18 years, 3 months