users@glassfish.java.net

Re: Controlling the VM version running the applications

From: Ludovic Champenois <Ludovic.Champenois_at_Sun.COM>
Date: Sat, 09 May 2009 08:37:37 -0700

On 5/9/09 7:28 AM, Per Steffensen wrote:
> Hi
>
> Thanks for trying to help me!
>
> Unfortunally setting JAVA_VM_VERSION=1.6 in config file does not help.
> Grrrr
>
> Any other suggestions.
>
> Regards, Per Steffensen
>
> --------------------------------------------
I am so far clueless... Need help from the launcher team (Kedar, Byron?).

I set in asenv.conf

AS_JAVA="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
JAVA_VM_VERSION="1.6"
I also put
export
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
export JAVA_VM_VERSION="1.6"
in my asadmin script file

My JDK setup is as is:
Current JDK version: 1.6
Installed versions:
total 56
lrwxr-xr-x 1 root wheel 5 Apr 28 10:52 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Sep 28 2007 1.3.1
lrwxr-xr-x 1 root wheel 5 Apr 28 10:53 1.4 -> 1.4.2
lrwxr-xr-x 1 root wheel 3 Apr 29 2008 1.4.1 -> 1.4
drwxr-xr-x 8 root wheel 272 Nov 15 2007 1.4.2
lrwxr-xr-x 1 root wheel 5 Apr 28 10:53 1.5 -> 1.5.0
drwxr-xr-x 8 root wheel 272 Nov 15 2007 1.5.0
lrwxr-xr-x 1 root wheel 5 Apr 28 10:53 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 Apr 29 2008 1.6.0
drwxr-xr-x 8 root wheel 272 Apr 28 10:55 A
lrwxr-xr-x 1 root wheel 1 Apr 28 10:55 Current -> A
lrwxr-xr-x 1 root wheel 3 May 9 08:14 CurrentJDK -> 1.6

I then start Eclipse with a JDK 1.5
It does a ProcessBuilder exec of the asadmin command to start the server.
The output clearly shows the 1.6 VM is used by the launcher, but the
launched process is still using some of the JDK 5 libraries...

So it is definitely a bug in the GlassFish v2.1 launcher that does not
control correctly changes in the JDK on mac when the asadmin command is
launched from another Java VM running on JDK 1.5 (like eclipse).
The way I fixed it for GlassFish v3 is to not spawn the asadmin process
from Eclipse, but but directly running the jvm command which is
described in the asadmin file... For v2.x, the script is much more
complicated and cannot be controlled imo.

See this log file, mixing between JDK 1.6 and the error with JDK 1.5....:
"INFO: CORE5076: Using [Java HotSpot(TM) 64-Bit Server VM, Version
1.5.0_16] from [Apple Inc.]"
Why the GlassFish launcher is still referencing JDK 1.5 vm after all the
correct setup?


