Siva,
This will work, the only problem which the user narrated to me over phone is
that they have to remember to set the variable every time the env var
is modified. In fact, if you follow the thread, we had suggested the same
thing to him.
BTW, the env-classpath-ignored=false fails for him with this error:
[#|2007-09-24T14:45:40.417-0700|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=14;_ThreadName=pool-1-thread-7;_RequestID=53ee0172-5da8-4952-bd72-a07a1c300a60;|WebModule[]PWC1275:
Exception sending context initialized event to listener instance of class
com.sun.faces.config.ConfigureListener
java.lang.NoClassDefFoundError: javax/faces/event/PhaseListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at
com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:144)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
com.sun.enterprise.util.ConnectorClassLoader.loadClass(ConnectorClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1402)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at com.sun.faces.util.Util.loadClass(Util.java:227)
at
com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:824)
at
com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:486)
at
com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:381)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4515)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:5176)
at com.sun.enterprise.web.WebModule.start(WebModule.java:327)
at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at
com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:296)
at
com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:330)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
|#]
- Kedar
Sivakumar Thyagarajan wrote:
> Hi Kedar and Byron:
>
> For this user, could we suggest this workaround as of now?
>
> - create a wrapper shell script that does the following
> 1. start domain
> 2. asadmin set to set a classpath-suffix dynamically based on an
> env.variable[say FOO] - ie something like asadmin set
> ....java-config.classpath-suffix=$FOO if this is a bash script
> 3. restart domain to get your new classpath in FOO added as a suffix to
> domain.
>
> >> if BAR is a System Property -- use it
> >> else if BAR is an env variable -- use it
> >> else use the string as-is
> A minor clarification. By env variable, are we referring to the system
> dependent env variables obtained via System.getenv(...). Have we ever
> provided this capability [apart from classpath] before?
>
> Thanks
> --Siva.
>
> Kedar Mhaswade wrote:
>> Works for me.
>>
>> I just wanted to make it explicit by tagging it as ${ENV}.
>> Also it lets the system properties and environment variables
>> with same name coexist.
>>
>> This is what ANT, Maven do, for example. But I am ok with
>> what you decide. Please create an RFE in either case.
>>
>> - Kedar
>>
>> Byron Nevins wrote:
>>> I am not fond of the third bullet point.
>>> Why not do this:
>>>
>>> if BAR is a System Property -- use it
>>> else if BAR is an env variable -- use it
>>> else use the string as-is
>>>
>>>
>>> Kedar Mhaswade wrote:
>>>> First off:
>>>>
>>>> http://forums.java.net/jive/thread.jspa?messageID=235666
>>>>
>>>> is the discussion thread at the forum.
>>>>
>>>> Byron:
>>>>
>>>> Please respond there.
>>>>
>>>> Another point: I agree that we should change the launcher to take
>>>> the environmental classpath and put that in
>>>> -Dcom.sun.aas.ClassPathSuffix
>>>> instead of appending it to -cp. There is a subtle difference in the
>>>> two.
>>>>
>>>> Byron: I would request you to do three things:
>>>>
>>>> - Respond to the thread.
>>>> - Create an RFE that makes launcher modify
>>>> -Dcom.sun.aas.ClassPathSuffix
>>>> by the environment classpath when env-classpath-ignored=false
>>>> - Create another RFE which enables:
>>>> -DFoo=$ENV{"BAR"} to translate to System.getEnv("BAR");
>>>>
>>>>
>>>> Thanks,
>>>> Kedar
>>>>
>>>> BN wrote:
>>>>> I changed the attribute of interest in domain.xml:
>>>>>
>>>>> env-classpath-ignored="false"
>>>>>
>>>>> The result is that ASLauncher puts the contents of the CLASSPATH
>>>>> env variable like so in the java command line:
>>>>>
>>>>> java -cp <jhall,appserv-launch><your-classpath>
>>>>>
>>>>> I then deployed a web module that is dependent on a jar in
>>>>> CLASSPATH -- and it worked fine.
>>>>>
>>>>> The classpath contents are put *almost* in the front of the runtime
>>>>> classpath. Take a look at the actual runtime classpath below. My
>>>>> classpath stuff shows up starting at the third position (CLASSPATH
>>>>> ==> .;C:\dev\elf\dist\elf.jar;.............)
>>>>>
>>>>> I can change ASLauncher to put the env CLASSPATH contents in, say,
>>>>> classpath-suffix instead of as the "-cp" arg.
>>>>> Thoughts????
>>>>>
>>>>> note that the output below is from calling com.elf.util.Classpath()
>>>>> -- which is in elf.jar which is NOT in the deployed web-module's
>>>>> tree. Thus proving that the web module can "see" the jar that is
>>>>> in the env classpath
>>>>>
>>>>> Kedar, in summary,
>>>>>
>>>>> * The user problem can be solved by simply changing one "true" to
>>>>> "false" in domain.xml and setting env CLASSPATH to their
>>>>> mega-classpath
>>>>> * They have to be careful about classes in their jars "hiding"
>>>>> classes by the same name in GF jars.
>>>>> * They must restart the server if they change anything inside the
>>>>> jars (to "see" the changes if the class is already loaded)
>>>>>
>>>>>
>>>>> -------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> D:/as/lib/jhall.jar
>>>>> D:\as\lib\appserv-launch.jar
>>>>> *.
>>>>> C:\dev\elf\dist\elf.jar
>>>>> c:\dev\derby\lib\derby.jar
>>>>> c:\dev\derby\lib\derbytools.jar
>>>>> C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip
>>>>> *D:/as\lib\javaee.jar
>>>>> c:/jdk/jre/../lib/tools.jar
>>>>> D:/as\lib\install/applications/jmsra/imqjmsra.jar
>>>>> D:/as\lib\com-sun-commons-launcher.jar
>>>>> D:/as\lib\com-sun-commons-logging.jar
>>>>> D:/as/imq/lib/jaxm-api.jar
>>>>> D:/as/imq/lib/fscontext.jar
>>>>> D:/as/imq/lib/imqbroker.jar
>>>>> D:/as/imq/lib/imqjmx.jar
>>>>> D:/as/imq/lib/imqxm.jar
>>>>> D:/as\lib\webservices-rt.jar
>>>>> D:/as\lib\webservices-tools.jar
>>>>> D:/as\lib\mail.jar
>>>>> D:/as\lib\appserv-jstl.jar
>>>>> D:/as\lib\jmxremote_optional.jar
>>>>> D:/as/lib/SUNWjdmk/5.1/lib/jdmkrt.jar
>>>>> D:/as\lib\activation.jar
>>>>> D:/as\lib\appserv-rt.jar
>>>>> D:/as\lib\appserv-admin.jar
>>>>> D:/as\lib\appserv-cmp.jar
>>>>> D:/as/updatecenter/lib/updatecenter.jar
>>>>> D:/as/jbi/lib/jbi.jar
>>>>> D:/as/imq/lib/imqjmx.jar
>>>>> D:/as/lib/ant/lib/ant.jar
>>>>> D:/as\lib\dbschema.jar
>>>>> D:/as\lib\appserv-se.jar
>>>>> D:/as\lib\appserv-ee.jar
>>>>> D:/as\lib\jesmf-plugin.jar
>>>>> D:/as\lib\/lib/dbstate.jar
>>>>> D:/as\lib\/lib/hadbjdbc4.jar
>>>>> D:/as\lib\jgroups-all.jar
>>>>> D:/as/lib/SUNWmfwk/lib/mfwk_instrum_tk.jar
>>>>> D:\as\lib\activation.jar
>>>>> D:\as\lib\admin-cli-ee.jar
>>>>> D:\as\lib\admin-cli.jar
>>>>> D:\as\lib\appserv-admin.jar
>>>>> D:\as\lib\appserv-cmp.jar
>>>>> D:\as\lib\appserv-deployment-client.jar
>>>>> D:\as\lib\appserv-ee.jar
>>>>> D:\as\lib\appserv-ext.jar
>>>>> D:\as\lib\appserv-jstl.jar
>>>>> D:\as\lib\appserv-jwsacc.jar
>>>>> D:\as\lib\appserv-launch.jar
>>>>> D:\as\lib\appserv-rt.jar
>>>>> D:\as\lib\appserv-se.jar
>>>>> D:\as\lib\appserv-tags.jar
>>>>> D:\as\lib\appserv-upgrade.jar
>>>>> D:\as\lib\appserv-ws.jar
>>>>> D:\as\lib\com-sun-commons-launcher.jar
>>>>> D:\as\lib\com-sun-commons-logging.jar
>>>>> D:\as\lib\dbschema.jar
>>>>> D:\as\lib\j2ee-svc.jar
>>>>> D:\as\lib\j2ee.jar
>>>>> D:\as\lib\javaee.jar
>>>>> D:\as\lib\jesmf-plugin.jar
>>>>> D:\as\lib\jhall.jar
>>>>> D:\as\lib\jmac-api.jar
>>>>> D:\as\lib\jmxremote_optional.jar
>>>>> D:\as\lib\jsf-impl.jar
>>>>> D:\as\lib\jxta.jar
>>>>> D:\as\lib\mail.jar
>>>>> D:\as\lib\Pack200Task.jar
>>>>> D:\as\lib\shoal-gms.jar
>>>>> D:\as\lib\sun-appserv-ant.jar
>>>>> D:\as\lib\toplink-essentials-agent.jar
>>>>> D:\as\lib\toplink-essentials.jar
>>>>> D:\as\lib\webservices-rt.jar
>>>>> D:\as\lib\webservices-tools.jar
>>>>> D:/as
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>