[jboss-user] [EJB 3.0] - jdbc Query Timeout ( Is This a Bug? )
grdzeli_kaci
do-not-reply at jboss.com
Tue Jan 30 08:02:13 EST 2007
hi all,
i have one problem whole week, and could not resolve.
enviroment :
1. AS - Jboss Application Server 4.0.4 GA or Jboss Application Server 4.04 GA (i tryed both of them)
2.ThierdParty/Database - Oracle Timesten In Memory DataBase
3.EJB 3.0.EJB3 RC7 (for JBoss 4.0.4) EJB 3.0.EJB3 RC9 Patch 1 (For JBoss 4.0.5)
4.OS - Solaris, Suse Linux, Windows XP (I tryed on all of them)
5.ThierdParty/DataBase Driver - classes14.jar (1.5.0_04 (Sun Microsystems Inc.))
task : i need use named query search from session beans
my project snipets:
1. jboss Timesten Datasource Configuration :
| <datasources>
| <xa-datasource>
| <jndi-name>TimesTenXAClientDS</jndi-name>
| <xa-datasource-class>
| com.timesten.jdbc.xa.TimesTenXADataSource
| </xa-datasource-class>
| <xa-datasource-property name="Url">
| jdbc:timesten:client:Test34
| </xa-datasource-property>
| <user-name></user-name>
| <password></password>
| <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
| <!--pooling parameters-->
| <min-pool-size>5</min-pool-size>
| <max-pool-size>100</max-pool-size>
| <blocking-timeout-millis>5000</blocking-timeout-millis>
| <idle-timeout-minutes>15</idle-timeout-minutes>
| <prepared-statement-cache-size>32</prepared-statement-cache-size>
| <track-connection-by-tx/>
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
| <metadata>
| <type-mapping>TimesTen</type-mapping>
| </metadata>
| </xa-datasource>
| </datasources>
|
2. Database Table :
| create table "RT"."SUBSCRIBERS" ("SUBSCRIBERID" INTEGER not null,
| "CHARGINGPROFILEID" INTEGER not null, "STATUSID" INTEGER not null,
| "TSTAMP" BINARY(8), constraint "RT"."SUBSCRIBERS" primary key
| ("SUBSCRIBERID"))
|
3. Entity Bean :
| package com.magti.businesslayer.ejb3entity.oracle;
| import java.io.Serializable;
| import org.apache.commons.lang.builder.ToStringBuilder;
| import javax.persistence.*;
|
| @NamedQueries
| ({
| @NamedQuery(name="Subscriber.getSubscriber",query="select e from Subscriber e where e.subscriberid = :subsId")
| })
|
| @Entity()
| @Table(name="SUBSCRIBERS", schema="RT")
| public class Subscriber implements Serializable {
| //default serial version id, required for serializable classes.
| private static final long serialVersionUID = 1L;
| private Integer subscriberid;
| private int chargingprofileid;
| private int statusid;
| private byte [] tstamp;
|
| public Subscriber() {
| }
|
| @Id()
| @Column(name="SUBSCRIBERID", unique=true, nullable=false, precision=10)
| public Integer getSubscriberid() {
| return this.subscriberid;
| }
| public void setSubscriberid(Integer subscriberid) {
| this.subscriberid = subscriberid;
| }
|
| @Basic()
| @Column(name="CHARGINGPROFILEID", nullable=false, precision=10)
| public int getChargingprofileid() {
| return this.chargingprofileid;
| }
| public void setChargingprofileid(int chargingprofileid) {
| this.chargingprofileid = chargingprofileid;
| }
|
| @Basic()
| @Column(name="STATUSID", nullable=false, precision=10)
| public int getStatusid() {
| return this.statusid;
| }
| public void setStatusid(int statusid) {
| this.statusid = statusid;
| }
|
| public String toString() {
| return new ToStringBuilder(this)
| .append("subscriberid", getSubscriberid())
| .toString();
| }
| @Basic()
| @Column(name="TSTAMP", nullable=true)
| public byte[] getTstamp() {
| return tstamp;
| }
|
| public void setTstamp(byte[] tstamp) {
| this.tstamp = tstamp;
| }
| }
|
4. Remote Interface :
| package com.magti.businesslayer.ejb3entity.businesslayer;
| import javax.ejb.Remote;
| @Remote
| public interface SubscriberOperations {
| public void insertSubscriber() throws Exception;
| public void updateSubscriber() throws Exception;
| public void getSubscriber() throws Exception;
| }
|
4. Remote Interface Implementation (Session bean) :
| package com.magti.businesslayer.ejb3entity.businesslayer;
|
| import java.util.List;
|
| import javax.ejb.Remote;
| import javax.ejb.Stateful;
| import javax.ejb.TransactionAttribute;
| import javax.ejb.TransactionAttributeType;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import com.magti.businesslayer.ejb3entity.businesslayer.SubscriberOperations;
| import com.magti.businesslayer.ejb3entity.oracle.Subscriber;
|
| @Remote(SubscriberOperations.class)
| @Stateful
| public class SubscriberOperationsBean implements SubscriberOperations {
|
| @PersistenceContext(unitName = "Blaaaaaaaaaaaaaaaaa")
| private EntityManager timeStenMan;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void insertSubscriber() throws Exception {
| try {
| System.out.println("Start Persisting");
| Subscriber subscriber = new Subscriber();
| subscriber.setTstamp(null);
| subscriber.setChargingprofileid(123123123);
| subscriber.setStatusid(123123123);
| timeStenMan.persist(subscriber);
| System.out.println("End Of Persisting");
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void updateSubscriber() throws Exception {
| try {
|
| System.out.println("Start Updateing");
| Subscriber subscriber = new Subscriber();
| subscriber.setSubscriberid(606244);
| subscriber.setTstamp(null);
| subscriber.setChargingprofileid(312312312);
| subscriber.setStatusid(312312312);
| timeStenMan.merge(subscriber);
| System.out.println("End Of Updateing");
|
| } catch (Exception e) {
| e.printStackTrace();
| }
|
| }
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void getSubscriber() throws Exception {
| try {
| System.out.println("Start Searching");
| List<Subscriber> subscribers = (List<Subscriber>) timeStenMan
| .createNamedQuery("Subscriber.getSubscriber").setParameter(
| "subsId", new Integer(606244)).getResultList();
| System.out.println("End Of Searching");
|
| System.out.println("List Size = " + subscribers.size());
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
5. persistance.xml file :
| <?xml version="1.0" encoding="ISO-8859-1" ?>
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="Blaaaaaaaaaaaaaaaaa">
| <jta-data-source>java:/TimesTenXAClientDS</jta-data-source>
| <class>com.magti.businesslayer.ejb3entity.oracle.Subscriber</class>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
| <property name="hibernate.connection.driver_class" value="com.timesten.jdbc.xa.TimesTenXADataSource"/>
| <property name="hibernate.connection.url" value="jdbc:timesten:client:Test34"/>
| <property name="hibernate.connection.username" value=""/>
| <property name="hibernate.connection.password" value=""/>
| <property name="hibernate.default_schema" value="RT"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.format_sql" value="true"/>
| </properties>
| </persistence-unit>
| </persistence>
|
6. and at last my test client :
| package com.magti.businesslayer.ejb3entity.oracle;
|
| import java.util.Properties;
|
| import javax.naming.Context;
| import javax.naming.InitialContext;
|
| import com.magti.businesslayer.ejb3entity.businesslayer.SubscriberOperations;
|
| public class TestMain {
| public static void main(String[] args) {
| try {
| Properties jndiProps = new Properties();
| jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| jndiProps.setProperty(Context.URL_PKG_PREFIXES,
| "org.jboss.naming:org.jnp.interface");
| jndiProps.setProperty(Context.PROVIDER_URL,
| "jnp://192.168.9.136:1099");
| InitialContext ctx = new InitialContext(jndiProps);
|
| SubscriberOperations ops = (SubscriberOperations) ctx
| .lookup("SubscriberOperationsBean/remote");
|
| // Test Searching
| ops.getSubscriber();
| // End Of Test Searching
|
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
and i get an error like this :
| java.sql.SQLException: [TimesTen][TimesTen 6.0.4 CLIENT]Query Timeout must be numeric, greater than or equal to 0, and less than the Network Timeout
| at com.timesten.jdbc.JdbcOdbc.createSQLException(JdbcOdbc.java:7307)
| at com.timesten.jdbc.JdbcOdbc.standardError(JdbcOdbc.java:7440)
| at com.timesten.jdbc.JdbcOdbc.standardError(JdbcOdbc.java:7405)
| at com.timesten.jdbc.JdbcOdbc.SQLSetStmtOption(JdbcOdbc.java:6679)
| at com.timesten.jdbc.JdbcOdbcStatement.setStmtOption(JdbcOdbcStatement.java:1883)
| at com.timesten.jdbc.JdbcOdbcStatement.setQueryTimeout(JdbcOdbcStatement.java:720)
| at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.close(CachedPreparedStatement.java:339)
| at org.jboss.resource.adapter.jdbc.WrappedStatement.internalClose(WrappedStatement.java:588)
| at org.jboss.resource.adapter.jdbc.WrappedStatement.close(WrappedStatement.java:73)
| at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:526)
| at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:265)
| at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:281)
| at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:209)
| at org.hibernate.loader.Loader.doQuery(Loader.java:714)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
| at org.hibernate.loader.Loader.doList(Loader.java:2145)
| at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
| at org.hibernate.loader.Loader.list(Loader.java:2024)
| at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
| at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
| at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:53)
| at com.magti.businesslayer.ejb3Fasade.srvprov.MobileServiceFasadeBean.test(MobileServiceFasadeBean.java:1467)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:297)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
| 30 Jan 07 12:31:23, DEBUG org.apache.commons.logging.impl.Log4JLogger:debug:84 about to open ResultSet (open ResultSets: 0, globally: 0)
| 30 Jan 07 12:31:23, WARN org.apache.commons.logging.impl.Log4JLogger:warn:104 SQL Error: 0, SQLState: S1000
| 30 Jan 07 12:31:23, DEBUG org.apache.commons.logging.impl.Log4JLogger:debug:84 result row:
| 30 Jan 07 12:31:23, ERROR org.apache.commons.logging.impl.Log4JLogger:error:114 [TimesTen][TimesTen 6.0.4 CLIENT]Query Timeout must be numeric, greater than or equal to 0, and less than the Network Timeout
| 30 Jan 07 12:31:23, DEBUG org.apache.commons.logging.impl.Log4JLogger:debug:84 about to close ResultSet (open ResultSets: 1, globally: 1)
| 30 Jan 07 12:31:23, DEBUG org.apache.commons.logging.impl.Log4JLogger:debug:84 about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
| 30 Jan 07 12:31:23, DEBUG org.apache.commons.logging.impl.Log4JLogger:debug:84 aggressively releasing JDBC connection
| 30 Jan 07 12:31:23, DEBUG org.apache.commons.logging.impl.Log4JLogger:debug:84 releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
|
|
i thougt that it mey be bug in timesten but when i tryed the same task without jboss and ejb 3 into stand alone client it works ....
is there any idea ? :(
i am nto sure but i think this bug into hibrnate or jboss.
if this is a bug can i report it in jira ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008271#4008271
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008271
More information about the jboss-user
mailing list