Bug 784535

Summary: jboss-as fails to start when environment-modules installed and MODULEPATH set
Product: [Retired] oVirt Reporter: Juan Hernández <juan.hernandez>
Component: ovirt-engine-coreAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, alevy, iheim, ykaul
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-14 12:22:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Juan Hernández 2012-01-25 10:09:47 UTC
Description of problem:
When the "environment-modules" package is installed it adds the "MODULEPATH" environment variable, also used by JBoss 7, as a result the application server can't locate its modules.

Version-Release number of selected component (if applicable):
ovirt-engine-jbossas-1.2-2.fc16.x86_64.rpm

How reproducible:
Always.

Steps to Reproduce:
1. Install the "environment-modules" package.
2. Log out and log in again.
3. Try to start the application server.
  
Actual results:
# /usr/share/jboss-as/bin/standalone.sh -c standalone.xml
=========================================================================
 
JBoss Bootstrap Environment
 
JBOSS_HOME: /usr/share/jboss-as
 
JAVA: java
 
JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
 
=========================================================================
 
Exception in thread "main" org.jboss.modules.ModuleNotFoundException: Module org.jboss.logmanager:main is not found in local module loader @4be03c55 (roots: /usr/share/Modules/modulefiles,/etc/modulefiles)
at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:265)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:212)
at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:194)
at org.jboss.modules.Main.main(Main.java:264)

Expected results:
The application server should start correctly.


Additional info:
Adding "unset MODULEPATH" at the beginning of "/etc/init.d/jboss-as" solves the problem.

Comment 1 Alon Levy 2012-01-25 10:22:06 UTC
The suggestion in "Additional info:" doesn't work, because standalone is run via daemon / su. What does work is adding it to the list of parameters to the two invocation options, i.e. before standalone:

x86_64 garlic:~ alon$ cat /etc/init.d/jboss-as | grep MODULE
    daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE MODULEPATH= $JBOSS_SCRIPT -c $JBOSS_CONFIG 2>&1 > $JBOSS_CONSOLE_LOG &
    su - $JBOSS_USER -c "LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=$JBOSS_PIDFILE MODULEPATH= $JBOSS_SCRIPT -c $JBOSS_CONFIG" 2>&1 > $JBOSS_CONSOLE_LOG &

Comment 2 Juan Hernández 2012-06-14 10:22:35 UTC
This will be solved when we release 3.1, as it the script that starts the service doesn't use the MODULEPATH environment variable, and in addition it is started by systemctl which cleans the environment before starting the service.