Pages

30 May 2011

Enable -Xverbose Command line option of JRockit when running Weblogic

Last update: 31/5/2011

Go to JDeveloper's System Directory, DefaultDomain, bin

Edit setDomainEnv.cmd with:

Add in EXTRA_JAVA_PROPERTIES the -Xverbose Command line option you want
eg. If you want to ebable -Xverbose:exceptions=debug
Replace
set EXTRA_JAVA_PROPERTIES=-Djps.app.credential.overwrite.allowed=true %EXTRA_JAVA_PROPERTIES%
with
set EXTRA_JAVA_PROPERTIES=-Djps.app.credential.overwrite.allowed=true -Xverbose:exceptions=debug 
          %EXTRA_JAVA_PROPERTIES%
(the above line in one line)

The result will be something like
Note: That in the above screenshot the embedded WLS is configured to run with JRockit, because Xverbose is a JRockit option.

The problem is that after the application is deployed and the page is is prompted, output is redirected to stderr and nothing is logged in JDeveloper log pane
So it is better to running from the bat script in the DefaultDomain. See below on how to redirect the output.

Redirect output 
You may want to

startWebLogic.cmd > sdout.log  2> sderr.log



That Create 2 files


Note: There is also a more convenient way with -XverboseLog .

Running embedded Weblogic with JRockit

Go to JDeveloper's System Directory, DefaultDomain, bin

Edit setDomainEnv.cmd with:

Right after the initial comments add
set JAVA_VENDOR=Oracle

Replace the line:
set BEA_JAVA_HOME
with 
set BEA_JAVA_HOME=C:\JRockit\Java\jrockit-jdk1.6.0_20-R28.1.0-4.0.1
where BEA_JAVA_HOME is where the JRockit is installed.

Optionally, print java version to make sure you set it right.
echo java_home = %java_home%
%java_home%\bin\java.exe -version


The result is




JVM arguments and System properties of a running JDeveloper

Helpful to troubleshooting problematic JDeveloper behavior:

Run JDeveloper

Open  Java VisualVM eg %JAVA_HOME%/bin/jvisualvm.exe

Select JDeveloper


JVM arguments:
-Xmx6114M
-Xms512M
-Xverify:none
-XX:MaxPermSize=1024M
-Xbootclasspath/p:../lib/lwawt.jar
-Dsun.awt.keepWorkingSetOnMinimize=true
-Dsun.java2d.noddraw=true
-XX:+HeapDumpOnOutOfMemoryError
-Doracle.jdeveloper.webservice.showAllOwsmPolicyTypes=false
-Doracle.jdeveloper.webservice.hidePropertyOverride=false
-Dsun.awt.disablegrab=true
-Dide.startingArg0=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev64W.exe
-Dide.launcherProcessId=3828
-Dide.config_pathname=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev.conf
-Dide.startingcwd=C:\Oracle\Middleware\jdeveloper\jdev\bin
-Dide.shell.enableFileTypeAssociation=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev64W.exe
-Dide.pref.dir.base=C:\Documents and Settings\spiros\Application Data
-Dide.work.dir.base=C:\Documents and Settings\spiros\My Documents

