How do ExceptionSorter classes work in JBoss?

I am wondering how JBoss ExceptionSorter classes can check for database errors.

The application (EJB or persistent structure) contains a link to the database connection, so SQLExceptions are caught by the application. How can JBoss see the contents of an exception?

Does JBoss turn on the connection and intercept these messages or something like that?

+3
source share
2 answers

If you have ever run a debugger against code running inside JBoss, while it has an open database connection, you will notice that the connection is indeed a JBoss class that wraps the actual database connection.

, , SQL. . :

java.sql.SQLException: ORA-00942: table or view does not exist
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:810)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
    at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:342)

, -, .

+2

JBoss (org.jboss.resource.adapter.jdbc.local.LocalTxDataSource). ExceptionSorter SQLException , , . , " " " ".

, , , , false.

Oracle:

<property name="exceptionSorterClassName"><value>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</value></property>

Oracle. ExceptionSorter:

http://kickjava.com/src/org/jboss/resource/adapter/jdbc/vendor/OracleExceptionSorter.java.htm

, , . JBoss.

+3

Source: https://habr.com/ru/post/1698483/


All Articles