Aug062010

Oracle Forms and Sun JVM 1.6

Published by admin at 8:34 PM under

Oracle Forms kullanıyorsanız ve java versiyonunuzu 1.6 ya yükseltmek istiyorsanız bir süpriz ile karşılaşacaksınız. Çünkü yeni versiyonda bazı class lar eksik, o yüzden bazı Forms ekranlarında hata alacaksınız.
Bu sorundan kurtulmak için
oracle/bali/share/sort/StringComparator class larınızı projenizde kullandığınız başka bir JAR ın içine ekliyebilirsiniz. Yada share.jar dosyasını projenize dahil edebilirsiniz.
Bu işlemlerin nasıl yapıldığını aşağıdaki yazıda detaylı olarak görebilirsiniz.

This blog will describe a workaround to get Oracle Forms to work with the newly release version 6 of Sun’s Java SE. When we moved Forms to the web we decided not to use Oracle’s own JInitiator but opted for Sun JPI. I’ve blogged before about the step needed to configure Oracle Forms to use Sun JPI in stead of Oracle JInitiator.

We decided to use dynamic versioning with Sun JPI. This means we specify a minimum required version of the JVM in the webpage, but allow the client to use any newer version installed on the local workstation. The other option is static versioning in which you demand a specific version of the JVM. We didn’t want to use static versioning as the majority of our users are external users over the internet in other organizations. We wanted to make the transition to webforms as smooth as possible and thus allowed them to leverage any existing JVM versions on their workstations.

Oracle officially supports the use of Sun JVM with Oracle Forms. They announced support for Sun JPI 1.4.2 in June 2005 for Forms 10gR1 (9.0.4) and certified JPI 1.5.0 in September 2005 for Forms 10gR2 (10.1.2). My understanding is that Oracle hasn’t begun the certification for J2SE 6 yet.

Since we use dynamic versioning users that do install the new version on their workstation will use J2SE 6 to access our Forms application automatically. So, even without official certification I did some preliminary testing and found two issues. One is related to the use of TLS as HTTPS/SSL protocol combined with Oracle WebCache 10.1.2 which does not work out of the box. I’ll blog about that later. The other issue is that some Forms crashed. When started from the menu they just wouldn’t start and the open window would disappear. Looking at the Java Console an error was displayed:

Exception in thread "AWT-EventQueue-2"
java.lang.NoClassDefFoundError:
oracle/bali/share/sort/StringComparator
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.access$100(Unknown Source)
at java.awt.Component$2.run(Unknown Source)
at java.awt.Component$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Unknown Source)
at java.awt.Component.(Unknown Source)
at java.awt.Container.(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.(Unknown Source)
at oracle.ewt.lwAWT.LWDataSourceChoice.(Unknown Source)
at oracle.ewt.lwAWT.LWChoice.(Unknown Source)
at oracle.ewt.comboBox.ComboBox.(Unknown Source)
at oracle.ewt.comboBox.ComboBox.(Unknown Source)
at oracle.forms.ui.VComboBox.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at oracle.forms.handler.UICommon.instantiate(Unknown Source)
at oracle.forms.handler.UICommon.onCreate(Unknown Source)
at oracle.forms.handler.PopListItem.onCreate(Unknown Source)
at oracle.forms.handler.ComboBoxItem.onCreate(Unknown Source)
at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.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.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)

It turns out that the Forms applet is trying to use the oracle.bali.share.sort.StringComparator class which cannot be found in the frmall.jar that was used to start Forms. According to the error stack it has something to do with the initialization of a ComboBox. Opening the frmall.jar indeed revealed that the StringComparator class is not included. There are a number of other classes in the oracle.bali.share.sort package: Comparator, LexiComparator and Sort

I also searched the other JAR files in the ORACLE_HOME/forms/java directory but none of them contained the StringComparator class. In fact, the only two JAR files in the entire ORACLE_HOME that contained the class where ORACLE_HOME/oui/jlib/shared.jar from the Universal Installer and ORACLE_HOME/jlib/share.jar

I’ll see if I can get Oracle to look at this problem even without official support for J2SE 6 but I guess they will want to support version 6 eventually. I tried two quick-and-dirty solutions to the problem. One is to include share.jar in the list of JAR files to start Oracle Forms. The other is to slipstream the oracle.bali.share.sort classes from the share.jar in the frmall.jar.

Including the share.jar in the formsweb.cfg

The first solution is to include the share.jar in the distribution. In our current installation of Forms 10.1.2.0.2 the share.jar does not contain any classes that are also included in the frmall.jar. First is to copy the ORACLE_HOME/jlib/share.jar to ORACLE_HOME/forms/java/share.jar. You also have to include the share.jar in the archive parameter of the formsweb.cfg

But the frmall.jar is a signed jar. If you do not sign the share.jar as well you will get a SecurityException:

java.lang.SecurityException:
class "oracle.bali.share.sort.StringComparator"'s signer
information does not match signer information of other classes
in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.access$100(Unknown Source)
at java.awt.Component$2.run(Unknown Source)
at java.awt.Component$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Unknown Source)
at java.awt.Component.(Unknown Source)
at java.awt.Container.(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.(Unknown Source)
at oracle.ewt.lwAWT.LWDataSourceChoice.(Unknown Source)
at oracle.ewt.lwAWT.LWChoice.(Unknown Source)
at oracle.ewt.comboBox.ComboBox.(Unknown Source)
at oracle.ewt.comboBox.ComboBox.(Unknown Source)
at oracle.forms.ui.VComboBox.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at oracle.forms.handler.UICommon.instantiate(Unknown Source)
at oracle.forms.handler.UICommon.onCreate(Unknown Source)
at oracle.forms.handler.PopListItem.onCreate(Unknown Source)
at oracle.forms.handler.ComboBoxItem.onCreate(Unknown Source)
at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.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.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)

So, you have to sign the share.jar with the same certificate that was used to sign the frmall.jar. Out of the box the frmall.jar is signed by Oracle and we do not have the keystore required to sign the jar file. You will have to sign the frmall.jar with your own certificate and use the same certificate to sign the share.jar file. In September 2005 I already blogged about signing the frmall.jar with your own certificate.

Slipstreaming classes in the frmall.jar

The other solution is to slipstream the classes from the oracle.bali.share.sort package in the frmall.jar. You have to unpack both the share.jar and the frmall.jar. Then copy the classes from the oracle/bali/share/sort directory from the share.jar to the unpacked frmall.jar. Then repack frmall.jar and sign it. You can follow the steps in another blog entry to unpack jar files, repackage and sign them.

Conclusion

Adding the classes to my Forms server does seem to resolve the problem with the crashing Forms. However, I’m sure this is not a supported solution and I don’t really like the concept of just grabbing a number of classes from a JAR file and use them just because their names match. Who knows which version is actually required and why Forms apparantly does not require these classes when using Sun JPI 1.4 or 1.5.

I’ll see if I can get Oracle to look into the problem and will update this blog entry with any progress I make with running Forms with Sun J2SE 6. The coming weeks I will use J2SE 6 with Oracle Forms 10.1.2.0.2 on my machine and will report back here with any issues.

Source : http://www.oratransplant.nl/2007/01/04/oracle-forms-and-sun-jvm-16/



[KickIt] [Dzone] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags: ,

E-mail | Permalink | Trackback | Post RSSRSS comment feed 0 Responses