System properties
EDITOR_J2SE_VERSION=1.5
INSIGHT_OMIT_HIDDEN=true
awt.toolkit=sun.awt.windows.WToolkit
ceditor.java.parse.large=1500
ceditor.java.parse.small=300
class.load.environment=oracle.ide.boot.IdeClassLoadEnvironment
class.load.log.level=CONFIG
class.transfer=delegate
compiler.vmargs=-Xmx512m
feedbackmanager.disable=false
file.encoding=Cp1252
file.encoding.pkg=sun.io
file.separator=\
ice.browser.forcegc=false
ice.pilots.html4.ignoreNonGenericFonts=true
ice.pilots.html4.tileOptThreshold=0
ide.bootstrap.start=8039700699753
ide.build=JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
ide.conf=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev.conf
ide.config_pathname=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev.conf
ide.debugbuild=false
ide.devbuild=false
ide.editions=oracle.studio, oracle.j2ee, oracle.jdeveloper
ide.extension.role.search.path=jdev/roles
ide.extension.search.path=jdev/extensions:sqldeveloper/extensions
ide.feedbackmanager.customer=false
ide.firstrun=false
ide.java.maxversion=1.7
ide.java.minversion=1.6.0_04
ide.launcherProcessId=3828
ide.main.class=oracle.ide.boot.IdeLauncher
ide.max.jar.handles=500
ide.patches.dir=jdev/lib/patches
ide.pref.dir="C:\JDeveloper"
ide.pref.dir.base=C:\Documents and Settings\spiros\Application Data
ide.product=oracle.jdeveloper
ide.shell.enableFileTypeAssociation=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev64W.exe
ide.splash.screen=splash.gif
ide.startingArg0=C:\Oracle\Middleware\jdeveloper\jdev\bin\jdev64W.exe
ide.startingcwd=C:\Oracle\Middleware\jdeveloper\jdev\bin
ide.throttleLocale=true
ide.user.dir="C:\JDeveloper"
ide.user.dir.var=JDEV_USER_HOME,JDEV_USER_DIR
ide.work.dir="C:\JDeveloper"
ide.work.dir.base=C:\Documents and Settings\spiros\My Documents
ilog.propagatesPropertyEditors=false
inJUIDesigntime=true
insight.suppresshidden=true
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.class.path=..\..\ide\lib\ide-boot.jar
java.class.version=50.0
java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0_23\jre\lib\endorsed
java.ext.dirs=C:\Program Files\Java\jdk1.6.0_23\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
java.home=C:\Program Files\Java\jdk1.6.0_23\jre
java.io.tmpdir=C:\DOCUME~1\spiros\LOCALS~1\Temp\
java.library.path=C:\Oracle\Middleware\jdeveloper\jdev\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;E:\BIToolsHome_1\bin;E:\BIToolsHome_1\jlib;E:\BIToolsHome_1\jre\1.4.2\bin\client;E:\BIToolsHome_1\jre\1.4.2\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\CollabNet\Subversion Client
java.naming.factory.initial=oracle.javatools.jndi.LocalInitialContextFactory
java.naming.factory.url.pkgs=weblogic.jndi.factories:weblogic.corba.j2ee.naming.url
java.protocol.handler.pkgs=oracle.jdevimpl.handler|weblogic.net
java.rmi.server.randomIDs=true
java.runtime.name=Java(TM) SE Runtime Environment
java.runtime.version=1.6.0_23-b05
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.6
java.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
java.version=1.6.0_23
java.vm.info=mixed mode
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Sun Microsystems Inc.
java.vm.version=19.0-b09
javax.rmi.CORBA.PortableRemoteObjectClass=weblogic.iiop.PortableRemoteObjectDelegateImpl
javax.rmi.CORBA.UtilClass=weblogic.iiop.UtilDelegateImpl
javax.xml.parsers.DocumentBuilderFactory=oracle.xml.jaxp.JXDocumentBuilderFactory
jbo.debugoutput=silent
jbo.showdebugwarningbanner=false
jps.authz=NULL
line.separator=\r\n
oracle.adfm.usemds=false
oracle.home=C:\Oracle\Middleware\jdeveloper
oracle.j2ee.extension.status=enabled
oracle.jbo.usemds=false
oracle.jdbc.Trace=true
oracle.jdeveloper.webservice.hidePropertyOverride=false
oracle.jdeveloper.webservice.showAllOwsmPolicyTypes=false
oracle.mds.internal.config.override.emptystore=true
oracle.security.jps.config=/C:/JDeveloper/system11.1.1.4.37.59.23/DefaultDomain/config/fmwconfig/jps-config-jse.xml
oracle.soap.transport.noHTTPClient=true
oracle.translated.locales=de,es,fr,it,ja,ko,pt_BR,zh_CN,zh_TW
oracle.xdkjava.compatibility.version=9.0.4
org.omg.CORBA.ORBClass=weblogic.corba.orb.ORB
org.omg.CORBA.ORBSingletonClass=weblogic.corba.orb.ORB
os.arch=amd64
os.name=Windows XP
os.version=5.2
path.separator=;
reserved_filenames=con,aux,prn,lpt1,lpt2,lpt3,lpt4,lpt5,lpt6,lpt7,lpt8,lpt9,com1,com2,com3,com4,com5,com6,com7,com8,com9,conin$,conout,conout$
sun.arch.data.model=64
sun.awt.disablegrab=true
sun.awt.keepWorkingSetOnMinimize=true
sun.boot.class.path=../lib/lwawt.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_23\jre\lib\modules\jdk.boot.jar;C:\Program Files\Java\jdk1.6.0_23\jre\classes
sun.boot.library.path=C:\Program Files\Java\jdk1.6.0_23\jre\bin
sun.cpu.endian=little
sun.cpu.isalist=amd64
sun.desktop=windows
sun.io.unicode.encoding=UnicodeLittle
sun.java2d.noddraw=true
sun.jnu.encoding=Cp1253
sun.management.compiler=HotSpot 64-Bit Server Compiler
sun.os.patch.level=Service Pack 2
svnkit.sax.useDefault=true
user.country=US
user.dir=C:\Oracle\Middleware\jdeveloper\jdev\bin
user.home=C:\Documents and Settings\spiros
user.language=en
user.name=spiros
user.timezone=Europe/Athens
user.variant=
wasp.location=../../uddi
weblogic.home=C:\Oracle\Middleware\wlserver_10.3\server
weblogic.security.SSL.ignoreHostnameVerification=true
weblogic.security.TrustKeyStore=DemoTrust
windows.shell.font.languages=en

Decompiling ADF classes

Download Java Decompiler.

Extract zip and run included .exe

Open file and select a ADF lib eg. adfm.jar located in my case under C:\Oracle\Middleware\oracle_common\modules\oracle.adf.model_11.1.1




As you can see all packages are there.

Select the class you to see eg. oracle.jbo.server.ViewObjectImpl




Thanx Nick for the tip!


27 May 2011

oracle.jbo.server package through the eyes of JSizer

Running JSizer (a tool that shows java code size.) on oracle.jbo.server would give:

  
  • The Width of a class-node represents the number of fields.
  • The Height of a node represents the number of methods.
  • The Color represents LOC - lines of code.
So, quoting jSizer's author Robert Olofsson:
What you want to do is to look at the graph, find the big dark boxes and possibly refactor them.
Sources:




26 May 2011

Code templates

Intro
Code template is for example sop.
So, if you write: sop and you Press Ctrl+ Enter,
JDeveloper editor will replace it with System.out.println();

You can see the existing Code Templates under
Tools -- Preferences --Code Editor --- Code Templates

You can write sop in the Search box to quickly find sop

Write your own
Let's write a template for a think a developer performs frequently. A template for logger.debug();
Click +
Under Shortcut you add: logd . This is the string you want to type. 
Under Context you choose the "place" this template will be prompted. In this case Java.
Under Code tab the text that will replace the logd when pressing Ctrl+Enter, which will be logger.debug($end$);  The $end$ indicated where the cursor will be placed for you to write after inserting the logger.debug();. So, logger.debug(); will be inserted and you ll start to write after (.