First, let me explain shortly how my application is working:
The application handles deals, which are stored as an XML document in our database (Oracle 11g). The table that contains these information is defined like that:
table T_MYDEALS (
DEAL_ID number(9, 0) not null,
DEAL_XML xmltype
)
When we update or insert new items in this table, we have a trigger that will read (using XPath) this XML, and populates some others metadata tables.
Everything works fine, except on my machine.
Now the problem
When I run the application on my machine (i.e. the Tomcat run within my Eclipse, but connected to the Homologation DB), the trigger fails with the following error:
WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1722, SQLState: 42000
ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-01722: invalid number
ORA-06512: at "MY_SCHEMA.AFTER_R_INSERT_MYDEAL", line 628
ORA-04088: error during execution of trigger 'MY_SCHEMA.AFTER_R_INSERT_MYDEAL'
I'm sorry, I can't put my trigger here, for security reasons. Just note that the line 628 is at the end of the trigger code.
My tests
So I tried to understand why this error happened on my machine (as it only happen on my machine, none of my colleague encounter this issue). I can't say when it starts to stop working, maybe when I changed my computer recently?
First, I check the source code, then my DB connection, but everything seems correct.
I also switched in debug mode to have a look in the XML sent to the DB, or at least in our HibernateXMLType (which is an extension of org.hibernate.usertype.UserType, used to transform our XML into data readable by Oracle). But nothing wrong found here neither.
I save you many tests done on my side, but one of my latest tests was to get a fresh Tomcat server, and deploy a WAR that is deployed in an environment (Homologation for ex.).
Then, I executed the same tests, but the trigger is still failing.
So far, I have eliminated the following suspects:
The source code, as I also tested the application from a WAR that is deployed on an environment and which is working correctly;
The DB itself, as I am connected to the same DB as the working environment. I also tried with another DB, the result is the same.
The data used for my tests, as it works if I try to save the same deal, but using the Homologation environment.
JDK, as I also changed the JDK for a new one;
Eclipse, as my latest tests were done outside Eclipse;
Tomcat server, as I also tried on a new Tomcat.
What I am wondering is if my Windows XP environment has some specific encoding configuration, which "transforms" some data within the XML and make them
My questions
What are the possible elements that I may have forgotten in my tests?
Is there a way to know exactly the XML processed by the Oracle trigger (if possible without installing anything on the Oracle instance, as I don't have any control on it)?
I know that I don't provide a lot of information, but if you can give me some hints, or ideas, I would be really grateful!
Regards.
Technical information: Java 1.6, Oracle 11g, Tomcat 5.5.23, JSF 1.2, Hibernate 3.3
Could it be localization? On your system you're populating the xml with "1,5" instead of "1.5" for example. The error that is reported by Hibernate clearly points in that direction. You could disable the trigger and see what the resulting xmltype is in that table. And if you or one of your colleagues can access the database through an SQL Developer like client you could try and run the code in the trigger "manually".
See here for info and possible actions when you encounter ORA-01722.
Related
Having a very weird issue here. I have a list of environments built for dev/test/qa/prod. Each connects to a different database, one corresponding to each environment. When I run the code in dev, everything is great, when I run it in any other environment, I get
Factory method 'sessionFactory' threw exception; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [dbo.Cause_Code]
I would like to now note that this for test/qa/prod, the code is deployed to servers and WORKS. No errors, but running it locally gives me that missing table. That table definately exists and dev/test/qa/prod databases are in the exact same schema state.
You can see here that the table is in the QA database and the IDE sees that:
Adding schema="dbo" to table annotation does nothing, changing hibernate.hbm2ddl.auto to none allows it to build, but all calls fail for the same reason.
I should note that I have tested that is not the environments I built. Dev works, I changed the database connection for that environment to QA and it failed. I also tried adding in the data source directly to hibernate persistance window and that did nothing.
Can someone tell me why the IDE thinks the tabble doesn't exist, but the deployed code works great and the table definitely exists? I have to be missing a simple setting somewhere.
Well, I got tired of trying different things over the last 6 hours and re-installed the IDE. Imported the project which had the shared environment configs already set up. Made no changes and just ran the QA build, worked first try. I guess there was something messed up in the install. No idea why it only affected every environment but dev though. I tried everything form restarting the entire computer to disabling everything to creating an empty project and only the re-install fixed it.
I am newbie to Drools. I have informed from people that, if we use DRL files we dont need to restart server in production system and code changes effects automatically but in my case is not happening...
example :
when
$account : Account( balance > 10 )
then
System.out.println("Print");
case 1) so as per above example I have started the server and it starts to given the console in follow since I looped in while(true) in java side
Print
Print
Print
.....
.....
.....,so on
case 2) Here is the change I am doing with out stopping the jboss server
when
$account : Account( balance > 10 )
then
System.out.println("Changed Print");
now I am expecting the result as
Changed Print
Changed Print
Changed Print
.....
.....
.....,so on
But the problem is still I am getting cas2 1 ouptput... why DRL is not compiled automatically since I have changed and saved the file.
Do I understand the DRL purposer correct? Your Help appreciated. Thanks
[Not direct answer, but comment would be too long; based on very limited experience with excel based files.]
It's not mentioned how you are deploying application on server; if it's WAR/JAR etc. then you shouldn't change content of it at runtime or is file externally referenced[through URL may be] at server location, not clear.
Changing files at runtime will not make any effect unless server is configured for hot deployment.
Drools engine has production
memory where rules are stored & working
memory to maintain facts. Former cannot be changed at runtime while later can be updated.
When you start changing rules, it's just starts getting difficult even to successfully execute it, if executed then to get rule work correctly, class mappings etc. is another part.
Eventually I ended up debugging to check how rules were executed which definitely you wouldn't want to. You can try adding log in drl file would help.
Drools usually is included in a JBoss stack, which means that following a good design architecture, you will keep them in a separate bundle. That is, on any rule update, this bundle has to be rebuilt and redeployed, without having to restart the server itself.
On the other hand, for your reference, you can also read this answer.
I have a Rails 3.2.13 application written in JRuby (1.7.12). I'm developing on Mac OS X 10.10 (though the problem was also evident on 10.9). I have both JDK 1.6 and 1.7 installed. I'm serving the application via torquebox 3.1.1.
If I start the application connecting to my local postgres database, I have no issues. But I need to debug a problem that requires connecting to Oracle. I then switch my adapter to oracle-enhanced and making sure I have ojdbc6.jar and ojdbc7.jar in $JRUBY_HOME/lib. When I start the application via torquebox, I get errors like this:
14:47:58,242 ERROR [org.torquebox.core.runtime] (pool-8-thread-1) Error during execution: ENV['RAILS_ROOT']=RACK_ROOT
ENV['RAILS_ENV']=RACK_ENV
require %q(org/torquebox/web/rails/boot)
: org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `blame_file!' forjava.lang.StackOverflowError:Java::JavaLang::StackOverflowError
I realize the blame_file! error is a separate thing. The StackOverflowError that's the cause of that error is what I care about. It's getting into a failing loop when trying to load necessary files, like rails/boot in this case.
However! When I run "rails console" it works fine and I can load data from the database.
I'm convinced as a result of being able to load the console that this is a problem with torquebox somehow, but I don't know what, nor how to fix it.
Is there any helps anyone can give me? Has anyone seen something like this before? Thanks.
(Edit, I found a locally cached copy of ojdbc7.jar in the app, which explains my original errors with 1.6. I've edited this post to reflect the current situation.)
Try looking at https://github.com/jruby/jruby/issues/976 to work around the blame_file problem and then hopefully you'll get a more useful error message.
Maybe then you'll get something be able to diagnose something similar to:
Error while loading java Class in Jruby application
I got some help on irc.freenode.net/#torquebox. After some confusion about the stack output vs. my stack size, it was suggested that I scale that back some. I set it from 4096m (yes, I realize now that that's ridiculous) to 2048k, and it works.
We don't know why Java crapped out in this specific way, but the end result is that with a smaller stack size, it works now.
I'm currently working with Java Stored Procedures in Oracle and am seeing some strange behaviour when attempting to get a connection within my Java code.
My Java is packaged up into a jar file and then deployed into Oracle using the loadjava command line utility. A package is then created in the database which maps each method in a designated Java class to a PL/SQL function via call specifications.
Some of the columns which I'm working with are CLOBs. In the Java I attempt to extract the value of this CLOB (mapped in call specification as oracle.sql.CLOB) into a String:
private static String getStringFromCLOB(CLOB clob) throws SQLException {
long length = clob.length();
return clob.getSubString(1, (int) length);
}
When I run this code I get the following stack trace showing up in SQL*Plus:
java.lang.ArithmeticException: / by zero
at oracle.jdbc.driver.T2SConnection.<init>(T2SConnection.java:107)
at oracle.jdbc.driver.T2SDriverExtension.getConnection(T2SDriverExtension.java:31)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:481)
at oracle.jdbc.driver.OracleDriver.defaultConnection(OracleDriver.java:505)
at oracle.sql.DatumWithConnection.getPhysicalConnection(DatumWithConnection.java:53)
at oracle.sql.DatumWithConnection.getInternalConnection(DatumWithConnection.java:177)
at oracle.sql.CLOB.getDBAccess(CLOB.java:1383)
at oracle.sql.CLOB.length(CLOB.java:197)
Before I was just seeing the message of the Exception so I wrapped the offending method's contents with a try / catch so I could dump the full stack trace to the System.out.
It is worth noting that I have had this working on Oracle 11.2.0.1.0 (32bit) but it is not working on Oracle 11.2.0.2.0 (64bit).
I have also had other Java-backed PL/SQL functions working without a problem. It is only the ones that attempt to make a connection that fail.
I have had a look in <ORACLE_HOME>\jdbc\lib and the jars, although named the same, seem to be different in these two distributions. The jars in the directory are (11.2.0.1.0 size and 11.2.0.2.0 size shown):
ojdbc5.jar (1,950KB | 1,983KB)
ojdbc5_g.jar (3,010KB | 3,271KB)
ojdbc5dms.jar (2,374KB | 2,489KB)
ojdbc5dms_g.jar (3,030KB | 3,291KB)
ojdbc6.jar (2,062KB | 2,102KB)
ojdbc6_g.jar (3,323KB | 3,782KB)
ojdbc6dms.jar (2,594KB | 2,698KB)
ojdbc6dms_g.jar (3,344KB | 3,805KB)
simplefan.jar (20KB | 20KB) <-- probably the same
The manifest files of these jars confirm they are built for the specific version, i.e. 11.2.0.1.0 or 11.2.0.2.0. Is it possible a bug has been introduced in 11.2.0.2.0? Or is it more likely to be user, i.e. my, error :-)
Also, where does the oracle.jdbc.driver.T2SConnection class live?
Any help / guidance very much appreciated. Please let me know if you need more information.
I had this issue when my password was expiring. I solved this just changing the password.
Have similar problem with recent Oracle JDBC drivers. Our case seems to be a problem mixing jars from different versions, like 11.2.0.1 and 11.2.0.3, for example ojdbc6.jar from 11.2.0.1 and oi18n.jar from 11.2.0.3. One nice technique is decompiling the entire jars of the Oracle JDBC driver and look the line in the source code that is raising the error. Could provide a tip about the error/bug.
Try to use the same JDBC driver version in both client machines.
oracle.jdbc.driver.T2CConnection lives in any main jar of the driver, like ojdbc5.jar.
My Java/JDBC code suddenly stopped working from one day to another.
Same problem here. Expired password. I tried both ojdbc6 and ojdbc7. Upgraded my VM environment. The code worked fine against a different database.
target_user="c##ora$rman_bkp"
Placeholder START_DATE=20170422
Placeholder START_DATE_TIME=2017Apr22-20h47m13s
jdbcURL='jdbc:oracle:oci8:#twelve_static'
Exception in thread "main" java.lang.ArithmeticException: / by zero
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:1387)
at oracle.jdbc.driver.T2CPreparedStatement.<init>(T2CPreparedStatement.java:109)
at oracle.jdbc.driver.T2CDriverExtension.allocatePreparedStatement(T2CDriverExtension.java:81)
at oracle.jdbc.driver.PhysicalConnection.prepareStatementInternal(PhysicalConnection.java:2013)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:1960)
at oracle.jdbc.driver.T2CConnection.prepareStatement(T2CConnection.java:57)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:1866)
at oracle.jdbc.driver.T2CConnection.prepareStatement(T2CConnection.java:57)
at LV.verifyLicensedDbId(LV.java:238)
at RmanJ.<init>(RmanJ.java:1891)
at RmanJ.main(RmanJ.java:1809)
SYS#TWELVE:SQL> select account_status from dba_users where username='c##ora$rman_bkp';
ACCOUNT_STATUS
--------------------------------
EXPIRED(GRACE)
SYS#TWELVE:SQL> connect "c##ora$rman_bkp"
Enter password:
ERROR:
ORA-28002: the password will expire within 5 days
Connected.
c##ora$rman_bkp#TWELVE:SQL> password
Changing password for "c##ora$rman_bkp"
Old password:
New password:
Retype new password:
Password changed
Tested my code and it worked fine again. Yet another unbelievable bug in Oracle's software.
Their quality assurance never ever gets it right. I'm absolutely convinced that they don't even have proper test plans,
otherwise they would catch such severe errors as division by zero for an expired password.
To those that might come across this issue we discovered that it was caused by a corruption of the JVM install within Oracle. This probably occurred due to a bad installation.
Reinstalling the JVM aspect of Oracle allowed oracle.jdbc.driver.OracleConnection.defaultConnection() to run without any issues whether explicitly called or called as part of the stack of another call, e.g. oracle.sql.CLOB.length().
I have a particularly tricky situation here. I am supporting an java based packaged web application that runs on JBoss. The application is a packaged application so I don't really have access to any code or know how the code was developed.
What I am trying to find out is what the JDBC fetchSize is being set to. I don't know where it is being set, meaning at the ResultSet level or Statement level etc..
Here is what I have tried so far:
1) I tried to configure tracing for the JDBC driver by downloading the ojdbc_g.jar file from Oracle and following the instructions that they provided. Unfortunately, in those instructions, it states that I need to add this jar file to the CLASSPATH and I am not sure where that is being set in this application. Needless to say, this path was not fruitful, as I was never able to successfully get a trace file output.
2) I tried using WireShark to capture all TNS packets to see if I could find it out that way, and this again was fruitless because at that level, it is next to impossible to actually find how many rows are being passed each time. There are so many other dependencies there, and I was unable to get the info I am after.
3) The last thing I tried was configuring a database side trace of SQL Net calls to the database, but I am not sure whether I have to do this in the sqlnet.ora file or if I have to trace the listener.
This is where I am stuck now. Again, all I want to do is find out what the application's JDBC fetchSize is being set (if its even being set at all). I know that this can impact the performance of the application so that's why I want to find it.
Any guidance is appreciated.
Thanks.
unpack the jar file, try grepping for fetchSize in the class files, this will give you the class file. Then disassemble or decompile, or debug to see what it is set to.