10 Replies Latest reply on Jun 29, 2006 2:17 AM by hakucho

    FAQ - READ THIS SECOND

      DO NOT POST QUESTIONS ON THIS TOPIC - they will be deleted.

      Example deployments can be found in the jboss distribution in

      docs/examples/jca


      The FAQ has moved to here: http://www.jboss.org/wiki/Wiki.jsp?page=FAQJBossJCA


        • 1. Re: FAQ - READ THIS SECOND

          Question:

          Is it possible to shutdown the database and restart it?
          Will JBoss complain about stale connections?

          Answer;

          You can configure the following in your -ds.xml

          <check-valid-connection-sql>some cheap sql statement</check-valid-connection-sql>
          e.g. for Oracle "select 1 from dual"
          


          JBoss will run the SQL statement before handing out the connection from the pool.
          If the SQL fails, the connection will be destroyed/closed and new ones will be created.

          Regards,
          Adrian

          • 2. Re: replication-granularity ATTRIBUTE problem
            gshifrin

            Thank you for reply.

            This can easily reproduce with a simple servlet handling HttpSession.
            like this:

            public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException {
            
             HttpSession session = request.getSession();
             Integer value = (Integer)session.getAttribute("COUNT");
             if (value == null) {
             value = new Integer(0);
             }
             session.setAttribute("COUNT", new Integer(value.intValue() + 1));
            
             /* building html */
            }


            and stress the servlet using JMeter(100threads or more...).
            mod_jk2 is not necessary requirement for this problem.

            I found this problem only with 4.0.0.
            With 3.2.6, this didn't occur.

            This is not log4j issue. The duplicate commit message is found only for the TX which ends up with the error log.

            • 3. Re: JBoss 3.2.5 Will Not Load Embedded Obj Under JAAS & SSL

              jboss-3.2.5 does not support context level overrides. jboss-3.2.6 supports a WEB-INF/context.xml descriptor that allows one to customize a war context. The custom valve would be added by including a myapp-web.war/WEB-INF/context.xml with:

              <Context>
               <Valve className="org.apache.catalina.authenticator.FormAuthenticator"
               disableProxyCaching="false" />
              </Context>
              


              With this the headers for the jmx-console secured using form auth look like:

              http://localhost:8080/jmx-console/
              
              GET /jmx-console/ HTTP/1.1
              Host: localhost:8080
              User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
              Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
              Accept-Language: en-us,en;q=0.5
              Accept-Encoding: gzip,deflate
              Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
              Keep-Alive: 300
              Connection: keep-alive
              Cookie: JSESSIONID=73BBE64CC7EE140B8BE9564A3674B5C2
              
              HTTP/1.x 200 OK
              Set-Cookie: JSESSIONID=544A25A77D9EEBB2AD92719D5B63262F; Path=/jmx-console
              Etag: W/"711-1098230852000"
              Last-Modified: Wed, 20 Oct 2004 00:07:32 GMT
              Content-Type: text/html
              Content-Length: 711
              Date: Wed, 20 Oct 2004 00:24:10 GMT
              Server: Apache-Coyote/1.1
              ----------------------------------------------------------
              


              Without this or with the disableProxyCaching=true there are Pragma: No-cache and Cache-Control: no-cache headers in the replies:

              http://localhost:8080/jmx-console/
              
              GET /jmx-console/ HTTP/1.1
              Host: localhost:8080
              User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
              Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
              Accept-Language: en-us,en;q=0.5
              Accept-Encoding: gzip,deflate
              Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
              Keep-Alive: 300
              Connection: keep-alive
              Cookie: JSESSIONID=544A25A77D9EEBB2AD92719D5B63262F
              
              HTTP/1.x 200 OK
              Pragma: No-cache
              Cache-Control: no-cache
              Expires: Wed, 31 Dec 1969 16:00:00 PST
              Etag: W/"711-1098230852000"
              Last-Modified: Wed, 20 Oct 2004 00:07:32 GMT
              Content-Type: text/html
              Content-Length: 711
              Date: Wed, 20 Oct 2004 00:27:13 GMT
              Server: Apache-Coyote/1.1
              ----------------------------------------------------------
              



              • 4. Re: FAQ - READ THIS SECOND

                Question:

                How do I deploy my resource adapter

                Answer:

                Take your standard rar deployment (either as a standalone deployment or
                part of another deployment like an ear) and place it in deploy.
                You then need a -ds.xml file, examples can be found in docs/examples/jca
                or the jms resource adapater deployment deploy/jms/jms-ds.xml

                The rar acts as a template for the connection factory deployment in the ds.xml

                NOTE: It is important for non-jdbc deployments that the
                adapter-display-name matches the display-name from the ra.xml inside
                the rar.
                But in jboss4, it uses rar-name and connection-definition NOT adapter-display-name.
                http://www.jboss.org/wiki/Wiki.jsp?page=ConfigConnectionFactory

                The full detail of what goes in the -ds.xml can be found in
                docs/dtd/jboss-ds_1_0.dtd or the admin docs.

                NOTE: If you are deploying a datasource, you will also need to put the
                jdbc driver in server/[config]/lib

                Regards,
                Adrian

                • 5. Re: FAQ - READ THIS SECOND

                  Question:

                  I get messages like the following, what does it mean:

                  14:58:16,555 WARN [WrappedConnection] Closing a statement you left open, please do your own housekeeping

                  Answer:
                  It means you are not closing your connections to return them to the pool.
                  To avoid connection leaks you should have code like the following:

                  Connection connection = dataSource.getConnection();
                  try
                  {
                  // DO WORK
                  }
                  finally
                  {
                   try
                   {
                   connection.close();
                   }
                   catch (Throwable ignored)
                   {
                   }
                  }
                  


                  For jdbc you should do the same thing for Statements and ResultSets.
                  Normally Statements are closed when the Connection is closed, but connection
                  pooling means the close does not happen.
                  Similarly, if you have prepared statements in a cache, ResultSets need to be
                  closed.

                  Regards,
                  Adrian

                  • 6. Re: FAQ - READ THIS SECOND

                    Question:

                    I suspect I have a leak, can JBoss tell me where it is.

                    Answer;

                    Yes. For connections the configuration is in conf/transaction-service.xml

                    <attribute name="Debug">true</attribute>
                    

                    For statements (and from 3.2.4 ResultSets) you can add the following to
                    your -ds.xml
                    <track-statements>true</track-statements>
                    


                    In production you will want to turn these off. You should have found all your
                    leaks during development.
                    Also from 3.2.4 you will want to comment out the cached connection manager valve
                    that checks for unclosed connections in jsps/servlets.
                    This is in deploy/jbossweb-xxx.sar/server.xml
                     <!-- Check for unclosed connections -->
                     <Valve className="org.jboss.web.tomcat.tc5.jca.CachedConnectionValve"
                     cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager" />
                    
                    


                    • 7. Re: FAQ - READ THIS SECOND

                      Question:

                      Is it possible to shutdown the database and restart it?
                      Will JBoss complain about stale connections?

                      Answer;

                      You can configure the following in your -ds.xml

                      <check-valid-connection-sql>some cheap sql statement</check-valid-connection-sql>
                      e.g. for Oracle "select 1 from dual"
                      


                      JBoss will run the SQL statement before handing out the connection from the pool.
                      If the SQL fails, the connection will be destroyed/closed and new ones will be created.

                      Regards,
                      Adrian

                      • 8. Re: FAQ - READ THIS SECOND

                        Question:

                        How can I access a DataSource from a client

                        Answer:

                        In JBoss-3.2.x you cannot, DataSources are not exposed remotely.
                        There is an implementation of this in JBoss4.
                        I would not recommend this anti-pattern

                        • 9. XA Oracle Datasource errors
                          guix

                          Question:

                          I am use Oracle XA and getting
                          "Could not enlist in transaction on entering meta-aware object!"
                          or
                          xa error: -3 (A resource manager error has occured in the transaction branch. ; oracle error: 65535; oracle sql error: -1;

                          Answer:

                          Check 2 things:
                          1.- That your jbosscmp-jdbc.xml is specifying the same version of oracle as the one you use.
                          2.- That the oracle server you connect to has XA enabled as explained in:
                          http://www.baldor.it/StartPage/documents/admin/59.html
                          Down the page on "Configuring Oracle Database for XA Support"


                          Cheers

                          • 10. Re: XA Oracle Datasource errors
                            hakucho

                             

                            "guix" wrote:
                            ... explained in:
                            http://www.baldor.it/StartPage/documents/admin/59.html
                            Down the page on "Configuring Oracle Database for XA Support" ...

                            This link is broken; however I suspect the same info is now here:

                            http://wiki.jboss.org/wiki/Wiki.jsp?page=IHaveProblemsWithOracleXA

                            HTH,

                            Andrew