an issue with compatibility: old jboss/hibernate vs Oracle 12c - java

i'm Oracle-DBA trying to upgrade our Oracle-11g databases onto Oracle-12c. Our web-developers tell me, there is a big problem to work our old applications (a lot of them were developed with old JBOSS 4.2.2 and old Hibernate 3.4.0/3.1.0) to the new the Oracle-database(12c)
Our developers send me this information:
**Application:
seam-version -> 2.2.2.Final
hibernate-annotations-version -> 3.4.0.GA
hibernate-validator-version -> 3.1.0.GA
jsf-facelets-version -> 1.1.14
rich-faces-version -> 3.3.3.Final
als Dependency: hibernate-core version 3.3.0.SP1 for Compilieren.
OracleDialect: org.hibernate.dialect.Oracle10gDialect
JBOSS 4.2.2.GA
Hibernate-Version: 3.2.4.sp1
Hibernate Annotations Version: 3.2.1.GA
Hibernate EntityManager Version: 3.2.1.GA
Oracle JDBC Driver for 11g - ojdbc14
Oracle JDBC Driver for 12c - ojdbc6
so, if you call a PROCEDURE XXXXXXXXX (o_res out sys_refcursor, p_yyyyy IN NUMBER, .... )
it throws this problem:
....
INFO | Caused by: org.hibernate.HibernateException: Problem while trying to load or access OracleTypes.CURSOR value
.....................
INFO | Caused by: java.lang.IllegalAccessException: Class org.hibernate.dialect.Oracle9Dialect can not access a member of class oracle.jdbc.driver.OracleTypes with modifiers ""
Bug: https://hibernate.atlassian.net/browse/HHH-3159
although, according this link we should had get a problem even with Oracle-11g, not while trying to upgrade to 12c! ( "With Oracle 11g, the deprecated package oracle.jdbc.driver no longer exists and this causes issues with all OracleDialect classes making it impossible to use Hibernate."(с) )
here one can read:
"Try to use org.hibernate.dialect.Oracle10gDialect, seems to be the highest possible version in Hibernate 4.3.9.
A dialect for 12c seems to be present in later versions, see this."
(we have even an older version of Hibernate - 3.2.4 ! )
a newer Hibernate (> 3.2.4 ), if i've got it right, is not compatibe with the old Jboss 4.2.2. (is it?! Please disagree with me (=with my colleagues) if you can)
what could be a right decision or workaround to make the 12c-Oracle-upgrade?
Thank you very much in advance!

Related

Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null