------------
May 9, 2009 8:18:14 AM
com.sun.enterprise.admin.servermgmt.launch.ASLauncher buildCommand
INFO:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
-Dcom.sun.aas.instanceRoot=/Applications/NetBeans/glassfish-v2.1/domains/domain1
-DJAVA_VM_VERSION=1.6
-Dcom.sun.aas.ClassPathPrefix=
-Dcom.sun.aas.ClassPathSuffix=
-Dcom.sun.aas.ServerClassPath=
-Dcom.sun.aas.classloader.appserverChainJars.ee=
-Dcom.sun.aas.classloader.appserverChainJars=admin-cli.jar,admin-cli-ee.jar,j2ee-svc.jar
-Dcom.sun.aas.classloader.excludesList=admin-cli.jar,appserv-upgrade.jar,sun-appserv-ant.jar
-Dcom.sun.aas.classloader.optionalOverrideableChain.ee=
-Dcom.sun.aas.classloader.optionalOverrideableChain=webservices-rt.jar,webservices-tools.jar
-Dcom.sun.aas.classloader.serverClassPath.ee=/lib/hadbjdbc4.jar,/Applications/NetBeans/glassfish-v2.1/lib/SUNWjdmk/5.1/lib/jdmkrt.jar,/lib/dbstate.jar,/lib/hadbm.jar,/lib/hadbmgt.jar,/lib/mfwk_instrum_tk.jar
-Dcom.sun.aas.classloader.serverClassPath=/Applications/NetBeans/glassfish-v2.1/lib/install/applications/jmsra/imqjmsra.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/jaxm-api.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/fscontext.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/imqbroker.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/imqjmx.jar,/Applications/NetBeans/glassfish-v2.1/lib/ant/lib/ant.jar,/Applications/NetBeans/glassfish-v2.1/lib/SUNWjdmk/5.1/lib/jdmkrt.jar
-Dcom.sun.aas.classloader.sharedChainJars.ee=appserv-se.jar,appserv-ee.jar,jesmf-plugin.jar,/lib/dbstate.jar,/lib/hadbjdbc4.jar,jgroups-all.jar,/lib/mfwk_instrum_tk.jar
-Dcom.sun.aas.classloader.sharedChainJars=javaee.jar,/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/tools.jar,install/applications/jmsra/imqjmsra.jar,com-sun-commons-launcher.jar,com-sun-commons-logging.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/jaxm-api.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/fscontext.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/imqbroker.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/imqjmx.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/imqxm.jar,webservices-rt.jar,webservices-tools.jar,mail.jar,appserv-jstl.jar,jmxremote_optional.jar,/Applications/NetBeans/glassfish-v2.1/lib/SUNWjdmk/5.1/lib/jdmkrt.jar,activation.jar,appserv-rt.jar,appserv-admin.jar,appserv-cmp.jar,/Applications/NetBeans/glassfish-v2.1/updatecenter/lib/updatecenter.jar,/Applications/NetBeans/glassfish-v2.1/jbi/lib/jbi.jar,/Applications/NetBeans/glassfish-v2.1/imq/lib/imqjmx.jar,/Applications/NetBeans/glassfish-v2.1/lib/ant/lib/ant.jar,dbsc!
 hema.jar
-Dcom.sun.aas.configName=server-config
-Dcom.sun.aas.configRoot=/Applications/NetBeans/glassfish-v2.1/config
-Dcom.sun.aas.defaultLogFile=/Applications/NetBeans/glassfish-v2.1/domains/domain1/logs/server.log
-Dcom.sun.aas.domainName=domain1
-Dcom.sun.aas.installRoot=/Applications/NetBeans/glassfish-v2.1
-Dcom.sun.aas.instanceName=server
-Dcom.sun.aas.processLauncher=SE
-Dcom.sun.aas.promptForIdentity=true
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Dcom.sun.enterprise.overrideablejavaxpackages=javax.help,javax.portlet
-Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-impl.jar
-Dcom.sun.enterprise.taglisteners=jsf-impl.jar
-Dcom.sun.updatecenter.home=/Applications/NetBeans/glassfish-v2.1/updatecenter
-Ddomain.name=domain1
-Djava.endorsed.dirs=/Applications/NetBeans/glassfish-v2.1/lib/endorsed
-Djava.ext.dirs=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/jre/lib/ext:/Applications/NetBeans/glassfish-v2.1/domains/domain1/lib/ext:/Applications/NetBeans/glassfish-v2.1/javadb/lib
-Djava.library.path=/Applications/NetBeans/glassfish-v2.1/lib:/Applications/NetBeans/glassfish-v2.1/lib:/Applications/NetBeans/glassfish-v2.1/lib
-Djava.security.auth.login.config=/Applications/NetBeans/glassfish-v2.1/domains/domain1/config/login.conf
-Djava.security.policy=/Applications/NetBeans/glassfish-v2.1/domains/domain1/config/server.policy
-Djava.util.logging.manager=com.sun.enterprise.server.logging.ServerLogManager
-Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
-Djavax.net.ssl.keyStore=/Applications/NetBeans/glassfish-v2.1/domains/domain1/config/keystore.jks
-Djavax.net.ssl.trustStore=/Applications/NetBeans/glassfish-v2.1/domains/domain1/config/cacerts.jks
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djmx.invoke.getters=true
-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
-client
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=192m
-Xmx512m
-XX:NewRatio=2
-XX:+LogVMOutput
-XX:LogFile=/Applications/NetBeans/glassfish-v2.1/domains/domain1/logs/jvm.log
-cp
/Applications/NetBeans/glassfish-v2.1/lib/jhall.jar:/Applications/NetBeans/glassfish-v2.1/lib/appserv-launch.jar
com.sun.enterprise.server.PELaunch
start

