Is bootstraping a modified Java class ahead of a system library supported?
Environment
- JBoss Enterprise Application Platform 5.1.0
Issue
- Customer's plan is to make a small change to the class sun.jdbc.odbc.JdbcOdbcStatement to fix an issue they have been facing while connecting to one of their data sources from JBoss. They want to bootstrap this class in ahead of the system library when the JVM starts up.
These are the steps that have been tested this on the community version of JBoss:
1. Deploy the jar file with modified packages to <JBOSS_HOME>\Client
2. Added the following line to the run.conf.bat file in the <JBOSS_HOME>\bin folder:
set "JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/p:%JBOSS_HOME%\Client\jdbc-odbc-bridge.jar"
Customer wants to verify with us if this is the ideal/optimum manner to bootstrap a JRE class?
Resolution
- The JVM argument "-Xbootclasspath/p" can be used to bootstrap a class in front of the default bootstrap class path, but modifying the classes that Java uses (e.g.: "sun.jdbc.odbc.JdbcOdbcStatement") for itself, according to own requirement is not advisable.
Due to the reason that it is not fully tested by Oracle and might break other things at JVM level and in turn can cause adverse effects on JBoss itself, hence it is not adviced and any issue that arises due to changes made like this won't be supported as well. Also, the following URL [1] can be referred to what Oracle has to say regarding these sort of changes.
- In turn if someone feels that there are issues with the Oracle provided classes then it is suggested to report a bug with Oracle so that it gets authorised by them.
[1] http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html#options
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