The application I migrate to Java8 was running on Java7. After the migration i had to update the db2jcc.jar to latest version and yet I have the error below:
Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null
I have checked and tried the topic Getting error code 4220 with null SQL State
My DB version : DB2 v10.5.0.11
The db2 Jar I use : db2jcc-9.5.jar
Has anyone faced this before?
Regards
Your question included
My DB version : DB2 v10.5.0.11
The db2 Jar I use : db2jcc-9.5.jar
The exception text included:
[Camel Thread #2 - JmsConsumer[null]] WARN **** - SQLException: com.ibm.db2.jcc.a.SqlException:
[jcc][t4][10199][10462][3.52.95] Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null
Notice the db2 jdbc driver version, [3.52.95] included in the exception text.
This is an old driver that comes with db2 version 9.5 fixpack2a, long out of support.
You need to be using a recent type 4 jdbc driver for Db2, and the version of the db2 jdbc driver will appear in the exception text as a three part number with a dot separating the parts.
For Db2-LUW v10.5 the currently available version of the db2 type 4 jdbc driver is 4.19.80 although you can use higher versions.
You can download the recent jdbc driver versions from this IBM website, you will need to register with IBM first, although the download is free.

About Legacy Application Classes 12 to Ojdbc6 migration in jdev9.0

Currently I am working with a legacy application which uses classes12 and jdevoper 9.0 and java 1.4. I wanted to upgrade java to 1.6 and OJDBC6 with Jdev 9.0 .
But Jdev use BC4 libraries which are also old one. I had changed my java version to 1.6 and updated classes12 to ojdbc6. but after that I was facing build issue as BC4j lib also have some connection with it.
after updating bcj lib with adfm jar I am getting below issue. Could any one please suggest any minimal changes to work my application to work
Currently java 1.4 oracle 11g DB and Jdev 9.0 classe12 and I want
java 1.6 oracle 12c jdev 9.0 ojdbc6
SEVERE: { type : AppBundleInfoRT, id : 'en_US-null-null', moRefName : null, appBundleName : null, writable : false, dirty : false, hasMdsConfig : false, appOverrideBundle : null}: Fail to read adf-config.xml
oracle.adf.share.ADFShareException: getMDSInstance error
at oracle.adf.share.config.FallbackConfigImpl.getMDSInstance(FallbackConfigImpl.java:104)
at oracle.javatools.resourcebundle.AppBundleInfoRT.readAdfConfig(AppBundleInfoRT.java:341)
at oracle.javatools.resourcebundle.AppBundleInfoRT.loadData(AppBundleInfoRT.java:123)
at oracle.javatools.resourcebundle.AppBundleInfoFactoryRT.createAppBundleInfo(AppBundleInfoFactoryRT.java:83)
at oracle.javatools.resourcebundle.ResourceBundleUtils.getAppBundleInfoUnlocked(ResourceBundleUtils.java:334)
at oracle.javatools.resourcebundle.ResourceBundleUtils.getAppBundleInfo(ResourceBundleUtils.java:325)
at oracle.javatools.resourcebundle.ResourceBundleCacheConfig.getCurrentAppConfig(ResourceBundleCacheConfig.java:109)
at oracle.javatools.resourcebundle.ResourceBundleManagerRT.<init>(ResourceBundleManagerRT.java:84)
at oracle.javatools.resourcebundle.ResourceBundleManager.getResourceBundleManager(ResourceBundleManager.java:183)
at oracle.javatools.resourcebundle.BundleFactory.getMap(BundleFactory.java:86)
at oracle.javatools.resourcebundle.BundleFactory.getBundle(BundleFactory.java:245)
at oracle.javatools.resourcebundle.BundleFactory.getBundle(BundleFactory.java:206)
at oracle.jbo.common.StringManager.getStringFromBundle(StringManager.java:582)
at oracle.jbo.common.StringManager.getStringInternal(StringManager.java:530)
at oracle.jbo.common.StringManager.getString(StringManager.java:477)
at oracle.jbo.common.StringManager.getLocalizedString(StringManager.java:305)
Oracle 12c does not support ojdbc6 as per What are the Oracle JDBC releases versus JDK versions? docs. Do note that Oracle 12cR2 strictly requires ojdbc8 to establish the connection, your current Java 6 setup most likely won't work.

Hibernate and MSSQL 2016 issue

I'm facing a problem with a Java application (JVM 1.6) that is using Hibernate 3.6 to access a Microsoft SQL Server via Microsoft JDBC Driver for SQL Server.
When working with SQL JDBC driver 3.0 and MSSQL 2008 - 2014 all is working just fine.
But when I'm trying to use MSSQL 2016, the latest "Microsoft JDBC Driver 6.0" (sqljdbc4.jar) - I get a bunch of those errors:
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
It happens on different entities, and can happen on a get or update operations.
My question: is this an issue with Hibernate that also needs to be updated to a newer version?
I wasn't able to find any information about compatibility issues when accessing MSSQL 2016 via Java/Hibernate.
Thanks!
If possible can you try to use JVM 1.7 and sqljdbc41.jar? Better if you able to use JVM 1.8 and sqljdbc42.jar.
Microsoft recently Open Source their driver on GitHub. You can raise issue on their github project.
As per my understanding for SQL Server 2016 you need either sqljdbc41.jar or sqljdbc42.jar
Further you can found more official documentation on MSDN.
Microsoft JDBC Driver 6.0 and 4.2 for SQL Server:
To support backward compatibility and possible upgrade scenarios, the JDBC Drivers 6.0 and 4.2 include four JAR class libraries in each installation package: sqljdbc.jar, sqljdbc4.jar, sqljdbc41.jar, and sqljdbc42.jar. Note: sqljdbc.jar, sqljdbc4.jar are provided only for backwards compatibility, and do not contain new features included with driver versions 6.0, 4.2, and 4.1.

Neo4J without ServiceLoader

I have been using Neo4J 1.8.x as an embedded database in an application framework that breaks the regular ServiceLoader used by Neo4j. So far, I've worked around this issue by using the OSGi instructions for Neo4j. This has worked great.
However, these OSGi instructions no longer work for 1.9.0, 1.9.1 or 2.0.0-M03. When initializing the embedded database I get this exception:
java.lang.ExceptionInInitializerError
at plugins.fritter.Fritter.setupNeo4j(Fritter.java:240)
at plugins.fritter.Fritter.runPlugin(Fritter.java:106)
at freenet.pluginmanager.PluginHandler.startPlugin(PluginHandler.java:45)
at freenet.pluginmanager.PluginManager.realStartPlugin(PluginManager.java:394)
at freenet.pluginmanager.PluginManager.startPluginFile(PluginManager.java:367)
at freenet.clients.http.PproxyToadlet$3.run(PproxyToadlet.java:157)
at freenet.support.PooledExecutor$MyThread.innerRun(PooledExecutor.java:247)
at freenet.support.PooledExecutor$MyThread.realRun(PooledExecutor.java:187)
at freenet.support.io.NativeThread.run(NativeThread.java:129)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.neo4j.graphdb.factory.GraphDatabaseSettings.<clinit>(GraphDatabaseSettings.java:79)
... 9 more
I am aware that the OSGi setup instructions have changed from 1.9.0 and higher versions OSGI, but the new initialization methods do not address the issue.
Is neo4j > 1.8.3 still supported in a non-ServiceLoader / OSGi context and, if so, what is the proper way to set it up?

JBOSS deployment having HibernateException on oracle major version 11

Trying to deploy application ear file with following settings in JBoss-4.2.3.GA
jboss-app.xml
<jboss-app>
<loader-repository>
com.xxxx.xxx:loader=<ear-name>
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
</jboss-app>
persistence.xml (just a snippet)
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/XXXXFactory"/>
Got following logger info during deployment, I am not sure why an exception is listed in an INFO logger, can I not bother about this?
16:30:07,239 INFO [STDOUT] 16:30:07,238 INFO [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 11.2.0.3.0
javax.ejb.EJBException: org.hibernate.HibernateException: unknown Oracle major version [11]
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
Caused by: org.hibernate.HibernateException: unknown Oracle major version [11]
at org.hibernate.dialect.DialectFactory$1.getDialectClass(DialectFactory.java:135)
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:65)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
Note: We are using JBoss-Seam-2.2.0.GA
Tried: this, this and that
Please let me know if any additional information is required, I am trying to pull back the libs available in jboss to the ear.
Update: Tries
Figured out that the application is using 2 different sessions and
there is one hibernate.cfg.xml also for another legacy code, there
is no dialect specified in it.
So added Oracle10g dialect to
cfg.xml, it stopped throwing above mentioned unknown oracle
version error, but it exceptioned as it couldn't load the
10gDialect.
Beauty is both the sessions are pointing to the same datasource.
Try to add
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
also to JBoss/server/default/deploy/ejb3.deployer/META-INF/persistence.properties.
It works for me with JBoss-4.2.3.GA's bundled Hibernate 3.2.4.sp1 and ojdbc5 11.1.0.6.0 (both in JBoss global libs).
Update
Also recheck that an older version of hibernate is not present somewhere in classpath.
JBoss-Seam-2.2.0.GA distribution bundles hibernate 3.3.1.GA while Hibernate dialect for Oracle Database 11g? suggests that at least Hibernate 3.3.2+ is required for recent JDBC drivers.
JBoss-4.2.3.GA's bundled Hibernate 3.2.4.sp1 may have some modern staff backported.
I've never faced this kind of exception but to me it sounds very clear:
The Hibernate's DialectFactory should maintain some kind mapping of data base engine type
(including version) to the actual dialect. The whole issue is that you don't have a regitered mapping to Oracle 11
As a first bet I would take a look on this particular class. I don't know what version of hibernate do you have, but it looks like Oracle 11 is simply not supported, at least by the source I've found (Take a look here) Take a look on that ''MAPPERS'' hash map and you'll see... Open source rules here ;)
So I think the best would be upgrading the hibernate to the last version (just check that in the last version the mapper is updated).
Or at least debug the application server to figure out what does parameters are passed to the method and so.
Of course its also possible to build your custom version of Hibernate but I don't think it should be considered as a preferable solution.
I would also consider to override the default dialect as you've already found by yourself in 'that' article :) I don't see why it shouldn't work, but again you'd better debug it.
Maybe you should tell the JBoss somewhere that it should use your dialect as well...
Hope this helps
public String getDialectClass(int majorVersion) throws Throwable
{
switch(majorVersion)
{
case 8: // '\b'
return (DialectFactory.class$org$hibernate$dialect$Oracle8iDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle8iDialect : (DialectFactory.class$org$hibernate$dialect$Oracle8iDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle8iDialect"))).getName();
case 9: // '\t'
return (DialectFactory.class$org$hibernate$dialect$Oracle9iDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle9iDialect : (DialectFactory.class$org$hibernate$dialect$Oracle9iDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle9iDialect"))).getName();
case 10: // '\n'
return (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle10gDialect : (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle10gDialect"))).getName();
case 11: // '\013'
return (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect != null ? DialectFactory.class$org$hibernate$dialect$Oracle10gDialect : (DialectFactory.class$org$hibernate$dialect$Oracle10gDialect = DialectFactory._mthclass$("org.hibernate.dialect.Oracle10gDialect"))).getName();
}
throw new HibernateException("unknown Oracle major version [" + majorVersion + "]");
}
actually this is the code in DialectFactory so when your database version changes above 11 you will have this problem i have added extra switch case its resolved my problem

Categories