0 Replies Latest reply on Oct 21, 2002 4:35 PM by tentacle

    JBoss / JAAS - Sybase SQLException SET CHAINED command?

    tentacle

      We are using Sybase wiht JConnect 5.5 and JBoss 3.0.3. (moving from WebLogic 6.x). We are using JAAS (DatabaseServerLoginModule).

      Now I'll try to explain the problem we are having.
      We have a web application and a Login.jsp that uses j_security_check. The login is successful and the correct jsp displays. When I follow one of the links on the page (which goes to a Controller servlet), I get the following error :
      21:27:04,741 ERROR [DatabaseServerLoginModule] Query failed
      com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed within multi-statement transa
      ction.


      Here is the stack trace :
      21:27:04,741 ERROR [DatabaseServerLoginModule] Query failed
      com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed within multi-statement transa
      ction.

      at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2535)
      at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1916)
      at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
      at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:201)
      at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:182)
      at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1540)
      at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1523)
      at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:89)
      at com.sybase.jdbc2.tds.Tds.setOption(Tds.java:1042)
      at com.sybase.jdbc2.jdbc.SybConnection.setAutoCommit(SybConnection.java:598)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.checkTransaction(LocalManage
      dConnection.java:423)
      at org.jboss.resource.adapter.jdbc.local.LocalConnection.checkTransaction(LocalConnection.ja
      va:756)
      at org.jboss.resource.adapter.jdbc.local.LocalStatement.checkTransaction(LocalStatement.java
      :771)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeQuery(LocalPreparedSt
      atement.java:286)
      at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLogi
      nModule.java:100)
      at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule
      .java:143)
      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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:664)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:599)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:596)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:523)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:381)

      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:347)

      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:215)
      at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.ja
      va:169)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      at org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)
      at org.jboss.ejb.Container.invoke(Container.java:730)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy34.create(Unknown Source)
      at za.co.rmb.proof.business.ProjectDelegate.(ProjectDelegate.java:27)
      at za.co.rmb.proof.command.RetrieveProjectCommand.execute(RetrieveProjectCommand.java:29)
      at za.co.rmb.proof.controller.FrontController.processRequest(FrontController.java:30)
      at za.co.rmb.proof.controller.FrontController.doGet(FrontController.java:20)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:284)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:577)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1674)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1624)
      at org.mortbay.http.HttpServer.service(HttpServer.java:875)
      at org.jboss.jetty.Jetty.service(Jetty.java:541)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:785)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:935)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:802)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:200)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:294)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
      at java.lang.Thread.run(Thread.java:536)
      21:27:05,072 ERROR [SecurityInterceptor] Authentication exception, principal=null
      21:27:05,072 ERROR [LogInterceptor] EJBException, causedBy:
      java.lang.SecurityException: Authentication exception, principal=null
      at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.ja
      va:173)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      at org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)
      at org.jboss.ejb.Container.invoke(Container.java:730)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy34.create(Unknown Source)
      at za.co.rmb.proof.business.ProjectDelegate.(ProjectDelegate.java:27)
      at za.co.rmb.proof.command.RetrieveProjectCommand.execute(RetrieveProjectCommand.java:29)
      at za.co.rmb.proof.controller.FrontController.processRequest(FrontController.java:30)
      at za.co.rmb.proof.controller.FrontController.doGet(FrontController.java:20)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:284)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:577)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1674)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1624)
      at org.mortbay.http.HttpServer.service(HttpServer.java:875)
      at org.jboss.jetty.Jetty.service(Jetty.java:541)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:785)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:935)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:802)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:200)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:294)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
      at java.lang.Thread.run(Thread.java:536)


      Here is an post I found on the Sybase site :-
      Re: Connection pooling with Sybase JConnect 5.5 seems to give SET CHAINED exception

      This is probably a bi-product of how JBOSS expects the backend connections to be handled. Was this an EJB, servlet? From a J2EE app server, you need to use caution in tweakingthe state of autoCommit depending on which EE technology is being used. That being said, there is no jConnect issue here, just an issue with understanding the particulars of JBOSS.


      Now this same application works very well in WebLogic, so I am assuming that it is a JBoss issue. What am I missing? Is this related to DatabaseServerLoginModule ([DatabaseServerLoginModule] Query failed com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed within multi-statement transa
      ction.) or is it something to do with Database connections or database transactions? Is there some configuration I have missed?

      Can somebody please point me in the right direction.

      Regards,
      Shane.