JBoss Deployments
Package Download
- For developers
- Product use
- Save the ZIP file
- Cross platform
Package Version
- Current JBoss versions
- 6.3.0.GA - 2014-08-06
- 6.2.0.GA - 2013-12-04
- Current patch versions
- 6.3.3
Supported Configurations
- https://access.redhat.com/articles/111663
- JVM
- Oracle JDK 1.6, 1.7
- Oracle JDK 1.8 for 6.3.3+
Apply Patch
- Apply at runtime
Using the CLI:
$ bin/jboss-cli.sh or bin\jboss-cli.bat
[standalone@localhost:9999 /] patch apply /path/to/downloaded-patch.zip
[standalone@localhost:9999 /] shutdown --restart=true
- Apply before packaging
- Saved installation time!
- See the packaging strategy
How to add a JDBC Driver
- Follow the official document
- /opt/jboss/modules/com/mysql/main/
- module.xml
- mysql-connector-java-commercial-5.1.24-bin.jar
- content of module.xml
- /opt/jboss/modules/com/mysql/main/
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-commercial-5.1.24-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Further Readings
Class-loading in JEE containers
- Hierarchical class loading
- Used by WebLogic, Tomcat
- Modules with explicit dependencies
- Used by JBoss
Deployments in AS7 are also modules, and do not have access to classes that are defined in jars in the application server unless an explicit dependency on those classes is defined.
Packaging Strategy
-
jboss-eap-6.3.3.rpm
- Find a local Linux box
- Unzip the 6.3.0 ZIP
- Apply the 6.3.3 patch
- Zip and upload to Artifactory
- Build rpm
Packaging Strategy
-
jboss-config-1.0.0.rpm
- Configuration templates
- Wrapper commands
Domains
- Isolation of runtime files and installation files
- JBoss default is not good
- runtime files are under installation dir
- Keep runtime files while upgrade installation files
- think how app and OS upgrades
- One installation, multiple profiles
Do not confuse our domains with JBoss managed domains!
Domain Strategy
- follow the Linux standards
- installation files
-
/opt/jboss
-
- runtime files
-
/var/lib/jboss/domains/<DOMAIN_NAME>
-
- installation files
What a domain contains?
- JBoss default
- configuration/
- data/
- deployments/
- lib/
- log/
- tmp/
- Extended
- deployables/
- bundle_registry/
- app specific...
How to start a JBoss instance
- Multiple JBoss instances running on the same host
$ export JAVA_HOME={java_home}
$ export JBOSS_HOME={jboss_home}
$ export JBOSS_BASE_DIR={base_dir}
$ export PRESERVE_JAVA_OPTS=true
$ export JAVA_OPTS="{java_opts}"
$ {jboss_home}/bin/standalone.sh
- Do not worry, we have wrappers
Start the CLI
- Multiple JBoss instances running on the same host
- Every JBoss instance has its admin_port
$ {jboss_home}/bin/jboss-cli.sh
$ [disconnected /] connect :{admin_port}
[standalone@localhost:{admin_port} /]
Local mgmt with CLI does not need a user.
CLI online doc
- Just press TAB, TAB, TAB...
- For interested commands, execute
- 'command_name --help'
- Press TAB at every uncertain place!
- amazing auto-completion even on
- available parameters
- possible values
- amazing auto-completion even on
CLI data model
- Tree based, the nodes are mgmt items
- Item cross-referencing
- Just follow the content of standalone.xml
- everything you see in the xml,
- can be changed with CLI
CLI advanced
- CLI is not only commands
- CLI supports the Create or Update logic
/socket-binding-group=standard-sockets/socket-binding={channel_name}:add(interface=internal,port={listen_port})
This CLI cmd is to add a socket-binding on internal interface and the listen port.
But what if the socket-binding exists?
Check the if-else control flow!
Create or Update
[standalone@localhost:7012 /] /socket-binding-group=standard-sockets/socket-binding=http_1:add(interface=internal,port=7010)
{
"outcome" => "failed",
"failure-description" => "JBAS014803: Duplicate resource [
(\"socket-binding-group\" => \"standard-sockets\"),
(\"socket-binding\" => \"http_1\")
]",
"rolled-back" => true
}
[standalone@localhost:7012 /]
The creation failed because of duplicate resource.
if outcome==success of /socket-binding-group=standard-sockets/socket-binding={channel_name}:read-resource
/socket-binding-group=standard-sockets/socket-binding={channel_name}:write-attribute(name=interface,value=internal)
/socket-binding-group=standard-sockets/socket-binding={channel_name}:write-attribute(name=port,value={listen_port})
else
/socket-binding-group=standard-sockets/socket-binding={channel_name}:add(interface=internal,port={listen_port})
end-if
This is how to do Create or Update.
Create or Update in Java
import org.jboss.as.cli.scriptsupport.CLI.Result;
import org.jboss.dmr.ModelNode;
public class LifecycleHooksDeploy extends LifecycleHooksBase {
@Override
public void execute() {
Result result = cli.cmd("/socket-binding-group=standard-sockets/socket-binding={channel_name}:read-resource");
ModelNode response = result.getResponse();
if ("success".equals(response.get("outcome").asString())) {
// Update the socket-binding here.
} else {
// Add the socket-binding here.
}
}
}
Generic DPs
- DPs are generic. They are not bound to the specific app server (e.g. WebLogic or JBoss).
- Check internal doc
The CLM Backend
- The ~20 lines code is the idea!
public int execute() {
try {
LifecycleHooksBase lifecycleHooksBase = (LifecycleHooksBase) Class.forName(command).newInstance();
lifecycleHooksBase.init(envProps);
try {
lifecycleHooksBase.execute();
} catch (Exception e) {
throw e;
} finally {
lifecycleHooksBase.fini();
}
} catch (Exception e) {
LOG.log(Level.FINE, "Failed to execute JBoss script: " + command, e);
LOG.severe("Failed to execute JBoss script: " + e.getMessage());
return 1;
}
return 0;
}
JBoss Deployments
By aclisp
JBoss Deployments
- 1,545