Announcement Announcement Module
No announcement yet.
JBOSS Connection Pool Usage Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JBOSS Connection Pool Usage

    We are trying to use JBOSS connection pool in Spring framework. We are getting some weired exception when I try to refer JBOSS connection pool in the configuration file through JNDI name.

    Spring 2.5
    JBOSS 4.2

    Configuration XML:
    <jee:jndi-lookup id="dataSource" jndi-name="java:/jdbc/xxxxxxxx" resource-ref="true" />

    18:22:23,388 ERROR [TransactionInterceptor] Application exception overridden by rollback exception
    org.springframework.jdbc.UncategorizedSQLException : StatementCallback; uncategorized SQLException for SQL [select id, description, price from springapp_produ
    cts]; SQL state [null]; error code [17029]; setReadOnly: Read-only connections not supported; nested exception is java.sql.SQLException: setReadOnly: Read-on
    ly connections not supported

    But when I use same JBOSS connection pool details using DriverManagerDataSource in the configuration, it is working fine.

    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource"
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@xxxxxx:1521:xxx"/>
    <property name="username" value="xxx"/>
    <property name="password" value="xxxx"/>

    The existing jboss connection pooling is working fine with other applications.

    Anybody have clue on this excepetion?

  • #2
    It probably is a configuration issue in your JBoss datasource. Can you post the configuration? Also it can very well be that the jboss connection pooling (datasource) doesn't support read-only connections. You can always try another connection pool like C3P0.


    • #3
      Hi mdeinum,
      Thanks for your reply and help. Please find the JBOSS connection pool data source configuration xml below.



      We have been using this data source from JBOSS for our other applications since many days and it is working without any issues. We use the same data source for all kind of database activity like select, update and other procedure calls. We don't have any pool setup for read-only connections.

      What do you mean by read-only connection? Is spring configuration looks for read only connections while using select queries?



      • #4
        setting readonly on a connection is just an indication to the underlying connection. It may or may not do something with it. If a Connection is marked read-only depends on your transaction configuration.


        • #5
          Hi mdeinum,

          Thanks for your reply. It looks like JBOSS connection pool doesn't allow request for read-only connection. Do you know how to configure spring to request for a normal connection instead of read-only connection.



          • #6
            I don't think the problem is in spring - the error comes from oracle, not from jboss connection pool. It's the pool implementation that tries to invoke setReadOnly method, not spring. Try to delete the readonly property from jboss datasource configuration.


            • #7
              Initially there was no read only property set in my jboss ds file. When I saw this error, I thought this read only set to false might help. But after setting this also, I am getting the same error. I am not sure what else I need to set?


              • #8
                Can you please post the entire stacktrace?


                • #9
                  Thank you all for your responses. Finally I was able to find the issue, the issue is related to my applicationcontext.xml configuration. There is advice set with read only parameter as fallows which I got from some examples.

                  <tx:advice id="txAdvice">
                  <tx:method name="save*"/>
                  <tx:method name="*" read-only="true"/>

                  When I try to use JBOSS connection pool, jboss is not allowing for read only connections. When I remove this flag, everything is working fine.