RE: [JBoss-user] error while trying to open a new connection
Hi Adrian Thanks you very much for the quick response. The issue described in the earlier mail(below) has been solved while using jboss-3.2.2RC4 ( latest jboss release ), as advised by you. Now i am facing a new error. java.sql.SQLException: You cannot commit with autocommit set! I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) ), code is given below: === public Connection getConnection(){ String m_strDefaultDataSource =java:comp/env/jdbc/Data; InitialContext ic = new InitialContext(); DataSource m_dsCommmon = ( DataSource ) ic.lookup( m_strDefaultDataSource ); m_dbCon = m_dsCommmon.getConnection(); m_dbCon.setAutoCommit(false); return m_dbCon; } private boolean storeSignInDetails(String strUserName,String strClientIp , Connection m_dbCon){ String strUserId= getUserId(); strUserId = ( null == strUserId )?Invalid:strUserId; String strQuery =//sql statement for logging // try{ Statement stmt = m_dbCon.createStatement(); int iCount = stmt.executeUpdate(strQuery); m_dbCon.commit(); }catch(Exception e){ e.printStackTrace(); return false; } return true; } // Also pls note that i am not closing the connection, as this is used for further transaction. // We are using bean managed transaction . We are handling the transaction using JDBC only (not using JavaTransaction API). //Initially after successful logging of the user, the user details are logged and it is commited ( Given in the above function --storeSignInDetails () ). //Later it is commited , only when the user finishes his transaction. // So we need to use setAutoCommit( false ); Is there any way to prevent this issue Also can u please clarify as to what JBoss is expecting. Do we need to disable CachedConnectionManager?? 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit BaseWrapperManagedConnection.java:494) 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465) 10:45:37,859 ERROR [STDERR] at com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318) -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 8:39 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] error while trying to open a new connection You'll have to provide some more information. It says you are closing a connection that it does not know about were there previous errors? There has been some cleanup of the error checking in the 3.2.2RC releases can you check if you still have the problem with 3.2.2RC4? This actual error shouldn't cause any problems it is a sanity check in the internal datastructure tidyup code. I would expect the connection has already been tidied up by a previous error? Regards, Adrian On Tue, 2003-09-23 at 15:46, rajeshnn wrote: Hi All While trying to create a new connection before closing an existing connection the following error occured. Can anyone pls help.. java.lang.IllegalStateException: Trying to return an unknown connection2! org.jboss.resource.adapter [EMAIL PROTECTED] at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedC onnectionManager.java:275) at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connec tionClosed(TxConnectionManager.java:550) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManag edConnection.java:280) at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:127) 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:324) at org.jboss.resource.connectionmanager.CachedConnectionManager.closeAll(CachedConnectionMan Rajesh N Nair SunTec Business Solution, # 311, Nila ,Technopark, Trivandrum, Kerala, India. Pin:695581. Phone ( +91-471-2700984-95) __ This electronic mail (including any attachment thereto) may be confidential and privileged and is intended only for the individual or entity named above. Any unauthorized use, printing, copying, disclosure or dissemination of this communication may be subject to
[JBoss-user] Bad SQL generated for Sybase 12.0
Running JBoss 3.0.6, running a finder on a entity bean, JBoss generates a load query like: select field1, field2, field3 from MY_TABLE where ID = 1 or ID = 2 or ID = 3 ... Normally this code is fine, however, the finder happens to find more than 250 rows, and Sybase ASE12.0 does not like where clauses with more than 250 ANDs or ORs. I tried changing the select statement to Select field1, field2, field3 from MY_TABLE where ID in (1, 2, 3...) but this produced the same error message. It seems Sybase translates the IN clause to a series of ORs. Is the only work around to upgrade to 3.2.2 and use LIMIT and OFFSET to get around the problem? Yes, I know this is probably a better solution in the long run, but... Any advice would be appreciated. Ciao, Jonathan O'Connor XCOM Dublin --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Bad SQL generated for Sybase 12.0
You can limit the ORs generated using the page-size on the read-ahead. Regards, Adrian On Wed, 2003-09-24 at 11:01, Jonathan.O'[EMAIL PROTECTED] wrote: Running JBoss 3.0.6, running a finder on a entity bean, JBoss generates a load query like: select field1, field2, field3 from MY_TABLE where ID = 1 or ID = 2 or ID = 3 ... Normally this code is fine, however, the finder happens to find more than 250 rows, and Sybase ASE12.0 does not like where clauses with more than 250 ANDs or ORs. I tried changing the select statement to Select field1, field2, field3 from MY_TABLE where ID in (1, 2, 3...) but this produced the same error message. It seems Sybase translates the IN clause to a series of ORs. Is the only work around to upgrade to 3.2.2 and use LIMIT and OFFSET to get around the problem? Yes, I know this is probably a better solution in the long run, but... Any advice would be appreciated. Ciao, Jonathan O'Connor XCOM Dublin --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user -- Adrian Brock Director of Support Back Office JBoss Group, LLC --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] error while trying to open a new connection
Again you'll have to give me some information. Where is getConnection() invoked and where do you store the connection? What is done between getting the connection and the commit()? Is this a StatefulSessionBean? What is the deployment descriptor for the resource-ref? What does the following return just before the commit(): m_dbCon.getAutoCommit(); ((org.jboss.resource.adapter.jdbc.WrappedConnection) m_dbCon).getUnderylingConnection().getAutoCommit(); You know this kind of pattern won't scale. You are not using the pool. You will need one db connection per user. Regards, Adrian On Wed, 2003-09-24 at 07:48, rajeshnn wrote: Hi Adrian Thanks you very much for the quick response. The issue described in the earlier mail(below) has been solved while using jboss-3.2.2RC4 ( latest jboss release ), as advised by you. Now i am facing a new error. java.sql.SQLException: You cannot commit with autocommit set! I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) ), code is given below: === public Connection getConnection(){ String m_strDefaultDataSource =java:comp/env/jdbc/Data; InitialContext ic = new InitialContext(); DataSource m_dsCommmon = ( DataSource ) ic.lookup( m_strDefaultDataSource ); m_dbCon = m_dsCommmon.getConnection(); m_dbCon.setAutoCommit(false); return m_dbCon; } private boolean storeSignInDetails(String strUserName,String strClientIp , Connection m_dbCon){ String strUserId= getUserId(); strUserId = ( null == strUserId )?Invalid:strUserId; String strQuery =//sql statement for logging // try{ Statement stmt = m_dbCon.createStatement(); int iCount = stmt.executeUpdate(strQuery); m_dbCon.commit(); }catch(Exception e){ e.printStackTrace(); return false; } return true; } // Also pls note that i am not closing the connection, as this is used for further transaction. // We are using bean managed transaction . We are handling the transaction using JDBC only (not using JavaTransaction API). //Initially after successful logging of the user, the user details are logged and it is commited ( Given in the above function --storeSignInDetails () ). //Later it is commited , only when the user finishes his transaction. // So we need to use setAutoCommit( false ); Is there any way to prevent this issue Also can u please clarify as to what JBoss is expecting. Do we need to disable CachedConnectionManager?? 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit BaseWrapperManagedConnection.java:494) 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465) 10:45:37,859 ERROR [STDERR] at com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318) -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 8:39 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] error while trying to open a new connection You'll have to provide some more information. It says you are closing a connection that it does not know about were there previous errors? There has been some cleanup of the error checking in the 3.2.2RC releases can you check if you still have the problem with 3.2.2RC4? This actual error shouldn't cause any problems it is a sanity check in the internal datastructure tidyup code. I would expect the connection has already been tidied up by a previous error? Regards, Adrian On Tue, 2003-09-23 at 15:46, rajeshnn wrote: Hi All While trying to create a new connection before closing an existing connection the following error occured. Can anyone pls help.. java.lang.IllegalStateException: Trying to return an unknown connection2! org.jboss.resource.adapter [EMAIL PROTECTED] at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedC onnectionManager.java:275) at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connec tionClosed(TxConnectionManager.java:550) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManag edConnection.java:280) at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:127) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
Re: [JBoss-user] Application is hanging
If it is a hang press ctrl-\ or kill -3 {jboss_pid} to get a threaddump. This should tell you where it is hanging. Regards, Adrian On Wed, 2003-09-24 at 11:42, Jon Haugsand wrote: A possible dead lock in our application. Shouldn't this be detected? And since everything runs in the same transaction context, I cannot think of any reason for it: 12:19:59,720 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.100078.] 12:19:59,720 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.100077.] 12:19:59,721 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.100071.] 12:19:59,721 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.100079.] 12:21:19,724 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.6.] 12:21:23,661 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.100081.] 12:22:25,553 WARN [AbstractInstanceCache] Unable to passivate due to ctx lock, id=[.100082.] We are running 3.2.1 on Linux. Any suggestion on where to look? -- Adrian Brock Director of Support Back Office JBoss Group, LLC --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] Exception Sorter Information
On Wed, 2003-09-24 at 12:49, Ricardo Coutinho wrote: Hi Adrian, I downloaded 3.2.2rc4 and it showed the problem :) Thanks a lot. Working great now. Do you have an idea of when 3.2.2 will be finalised and released? I prefer the valid-connection-checker-class-name approach to the check-valid-connection-sql As always, it will be released when it is ready. :-) i.e. all issues are resolved Regards, Adrian Ricardo Ricardo Coutinho Software Engineer Odyssey Asset Management Systems S.A. Espace Kirchberg-Eolis 26-28, rue Edward Steichen L-2540 Luxembourg-Kirchberg Direct Line:+352 42 60 80 4425 fax: +352 42 91 92 http://www.odyssey-group.com -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: 23 September 2003 18:32 To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] Exception Sorter Information On Tue, 2003-09-23 at 17:18, Ricardo Coutinho wrote: Hi Adrian, It is likely there are other connections still in the pool that are also invalid if the problem is due a temporary outage. I understand the underlying connection being closed when I return true, it make sense. What I don't understand is why other connections in the pool don't re-request the underlying connection. Is this 'by design'? Because JBoss does not know they are invalid. Only when they are used will the problem be discovered. Hence the valid connection checking: Regarding the check-valid-connection-sql tag. I assume I add that to the xxx-ds.xml file? If so then Jboss don't like it much when I added the following to the xml file: check-valid-connection-sqlselect piroot from odcdta/macpivo0 where piroot='xxxyyyzzz'/check-valid-connection-sql I get loads of the following: .. 18:14:23,013 INFO [TxConnectionManager$TxConnectionEventListener] Unregistered handle that was not registered! null for managedConnection: [EMAIL PROTECTED] The SQL failed (3.2.2 dumps the SQLException so you can see why) 18:13:22,107 WARN [JBossManagedConnectionPool] Destroying connection that could not be successfully matched: [EMAIL PROTECTED] The connection is destroyed because of the validity check failure. 18:13:22,107 INFO [JBossManagedConnectionPool] Exception destroying ManagedConnection .. Regards, Adrian I am using Jboss 3.2.1 Ricardo Ricardo Coutinho Software Engineer Odyssey Asset Management Systems S.A. Espace Kirchberg-Eolis 26-28, rue Edward Steichen L-2540 Luxembourg-Kirchberg Direct Line:+352 42 60 80 4425 fax: +352 42 91 92 http://www.odyssey-group.com -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: 23 September 2003 16:26 To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] Exception Sorter Information The ExceptionSorter returning true causes the underlying connection to be closed, but only that connection. It is likely there are other connections still in the pool that are also invalid if the problem is due a temporary outage. You won't find this out until you try to use them. You can supply a check-valid-connection-sql that jboss runs before handing out a connection from the pool. e.g. select 1 from a_fast_access_table 3.2.2RC4 includes valid-connection-checker-class-name that can implement faster mechanisms than running sql statements. Regards, Adrian On Tue, 2003-09-23 at 10:30, Ricardo Coutinho wrote: Hi All, I have implemented an ExceptionSorter for my AS400 connection. The reconnect works, eventually, but only after it fails one time to recreate the connection. In other words, when the connection is lost, I get an error when reusing the connection. Then after another attempt it manages to reconnect again. Is this the normal behaviour? Here is the configuration of my datasource datasources local-tx-datasource jndi-nameODCDTA/jndi-name connection-urljdbc:as400:IP-ADDRESS/ODCDTA;Libraries=ODCDTA/connection-url driver-classcom.ibm.as400.access.AS400JDBCDriver/driver-class idle-timeout-minutes5/idle-timeout-minutes application-managed-security/ exception-sorter-class-namecom.odc.server.jboss.jdbc.AS400ExceptionSorter/exception-sorter-class-name /local-tx-datasource /datasources and here is the content of the isExceptionFatal method of my exception sorter public boolean isExceptionFatal(SQLException e) { boolean ret = false; if(e != null e.getSQLState() != null) ret = (e.getSQLState().equals(08003) || e.getSQLState().equals(08S01) || e.getSQLState().equals(40003)); if(ret) getLogger().debug(Connection closed by AS400. SQLState=( + e.getSQLState() + ). Forcing reconnect. Error recieved:\n + e.getMessage()); return ret; } Is the
Re: [JBoss-user] RE: method-intf tag should be one of: 'Home', 'Remote', 'LocalHom e', 'Local
On Wed, 2003-09-24 at 10:49, Amit Ashok wrote: Hi All , As per MethodMetaData in Jboss method-intf tag is fully supported my ejb-jar.xml has method-intf tag . and it uses Remote as the attribute but while deploying I always get the error message method-intf tag should be one of: 'Home', 'Remote', 'LocalHome', 'Local. Can any one explain this . my ejb-jar.xml is attached. Some of them are method-intfremote/method-intf it should be method-intfRemote/method-intf Regards, Adrian Thanks Amit Ashok --- NOTICE This email and any files transmitted with it are confidential and are solely for the use of the individual or entity to which it is addressed. Any use, distribution, copying or disclosure by any other person is strictly prohibited. If you receive this transmission in error, please notify the sender by reply email and then destroy the message. Opinions, conclusions and other information in this message that do not relate to official business of NIIT shall be understood to be neither given nor endorsed by NIIT. Any information contained in this email, when addressed to NIIT Clients is subject to the terms and conditions in governing client contract. -- Adrian Brock Director of Support Back Office JBoss Group, LLC --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] ClassCircularityError-QueuedPessimisticEJBLock$TxLock
Can someone please point me towards some documentation which describes the advantage of the UnifiedClassLoader model over the tree-based class loading model? We purchased the JBoss documentation and all it says in the administrators guide is that JBoss 3.x employs a new class loading architechture that facilitates sharing of classes across deployment units. It also mentions that prior to this architecture, MBeans were not hot-deployable. Is this basically saying that it allows you to hot-deploy a component without having to re-deploy those components which depend on it and its classes? Any help here would be appreciated. Thanks, Rob
[JBoss-user] JBossSX Question
Hi, I've got a webapp deployed in a JBoss 3.2.2 server making RMI calls to some EJB's deployed in a remote JBoss 3.2.2 server. I've got method permissions on the remote EJB's and I'm trying to work through the most efficient way to maintain the correct security credentials as I make the EJB calls. Currently, I'm establishing a LoginContext at the top of every JSP and logging out at the bottom but I get the feeling that's not the most efficient way of doing it. I tried using the LoginInitialContextFactory which worked fine on the first call but failed with principal=null on subsequent calls. I'm also a bit confused about the difference between the login-config.xml on the remote machine and the auth.conf file on the client machine as they relate to remote invocations. Any advice would be greatly appreciated. Thanks, Rick --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] Re: [JBoss-user] ClassCircularityError-QueuedPessimisticEJBLock$TxLock
Thanks for your quick response. That helps a lot. I have a couple more questions though... In the parent-delegation model, as long as the class of the shared object is present in a parent class loader of the two classes which are sharing the object, there should be no need to marshall the object, right? Is it just that it's too unwieldy to factor out the shared classes and place them in a parent class loader? Also, what is the difference in functionality between a)having several UnifiedClassLoaders which are part of the same UnifiedLoaderRepository and b)having a single instance of a classloader which is a subclass of URLClassLoader which allows url's to be added dynamically, hence supporting hot-deploy? In my previous email I was thinking that the advantage was you could redeploy a class without having to redeploy the classes which depend on it, but as you said any classes hard-referencing it would need to be redeployed anyway. Thanks, Rob -Original Message- From: [EMAIL PROTECTED] [mailto:jboss-user- [EMAIL PROTECTED] On Behalf Of Adrian Brock Sent: Wednesday, September 24, 2003 9:35 AM To: [EMAIL PROTECTED] Subject: [JBoss-user] Re: [JBoss-user] ClassCircularityError- QueuedPessimisticEJBLock$TxLock On Wed, 2003-09-24 at 14:49, Robert Cauble wrote: Can someone please point me towards some documentation which describes the advantage of the UnifiedClassLoader model over the tree-based class loading model? We purchased the JBoss documentation and all it says in the administrators guide is that JBoss 3.x employs a new class loading architechture that facilitates sharing of classes across deployment units. It also mentions that prior to this architecture, MBeans were not hot-deployable. The main benefit of the UnifiedClassLoader is it removes the need to do any marshalling when crossing application boundaries. A little care in packaging means there is no marshalling between the front plane (WEB/Remote Interface/etc.) and the back plane (JCA, db, jms, etc) Hotdeployment of mbeans is possible because it uses the same classloader scheme, not because it uses the UnifiedClassLoader per se. As a side note: Eclipse uses a similar scheme and have made no attempt to workaround this Sun JVM bug (unlike us), but then they don't support redeployment and you must explicity share classes. The JMX spec also uses a similar scheme. As of JMX1.2 they have hacked the spec to avoid the bug rather than fix the JVM. Try the following test to see the overhead of marshalling, every parameter and return value must be marshalled (a String is very simple object to marshall): import java.rmi.MarshalledObject; public class Marshalling { static final int iterations = 10; public static void main(String[] args) throws Exception { System.out.println(Non-marshalled); Payload payload = new NonMarshalledPayload(); test(payload); System.out.println(Marshalled); payload = new MarshalledPayload(); test(payload); } public static void test(Payload payload) throws Exception { String value = new String(Value); long begin = System.currentTimeMillis(); for (int i = 0; i iterations; ++i) { payload.setValue(value); payload.getValue(); } System.out.println(Time per iteration (nano secs): + ((100 * (System.currentTimeMillis() - begin)) / iterations)); } public interface Payload { Object getValue() throws Exception; void setValue(Object value) throws Exception; } public static class NonMarshalledPayload implements Payload { Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } public static class MarshalledPayload implements Payload { MarshalledObject value; public Object getValue() throws Exception { return value.get(); } public void setValue(Object value) throws Exception { this.value = new MarshalledObject(value); } } } Is this basically saying that it allows you to hot-deploy a component without having to re-deploy those components which depend on it and its classes? It depends how tightly linked they are. The UnifiedClassLoader actually makes component redeployment harder. Every component hard-referencing the shared class must also be redeployed. Regards, Adrian Any help here would be appreciated. Thanks, Rob -- Adrian Brock Director of Support Back Office JBoss Group, LLC --- This sf.net email is sponsored
RE: [JBoss-user] error while trying to open a new connection
Hi I will try to give u as much info as possible 1) we are looking up the data source only once and keeping it in a static reference 2) getConnection is invoked from the helper class for the stateful session bean 3) the connection is stored in a member variable in the helper class 4) Auto commit is returning true. 5) The logic of the application is that when the first user logs in a connection is obtained from DataSource and kept open for common functions like authenticating the user etc. Subsequently a connection is taken from the datasource for the logging the activities of the user as well for the query operations of the user. For every fresh transaction the user starts a new connection is taken from the data source. When the user session ends the connection is closed. We are not using any connection pool. 6)Is it possible to disable the CachedConnectionManager. 7) the details of oracle-ds.xml is given below: ?xml version=1.0 encoding=UTF-8? datasources local-tx-datasource jndi-nameData/jndi-name connection-urljdbc:oracle:thin:@xx.xxx.com:1521:orcl/connection-url driver-classoracle.jdbc.driver.OracleDriver/driver-class user-namepost_dev/user-name password**/password /local-tx-datasource /datasources 8) Even when we comment the setAutoCommit(false) in the code we are getting the following error I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit BaseWrapperManagedConnection.java:494) 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465) 10:45:37,859 ERROR [STDERR] at com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318) Could you pls help as we are stuck up with this. Regards Rajesh -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 6:30 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] error while trying to open a new connection Again you'll have to give me some information. Where is getConnection() invoked and where do you store the connection? What is done between getting the connection and the commit()? Is this a StatefulSessionBean? What is the deployment descriptor for the resource-ref? What does the following return just before the commit(): m_dbCon.getAutoCommit(); ((org.jboss.resource.adapter.jdbc.WrappedConnection) m_dbCon).getUnderylingConnection().getAutoCommit(); You know this kind of pattern won't scale. You are not using the pool. You will need one db connection per user. Regards, Adrian On Wed, 2003-09-24 at 07:48, rajeshnn wrote: Hi Adrian Thanks you very much for the quick response. The issue described in the earlier mail(below) has been solved while using jboss-3.2.2RC4 ( latest jboss release ), as advised by you. Now i am facing a new error. java.sql.SQLException: You cannot commit with autocommit set! I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) ), code is given below: === public Connection getConnection(){ String m_strDefaultDataSource =java:comp/env/jdbc/Data; InitialContext ic = new InitialContext(); DataSource m_dsCommmon = ( DataSource ) ic.lookup( m_strDefaultDataSource ); m_dbCon = m_dsCommmon.getConnection(); m_dbCon.setAutoCommit(false); return m_dbCon; } private boolean storeSignInDetails(String strUserName,String strClientIp , Connection m_dbCon){ String strUserId= getUserId(); strUserId = ( null == strUserId )?Invalid:strUserId; String strQuery =//sql statement for logging // try{ Statement stmt = m_dbCon.createStatement(); int iCount = stmt.executeUpdate(strQuery); m_dbCon.commit(); }catch(Exception e){ e.printStackTrace(); return false; } return true; } // Also pls note that i am not closing the connection, as this is used for further transaction. // We are using bean managed transaction . We are handling the transaction using JDBC only (not using JavaTransaction API). //Initially after successful logging of the user, the user details are logged and it is commited ( Given in the above function --storeSignInDetails () ). //Later it is commited , only when the user finishes his transaction. // So we need to use setAutoCommit( false ); Is there any way to prevent this issue Also can u please clarify as to what JBoss is expecting. Do we need to disable CachedConnectionManager?? 10:45:37,843 ERROR [STDERR]
RE: [JBoss-user] Re: [JBoss-user] ClassCircularityError-QueuedPessimisticEJBLock$TxLock
On Wed, 2003-09-24 at 16:21, Robert Cauble wrote: Thanks for your quick response. That helps a lot. I have a couple more questions though... In the parent-delegation model, as long as the class of the shared object is present in a parent class loader of the two classes which are sharing the object, there should be no need to marshall the object, right? Is it just that it's too unwieldy to factor out the shared classes and place them in a parent class loader? Hot deployment works by throwing about the classloader and creating a new one. In the parent/child model, throwing away the parent makes all the children invalid. Also siblings cannot see each other (this requires marshalling). Also, what is the difference in functionality between a)having several UnifiedClassLoaders which are part of the same UnifiedLoaderRepository and b)having a single instance of a classloader which is a subclass of URLClassLoader which allows url's to be added dynamically, hence supporting hot-deploy? In my previous email I was thinking that the advantage was you could redeploy a class without having to redeploy the classes which depend on it, but as you said any classes hard-referencing it would need to be redeployed anyway. Multiple classloaders is more restrictive when it comes to the security model. Classes in the same package cannot access package private methods if the classes are in different classloaders. You can also get errors when instances of the same class name but different class objects are passed between classloaders. Regards, Adrian Thanks, Rob -Original Message- From: [EMAIL PROTECTED] [mailto:jboss-user- [EMAIL PROTECTED] On Behalf Of Adrian Brock Sent: Wednesday, September 24, 2003 9:35 AM To: [EMAIL PROTECTED] Subject: [JBoss-user] Re: [JBoss-user] ClassCircularityError- QueuedPessimisticEJBLock$TxLock On Wed, 2003-09-24 at 14:49, Robert Cauble wrote: Can someone please point me towards some documentation which describes the advantage of the UnifiedClassLoader model over the tree-based class loading model? We purchased the JBoss documentation and all it says in the administrators guide is that JBoss 3.x employs a new class loading architechture that facilitates sharing of classes across deployment units. It also mentions that prior to this architecture, MBeans were not hot-deployable. The main benefit of the UnifiedClassLoader is it removes the need to do any marshalling when crossing application boundaries. A little care in packaging means there is no marshalling between the front plane (WEB/Remote Interface/etc.) and the back plane (JCA, db, jms, etc) Hotdeployment of mbeans is possible because it uses the same classloader scheme, not because it uses the UnifiedClassLoader per se. As a side note: Eclipse uses a similar scheme and have made no attempt to workaround this Sun JVM bug (unlike us), but then they don't support redeployment and you must explicity share classes. The JMX spec also uses a similar scheme. As of JMX1.2 they have hacked the spec to avoid the bug rather than fix the JVM. Try the following test to see the overhead of marshalling, every parameter and return value must be marshalled (a String is very simple object to marshall): import java.rmi.MarshalledObject; public class Marshalling { static final int iterations = 10; public static void main(String[] args) throws Exception { System.out.println(Non-marshalled); Payload payload = new NonMarshalledPayload(); test(payload); System.out.println(Marshalled); payload = new MarshalledPayload(); test(payload); } public static void test(Payload payload) throws Exception { String value = new String(Value); long begin = System.currentTimeMillis(); for (int i = 0; i iterations; ++i) { payload.setValue(value); payload.getValue(); } System.out.println(Time per iteration (nano secs): + ((100 * (System.currentTimeMillis() - begin)) / iterations)); } public interface Payload { Object getValue() throws Exception; void setValue(Object value) throws Exception; } public static class NonMarshalledPayload implements Payload { Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } public static class MarshalledPayload implements Payload { MarshalledObject value; public Object getValue() throws Exception { return value.get(); } public void setValue(Object value) throws Exception
RE: [JBoss-user] error while trying to open a new connection
I just tested it with 3.2.2RC5 (same as 3.2.2RC4 for this code), it works for me. You have your resource-ref declared as Unshareable (turns off pooling)? e.g. in ejb.jar.xml session ejb-nameStateful/ejb-name hometest.ejb.TestStatefulSessionHome/home remotetest.ejb.TestSession/remote ejb-classtest.ejb.TestSessionBean/ejb-class session-typeStateful/session-type transaction-typeBean/transaction-type resource-ref res-ref-namejdbc/DataSource/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth res-sharing-scopeUnshareable/res-sharing-scope /resource-ref /session in jboss.xml jboss enterprise-beans session ejb-nameStateful/ejb-name resource-ref res-ref-namejdbc/DataSource/res-ref-name resource-nameDefaultDS/resource-name /resource-ref /session /enterprise-beans resource-managers resource-manager res-class= res-nameDefaultDS/res-name res-jndi-namejava:/DefaultDS/res-jndi-name /resource-manager /resource-managers /jboss Regards, Adrian On Wed, 2003-09-24 at 16:37, rajeshnn wrote: Hi I will try to give u as much info as possible 1) we are looking up the data source only once and keeping it in a static reference 2) getConnection is invoked from the helper class for the stateful session bean 3) the connection is stored in a member variable in the helper class 4) Auto commit is returning true. 5) The logic of the application is that when the first user logs in a connection is obtained from DataSource and kept open for common functions like authenticating the user etc. Subsequently a connection is taken from the datasource for the logging the activities of the user as well for the query operations of the user. For every fresh transaction the user starts a new connection is taken from the data source. When the user session ends the connection is closed. We are not using any connection pool. 6)Is it possible to disable the CachedConnectionManager. 7) the details of oracle-ds.xml is given below: ?xml version=1.0 encoding=UTF-8? datasources local-tx-datasource jndi-nameData/jndi-name connection-urljdbc:oracle:thin:@xx.xxx.com:1521:orcl/connection-url driver-classoracle.jdbc.driver.OracleDriver/driver-class user-namepost_dev/user-name password**/password /local-tx-datasource /datasources 8) Even when we comment the setAutoCommit(false) in the code we are getting the following error I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit BaseWrapperManagedConnection.java:494) 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465) 10:45:37,859 ERROR [STDERR] at com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318) Could you pls help as we are stuck up with this. Regards Rajesh -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 6:30 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] error while trying to open a new connection Again you'll have to give me some information. Where is getConnection() invoked and where do you store the connection? What is done between getting the connection and the commit()? Is this a StatefulSessionBean? What is the deployment descriptor for the resource-ref? What does the following return just before the commit(): m_dbCon.getAutoCommit(); ((org.jboss.resource.adapter.jdbc.WrappedConnection) m_dbCon).getUnderylingConnection().getAutoCommit(); You know this kind of pattern won't scale. You are not using the pool. You will need one db connection per user. Regards, Adrian On Wed, 2003-09-24 at 07:48, rajeshnn wrote: Hi Adrian Thanks you very much for the quick response. The issue described in the earlier mail(below) has been solved while using jboss-3.2.2RC4 ( latest jboss release ), as advised by you. Now i am facing a new error. java.sql.SQLException: You cannot commit with autocommit set! I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) ), code is given below: === public Connection getConnection(){ String m_strDefaultDataSource =java:comp/env/jdbc/Data; InitialContext ic = new InitialContext(); DataSource m_dsCommmon = ( DataSource ) ic.lookup( m_strDefaultDataSource ); m_dbCon =
[JBoss-user] Wacky JSP Tag Behavior
Title: Message The proper method for resettingthe state of a JSP tag is to re-initialize fields in doEndTag(). The proper method for releasingresourcesshared acrossall occurences of the tag(e.g., a JDBC connection) is the release() method. In a couple of instances we put our re-initialization logic in release() instead of doEndTag() and never had a problem in WebLogic or JBoss with Jetty. This showed up as a bug in JBoss with Tomcat because re-used tags were getting the left over state rather than the defaults from the previous usage on that page. It appears that Jetty (and weblogic) arecalling a tag'srelease() method after every occurence of that tag and perhaps creating a new instance rather than using an existing instance for subsequent instances. This can make tomcat look buggy when the bug is actually in your tag.
Re: [JBoss-user] CMP, 3.2.2RC4, auto-increment
Matt: Matt I still seem to be headed in the wrong direction. Below is my code as it stands now and the log entries. Am I missing something obvious? I would be very greatful if you could shed any light on where I'm going wrong. Ant seems to generate the appropriate java files and deployment descriptors. I didn't see any duplicate entries in these files referreing to the primary key. --drg package com.alamon.aesop.ejb; import javax.ejb.*; /** * *@ejb.bean *name=company *description=Models Company *type=CMP *cmp-version=2.x *schema=company *jndi-name=aesop/company *view-type=both *reentrant=false *primkey-field=index * * @jboss.entity-command * name=postgresql-fetch-seq * *@ejb.pk *class=java.lang.Long * *@ejb.persistence *table-name=company * *@jboss.persistence *create-table=true *remove-table=true * *@ejb.facade *name=companyFacade *type=stateless *jndi-name=aesop/companyFacade *view-type=remote *description=company Facade * *@ejb.value-object *@ejb.finder *signature=java.util.Collection findAll() */ public abstract class companyEJB implements EntityBean { // *** Elements *** public EntityContext ctx; /** * @ejb.pk-field * @ejb.interface-method * @ejb.persistence * column-name=index * @jboss.persistence * auto-increment=true **/ public abstract Object getIndex(); /** * @ejb.interface-method */ public abstract void setIndex(Object index); /** * @ejb.persistence * column-name=name * sql-type=VARCHAR(30) * jdbc-type=VARCHAR * @ejb.interface-method */ public abstract String getName(); /** * @ejb.interface-method */ public abstract void setName(String name); // *** Life Cycle Methods *** // ** /** * @ejb.create-method * @param name * @return null */ public Object ejbCreate() throws CreateException { return null; } public void ejbPostCreate() { } public void ejbActivate() { } public void ejbPassivate() { } public void ejbRemove() { } public void ejbLoad() { } public void ejbStore() { } public void setEntityContext(EntityContext ctx) { this.ctx = ctx; } public void unsetEntityContext() { this.ctx = null; } // Methods Required by Autogenerated Facade //** /** * @ejb.interface-method */ public companyData getData() { companyData companyVO = new companyData(); //companyVO.setIndex(this.getIndex()); companyVO.setName(this.getName()); return companyVO; } /** * Sets a data object representing this instance * @ejb.interface-method */ public void setData(companyData data) { //if (this.getIndex().equals(data.getPrimaryKey())) { this.setName(data.getName()); //} } } Log from JBoss: 2003-09-24 11:06:48,024 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/usr/java/jboss-3.2.2RC4/server/default/deploy/AESOP_Server.jar 2003-09-24 11:07:06,520 INFO [org.jboss.ejb.EjbModule] Creating 2003-09-24 11:07:06,853 INFO [org.jboss.ejb.EjbModule] Deploying company 2003-09-24 11:07:09,159 INFO [org.jboss.ejb.EjbModule] Deploying companyFacade 2003-09-24 11:07:09,675 INFO [org.jboss.ejb.EntityContainer] Creating 2003-09-24 11:07:09,964 INFO [org.jboss.ejb.plugins.EntityInstancePool] Creating 2003-09-24 11:07:10,066 INFO [org.jboss.ejb.plugins.EntityInstancePool] Created 2003-09-24 11:07:10,282 INFO [org.jboss.ejb.EntityContainer] Created 2003-09-24 11:07:10,310 INFO [org.jboss.ejb.StatelessSessionContainer] Creating 2003-09-24 11:07:10,342 INFO [org.jboss.ejb.plugins.StatelessSessionInstancePool] Creating 2003-09-24 11:07:10,344 INFO [org.jboss.ejb.plugins.StatelessSessionInstancePool] Created 2003-09-24 11:07:10,473 INFO [org.jboss.ejb.StatelessSessionContainer] Created 2003-09-24 11:07:10,477 INFO [org.jboss.ejb.EjbModule] Created 2003-09-24 11:07:10,488 INFO [org.jboss.ejb.EjbModule] Starting 2003-09-24 11:07:10,491 INFO [org.jboss.ejb.EntityContainer] Starting 2003-09-24 11:07:35,686 ERROR [org.jboss.ejb.EntityContainer] Starting failed org.jboss.deployment.DeploymentException: Generation only supported with single PK field at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.getGeneratedPKField(JDBCAbstractCreateCommand.java:164) at org.jboss.ejb.plugins.cmp.jdbc.JDBCIdentityColumnCreateCommand.initGeneratedFields(JDBCIdentityColumnCreateCommand.java:51) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.init(JDBCAbstractCreateCommand.java:90) at org.jboss.ejb.plugins.cmp.jdbc.JDBCIdentityColumnCreateCommand.init(JDBCIdentityColumnCreateCommand.java:39) at
RE: [JBoss-user] Re: [JBoss-user]ClassCircularityError-QueuedPessimisticEJBLock$TxLock
On Wed, 2003-09-24 at 19:54, Robert Cauble wrote: Multiple classloaders is more restrictive when it comes to the security model. Classes in the same package cannot access package private methods if the classes are in different classloaders. Got it. Thanks. You can also get errors when instances of the same class name but different class objects are passed between classloaders. Can you give me an example? Is this something which the JVM can't handle? Or do mean that it's easy for the programmer to make a mistake if they were to do something like instantiate an object of a class Foo loaded from class loader A and then cast it to a class Foo loaded from class loader B? Correct ClassCastException or the more subtle LinkageError, IncompatibleClassChangeError Regards, Adrian Thanks, Rob --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user -- Adrian Brock Director of Support Back Office JBoss Group, LLC --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Async replication messages possible?
Which repl are you referring to ? Session (Tomcat, Jetty) ? EJBs ? I think replis async by default. Joao Clemente wrote: Hi. (This message is in particular for Bela, but others feedback is welcome) I'm running some tests and even with a very low request rate (5 req / minute = 1 request / 12 sec) I'm seeing my respose times getting worse by 2 to 5 times as soon as I let a second node join the cluster. I am assuming it's because of a overhead of Jgroups ack'ing the replication before letting the master node reply to the user. (question for bela) Can it be? If so, can I put jgroups in async mode, either delaying the replication message or not waiting for the ack from replicas? Thank you Joao Clemente --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.520 / Virus Database: 318 - Release Date: 18-09-2003 --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user -- Bela Ban http://www.jgroups.org Cell: (408) 316-4459 --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] ejbStore() is not called
Hello, I am converting a system from Weblogic 6.1(sp3) to JBoss 3.2.1. I got a strange phenomenon about BMP Entity Bean. The process is like followings; 1. Create a entity bean E1 by calling home.create(); 2. Set Object O1 to E1 by calling E1.setXXX(O1); 3. Get entity bean E1 by calling home.findByPrimaryKey(key). 4. Set another Object O2 to E1 by calling E.setXXX(O2); In step 1, ejbCreate() insert a record to tableA. In step 2, setXXX(O1) insert a record to tableB. In step 4, setXXX(O3) update a record that was inserted by step2. Here is the problem. In stem 3(or after step3), ejbStore() of E1 is never called. There is any case or configuration that ejbStre() is not called by JBoss? Maybe I did wrong configuration settings but I could not find. Any suggestions are welcome. Regard, Taka --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] ejbStore() is not called
I wrote wrong. (Wrong) Here is the problem. In stem 3(or after step3), ejbStore() of E1 is never called. (Correct) Here is the problem. In step *4* (or after step *4*), ejbStore() of E1 is never called. Thanks, Taka --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
RE: [JBoss-user] error while trying to open a new connection
Hi I will try to give u as much info as possible 1) we are looking up the data source only once and keeping it in a static reference 2) getConnection is invoked from the helper class for the stateful session bean 3) the connection is stored in a member variable in the helper class 4) Auto commit is returning true. 5) The logic of the application is that when the first user logs in a connection is obtained from DataSource and kept open for common functions like authenticating the user etc. Subsequently a connection is taken from the datasource for the logging the activities of the user as well for the query operations of the user. For every fresh transaction the user starts a new connection is taken from the data source. When the user session ends the connection is closed. We are not using any connection pool. 6)Is it possible to disable the CachedConnectionManager. 7) the details of oracle-ds.xml is given below: ?xml version=1.0 encoding=UTF-8? datasources local-tx-datasource jndi-nameData/jndi-name connection-urljdbc:oracle:thin:@xx.xxx.com:1521:orcl/connection-url driver-classoracle.jdbc.driver.OracleDriver/driver-class user-namepost_dev/user-name password**/password /local-tx-datasource /datasources 8) Even when we comment the setAutoCommit(false) in the code we are getting the following error I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit BaseWrapperManagedConnection.java:494) 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465) 10:45:37,859 ERROR [STDERR] at com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318) Could you pls help as we are stuck up with this. Regards Rajesh -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 6:30 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] error while trying to open a new connection Again you'll have to give me some information. Where is getConnection() invoked and where do you store the connection? What is done between getting the connection and the commit()? Is this a StatefulSessionBean? What is the deployment descriptor for the resource-ref? What does the following return just before the commit(): m_dbCon.getAutoCommit(); ((org.jboss.resource.adapter.jdbc.WrappedConnection) m_dbCon).getUnderylingConnection().getAutoCommit(); You know this kind of pattern won't scale. You are not using the pool. You will need one db connection per user. Regards, Adrian On Wed, 2003-09-24 at 07:48, rajeshnn wrote: Hi Adrian Thanks you very much for the quick response. The issue described in the earlier mail(below) has been solved while using jboss-3.2.2RC4 ( latest jboss release ), as advised by you. Now i am facing a new error. java.sql.SQLException: You cannot commit with autocommit set! I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) ), code is given below: === public Connection getConnection(){ String m_strDefaultDataSource =java:comp/env/jdbc/Data; InitialContext ic = new InitialContext(); DataSource m_dsCommmon = ( DataSource ) ic.lookup( m_strDefaultDataSource ); m_dbCon = m_dsCommmon.getConnection(); m_dbCon.setAutoCommit(false); return m_dbCon; } private boolean storeSignInDetails(String strUserName,String strClientIp , Connection m_dbCon){ String strUserId= getUserId(); strUserId = ( null == strUserId )?Invalid:strUserId; String strQuery =//sql statement for logging // try{ Statement stmt = m_dbCon.createStatement(); int iCount = stmt.executeUpdate(strQuery); m_dbCon.commit(); }catch(Exception e){ e.printStackTrace(); return false; } return true; } // Also pls note that i am not closing the connection, as this is used for further transaction. // We are using bean managed transaction . We are handling the transaction using JDBC only (not using JavaTransaction API). //Initially after successful logging of the user, the user details are logged and it is commited ( Given in the above function --storeSignInDetails () ). //Later it is commited , only when the user finishes his transaction. // So we need to use setAutoCommit( false ); Is there any way to prevent this issue Also can u please clarify as to what JBoss is expecting. Do we need to disable CachedConnectionManager?? 10:45:37,843 ERROR [STDERR]
[JBoss-user] error while connecting to Database
Title: error while connecting to Database Hi I will try to give u as much info as possible 1) we are looking up the data source only once and keeping it in a static reference 2) getConnection is invoked from the helper class for the stateful session bean 3) the connection is stored in a member variable in the helper class 4) Auto commit is returning true. 5) The logic of the application is that when the first user logs in a connection is obtained from DataSource and kept open for common functions like authenticating the user etc. Subsequently a connection is taken from the datasource for the logging the activities of the user as well for the query operations of the user. For every fresh transaction the user starts a new connection is taken from the data source. When the user session ends the connection is closed. We are not using any connection pool. 6)Is it possible to disable the CachedConnectionManager. 7) the details of oracle-ds.xml is given below: ?xml version=1.0 encoding=UTF-8? datasources local-tx-datasource jndi-nameData/jndi-name connection-urljdbc:oracle:thin:@xx.xxx.com:1521:orcl/connection-url driver-classoracle.jdbc.driver.OracleDriver/driver-class user-namepost_dev/user-name password**/password /local-tx-datasource /datasources 8) Even when we comment the setAutoCommit(false) in the code we are getting the following error I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit BaseWrapperManagedConnection.java:494) 10:45:37,859 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465) 10:45:37,859 ERROR [STDERR] at com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318) Could you pls help as we are stuck up with this. Regards Rajesh -Original Message- From: Adrian Brock [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 24, 2003 6:30 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] error while trying to open a new connection Again you'll have to give me some information. Where is getConnection() invoked and where do you store the connection? What is done between getting the connection and the commit()? Is this a StatefulSessionBean? What is the deployment descriptor for the resource-ref? What does the following return just before the commit(): m_dbCon.getAutoCommit(); ((org.jboss.resource.adapter.jdbc.WrappedConnection) m_dbCon).getUnderylingConnection().getAutoCommit(); You know this kind of pattern won't scale. You are not using the pool. You will need one db connection per user. Regards, Adrian On Wed, 2003-09-24 at 07:48, rajeshnn wrote: Hi Adrian Thanks you very much for the quick response. The issue described in the earlier mail(below) has been solved while using jboss-3.2.2RC4 ( latest jboss release ), as advised by you. Now i am facing a new error. java.sql.SQLException: You cannot commit with autocommit set! I had also set CachedConnectionManager in transaction-service.xml( SpecCompliant to true ) ), code is given below: === public Connection getConnection(){ String m_strDefaultDataSource =java:comp/env/jdbc/Data; InitialContext ic= new InitialContext(); DataSource m_dsCommmon = ( DataSource ) ic.lookup( m_strDefaultDataSource ); m_dbCon = m_dsCommmon.getConnection(); m_dbCon.setAutoCommit(false); return m_dbCon; } private boolean storeSignInDetails(String strUserName,String strClientIp , Connection m_dbCon){ String strUserId = getUserId(); strUserId = ( null == strUserId )?Invalid:strUserId; String strQuery =//sql statement for logging // try{ Statement stmt = m_dbCon.createStatement(); int iCount = stmt.executeUpdate(strQuery); m_dbCon.commit(); }catch(Exception e){ e.printStackTrace(); return false; } return true; } // Also pls note that i am not closing the connection, as this is used for further transaction. // We are using bean managed transaction . We are handling the transaction using JDBC only (not using JavaTransaction API). //Initially after successful logging of the user, the user details are logged and it is commited ( Given in the above function --storeSignInDetails () ). //Later it is commited , only when the user finishes his transaction. // So we need to use setAutoCommit( false ); Is there any way to prevent this issue Also can u please clarify as to what JBoss is expecting. Do we need to disable CachedConnectionManager?? 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit set! 10:45:37,859 ERROR [STDERR] at