INFO: CORE5076: Using [Java HotSpot(TM) 64-Bit Server VM, Version
1.5.0_16] from [Apple Inc.]
INFO: SEC1002: Security Manager is OFF.
INFO: Using MQ RA for Broker lifecycle control

WARNING: java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in
.class file
     at java.lang.ClassLoader.defineClass1(Native Method)
     at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
     at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
     at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
     at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
     at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:234)
     at java.security.AccessController.doPrivileged(Native Method)
     at
sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:225)
     at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:205)
     at sun.security.jca.ProviderList.getProvider(ProviderList.java:205)
     at
sun.security.jca.ProviderList$ServiceList.tryGet(ProviderList.java:406)
     at
sun.security.jca.ProviderList$ServiceList.access$200(ProviderList.java:348)
     at
sun.security.jca.ProviderList$ServiceList$1.hasNext(ProviderList.java:458)
     at java.security.KeyFactory.nextSpi(KeyFactory.java:244)
     at java.security.KeyFactory.<init>(KeyFactory.java:107)
     at java.security.KeyFactory.getInstance(KeyFactory.java:135)
     at sun.security.x509.X509Key.buildX509Key(X509Key.java:203)
     at sun.security.x509.X509Key.parse(X509Key.java:153)
     at
sun.security.x509.CertificateX509Key.<init>(CertificateX509Key.java:58)
     at sun.security.x509.X509CertInfo.parse(X509CertInfo.java:690)
     at sun.security.x509.X509CertInfo.<init>(X509CertInfo.java:152)
     at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1708)
     at sun.security.x509.X509CertImpl.<init>(X509CertImpl.java:179)
     at
sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:90)
     at
java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:271)
     at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:704)
     at java.security.KeyStore.load(KeyStore.java:1150)
     at
com.sun.enterprise.security.SecuritySupportImpl.loadKS(SecuritySupportImpl.java:152)
     at
com.sun.enterprise.security.SecuritySupportImpl.loadStores(SecuritySupportImpl.java:105)
     at
com.sun.enterprise.security.SecuritySupportImpl.initJKS(SecuritySupportImpl.java:82)
     at
com.sun.enterprise.security.SecuritySupportImpl.<init>(SecuritySupportImpl.java:76)
     at
com.sun.enterprise.security.SecuritySupportImpl.<init>(SecuritySupportImpl.java:71)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
     at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
     at java.lang.Class.newInstance0(Class.java:350)
     at java.lang.Class.newInstance(Class.java:303)
     at
com.sun.enterprise.pluggable.PluggableFeatureFactoryBaseImpl.invoke(PluggableFeatureFactoryBaseImpl.java:84)
     at $Proxy0.getSecuritySupport(Unknown Source)
     at
com.sun.enterprise.security.SecurityUtil.getSecuritySupport(SecurityUtil.java:364)
     at com.sun.enterprise.security.SSLUtils.<clinit>(SSLUtils.java:102)
     at
com.sun.enterprise.security.SecurityLifecycle.onInitialization(SecurityLifecycle.java:101)
     at
com.sun.enterprise.server.ApplicationServer.onInitialization(ApplicationServer.java:262)
     at
com.sun.enterprise.server.ondemand.OnDemandServer.onInitialization(OnDemandServer.java:103)
     at com.sun.enterprise.server.PEMain.run(PEMain.java:399)
     at com.sun.enterprise.server.PEMain.main(PEMain.java:336)