3
Hello,
I am trying to run a jar file, replacing some original java interfaces for database connection, changing the setBoolean method to receive an object as parameter.
Original:
void setBoolean(int parameterIndex, boolean x) throws SQLException;
My change:
void setBoolean(int parameterIndex, Boolean x) throws SQLException;
My changes were made in the Preparedstatement class so that my changes are called, when starting the application I am using the command:
java -Xbootclasspath/p:C:/Users/elizio/Desktop/safepdv700/safepdv700/src/main/java -jar safepdv.jar
By "-verbose:class" I can verify that it loads the class with my changes.
However, when setBoolean is called by the application, it does not find the method, returning me:
Exception in thread "AWT-EventQueue-0" [Loaded java.lang.Throwable$WrappedPrintStream from C:\Program Files\Java\jre1.8.0_91\lib\rt.jar]
java.lang.NoSuchMethodError: java.sql.PreparedStatement.setBoolean(IZ)V
at com.t2tierp.pafecf.controller.ConfiguracaoController.updateCS(ConfiguracaoController.java:613)
at com.t2tierp.pafecf.view.MovimentoAberto.validaCamposLogin(MovimentoAberto.java:448)
at com.t2tierp.pafecf.view.MovimentoAberto.passwordTextSenhaUsuarioActionPerformed(MovimentoAberto.java:403)
at com.t2tierp.pafecf.view.MovimentoAberto.access$200(MovimentoAberto.java:22)
at com.t2tierp.pafecf.view.MovimentoAberto$4.actionPerformed(MovimentoAberto.java:240)
at javax.swing.JTextField.fireActionPerformed(Unknown Source)
at javax.swing.JTextField.postActionEvent(Unknown Source)
at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.WaitDispatchSupport$2.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(Unknown Source)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at com.t2tierp.pafecf.view.Caixa.verificarMovimentoExistente(Caixa.java:3392)
at com.t2tierp.pafecf.view.Caixa.<init>(Caixa.java:344)
at com.t2tierp.pafecf.view.Caixa$41.run(Caixa.java:2393)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
The changes made in both the Java interface and the Mysql-Connector source code are in this repository:
What should I do to have my method called in place of the original since my class is being loaded according to the log?
You can add the code of this class to the question?
– user28595
Good question! Just a hint:
PreparedStatement
is an interface and not a class: My changes were made in the Preparedstatement class . Documentation– igventurelli
@diegofm the code of Preparedstatement?
– Jackeline
Yes, the code of your class that you implemented the Preparestatement interface and created a method similar to one that already existed.
– user28595
@diegofm changes to Mysql Connector and the java interface are in this repository: [https://github.com/jackelinesantos/PreparedStatementChanged/tree/master/mysql-5.1.38/src/com/mysql/jdbc] For changes to Java, I compiled with the entire project, but I only left in the repository what was modified by me.
– Jackeline