Friday, April 15, 2011

How to debug a jar file in JDeveloper

I need to debug a jar file used by a SOA project in JDev. Here is a way to configure the debugging environment.

I use two installation of JDev to debug. One installation is used as development and will be kept stable. The other is used as test environment and maybe refreshed frequently based on the new build of JDev.

Prerequisite:
  • Two installations of JDeveloper, JDev A and JDev B.
  • JDev A has the project which has the source code.
  • JDev B has the SOA project using the jar file built from JDev A. The jar file has been placed in the patches dir located in $dir/jdeveloper/jdev/lib
Configuration Steps:
  • In JDev A, right click the project name->Project Properties->Run/Debug/Profile->select Default->Edit
  • Place the jdev.conf (of JDev B) file path in the Default Run Target edit box.



  • click on icon to start the JDev B instance.

Monday, January 24, 2011

SOA Integration Adapter Installation

This document shows how to install Oracle SOA suite with adapter. It is based on Oracle SOA suite PS2 (11.1.1.3) release.

I was trying to install it on Windows XP first, but the weblogic server cannot be started because the "not enough space for object heap" error. So I switched the installation to Linux. That's why you will find some Windows path in the document, but should not be too confused.

On Windows, here is the error I got when I tried to start the server. I tried to set the Xms and Xmx value, but no luck.

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

So better to do the installation on Linux box.

Step 1: Download the following packages from OTN:

Go to http://www.oracle.com/technetwork/middleware/downloads/fmw-11-download-092893.html to download the following packages:

  • Weblogic Server (10.3.3): Oracle WebLogic Server 11gR1 (10.3.4) + Coherence - Package Installer (File1-796MB)
  • SOA Suite (11.1.1.2.0) - Generic 1.7GB (all platforms)
  • SOA Suite (11.1.1.3.0) - PS2 patch set, Generic 1.9GB (all platforms)
  • Application Adapters (11.1.1.3.0) - Generic 194MB
  • Repository Creation Utility (11.1.1.3.3) - 323MB
  • JDeveloper and Application Development Framework in the Required Addition Software section
Unzip those packages to a directory. The adapter package includes all platform installation bits, the one for windows is iwora11g.application-adapters.win32.exe.

Step 2 Installation:

  • Weblogic Server
Run wls1034_win32.exe to install Weblogic Server.

  • SOA PS1 (11.1.1.2)
Unzip SOA package and run setup.exe located in the Disk1 directory to install SOA PS1 on top of the Weblogic Server. You need provide the java home if it's not available.

Starting Oracle Universal Installer... Checking if CPU speed is above 300 MHz . Actual 2327 MHz Passed Checking swap space: must be greater than 512 MB . Actual 4092 MB Passed Checking monitor: must be configured to display at least 256 colors Higher than 256 . Actual 65536 Passed Preparing to launch Oracle Universal Installer from C:\DOCUME~1\xxx\LOCALS~1\Te mp\OraInstall2011-01-24_11-58-01AM. Please wait ... Please specify JRE/JDK location ( Ex. /home/jre ), /bin/java should e xist :

Enter the java home path, then hit Enter. The JKD version should be JDK 1.6_21, you can find it in middleware home created during Weblogic Server installation.

  • SOA PS2 patch
install SOA PS2 (11.1.1.3) patch on top of PS1 by running ofm_soa_generic_11.1.1.3.0_disk1_1of1\Disk1\setup.exe

Then follow the steps in
http://fmwdocs.us.oracle.com/doclibs/fmw/11gr1ps1_final/doc.1111/e17054/install.htm#CIHDJIDA

  • Schema creation
Unzip Repository Creation Utility package, then go to bin directory, run the following command

export XEDB=XX.XX.XX.XX:port:XID

./rcu -silent -createRepository -connectString ${XEDB} -dbUser sys -dbRole sysdba -lockSchemas false -schemaPrefix XXX -component SOAINFRA -component MDS -component ORASDPM -component BAM

  • Configure Domain
/scratch/wfu/product/otn/soa11.1.1.3/oracle_common/common/bin/config.sh

  • Install SOA extension on top of the JDev
Go to Help->Check for Updates, provide proxy server information if necessary.

Choose 'Oracle SOA Composite Editor 11.1.1.3.0.25.57' to get the extension.

A soa-jdev-extension.zip file will be downloaded to ./jdeveloper/tmp/update if you are curious what it's doing behind the scene.

restart jdev to finish the update.




Troubleshooting

  • Check patch status
C:\Oracle\shiphome\otn11.1.1.3\Oracle_SOA1\OPatch>opatch.bat lsinventory

The Oracle Home C:\Oracle\shiphome\OTN111~1.3 is not OUI based home. Please give proper Or
acle Home.
OPatch returns with error code = 1

OPatch failed with error code = 1

this means the ORACLE_HOME is not set correctly.

  • JavaHome value defined in system registry->HKEY_LOCAL_MACHINE->SOFTWARE->JavaSoft->Java Development Kit should not contains spaces.
  • OutOfMemory issue when installing adapter file
[Linux installation]
$ ./iwora11g.application-adapters.linux.bin
InstallShield Wizard

Initializing InstallShield Wizard...

Searching for Java(tm) Virtual Machine...
...................................
.......................................
Exception in thread "main" java.lang.LinkageError: unexpected exception during linking: com.installshield.util.ZipUtils
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
at _Jv_ResolvePoolEntry(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
at run.main(java.lang.String[]) (Unknown Source)
Caused by: java.lang.OutOfMemoryError


The solution is to provide the java home as below:

./iwora11g.application-adapters.linux.bin -is:javahome <javahome>

  • java.lang.NoClassDefFoundError: weblogic/sca/api/ScaReferenceProcessor exception when starting managed weblogic server
When starting managed weblogic server, you may get the following exception

[2011-02-14T23:46:55.195-08:00] [soa_server1] [ERROR] [] [org.springframework.web.context.ContextLoader] [tid: [ACTIVE].ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: ] [ecid: 0000IscI2P517iB_JX8Dyf1DMYw^000000,0] [APP: soa-infra] Context initialization failed[[
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SensorManager' defined in ServletContext resource [/WEB-INF/fabric-config-core.xml]: Cannot resolve reference to bean 'FabricMesh' while setting bean property 'fabricMesh'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FabricMesh': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FabricMeshTarget' defined in ServletContext resource [/WEB-INF/fabric-config.xml]: Cannot resolve reference to bean 'SpringServiceEngine' while setting bean property 'serviceEngines' with key [6]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [oracle.integration.platform.blocks.java.SpringServiceEngine] for bean with name 'SpringServiceEngine' defined in ServletContext resource [/WEB-INF/fabric-config.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: weblogic/sca/api/ScaReferenceProcessor
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:701)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1872)


Here is the reason why the server threw the exception:

The ScaReferenceProcessor class file is located in MIDDLEWARE_HOME/modules/com.oracle.weblogic.sca.engine_1.2.0.0.jar (For 11.1.1.3 installation)

But the jar file referenced in the oracle.soa.wls.jar (located at ORACLE_HOME/soa/modules) still points to the 11.1.1.2 version jar file name which is com.oracle.weblogic.sca.engine_1.1.0.0.jar. You can unzip the oracle.soa.wls.jar file and check the MANIFEST.MF file.

The solution is either to update the MANIFEST file with the right jar file name or create symbolic link for the com.oracle.weblogic.sca.engine_1.2.0.0.jar file. For example, go to MIDDLEWARE_HOME/modules directory and run the following command:

ln -s com.oracle.weblogic.sca.engine_1.2.0.0.jar com.oracle.weblogic.sca.engine_1.1.0.0.jar