[JBoss AS7 Development] - JBoss AS7: How Do I?
by Anil Saldhana
Anil Saldhana [http://community.jboss.org/people/anil.saldhana] modified the document:
"JBoss AS7: How Do I?"
To view the document, visit: http://community.jboss.org/docs/DOC-17182
--------------------------------------------------------------
h1. Command Line Interface (CLI)
More information on using the CLI is at https://docs.jboss.org/author/display/AS7/Management+Clients https://docs.jboss.org/author/display/AS7/Management+Clients
h2. I want to take a snapshot of what the current domain is
You will have to use the CLI
bin$ ./jboss-admin.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
Connected to domain controller at localhost:9999
[domain@localhost:9999 /] :take-snapshot()
{
"outcome" => "success",
"result" => {
"domain-results" => {"step-1" => {"name" => "/home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.Alpha1-SNAPSHOT/domain/configuration/domain_xml_history/snapshot/20110908-165222603domain.xml"}},
"server-operations" => undefined
}
}
[domain@localhost:9999 /] help
For a list of commands available in the current context execute
help --commands
The resulting listing may depend on the current context. I.g. some of the commands
require an established connection to a controller (standalone or domain).
These commands won't appear in the listing unless the connection has been established.
Here are some of the most common supported commands:
cn (or cd) - change the current node path to the argument;
connect - connect to the specified host and port;
deploy - deploy an application;
help (or h) - print this message;
history - print or disable/enable/clear the history expansion.
ls - list the contents of the node path;
pwn (or pwd) - prints the current working node;
quit (or q) - quit the command line interface;
undeploy - undeploy an application;
version - prints the version and environment information.
add-jms-queue - creates a new JMS queue
remove-jms-queue - removes an existing JMS queue
add-jms-topic - creates a new JMS topic
remove-jms-topic - removes an existing JMS topic
add-jms-cf - creates a new JMS connection factory
remove-jms-cf - removes an existing JMS connection factory
data-source - allows to add new, modify and remove existing data sources
xa-data-source - allows to add new, modify and remove existing XA data sources
For a more detailed description of a specific command, execute the command with '--help' as the argument.
Tab-completion is supported for the commands, just press the tab key to start.
To use tab completion for operations requests start with './' or '/' and press the tab key
which will list the available node types or names.
If the operation request doesn't require a node path then start with ':' and press the tab key
('/:' and './:' are also possible).
Operation requests are expected to follow the format:
[node-type=node-name (, node-type=node-name)*] : operation-name ['('[name=value [, name=value]*]')']
e.g. /subsystem=web/connector=http:read-attribute(name=protocol)
Whitespaces between the separators are insignificant.
If the operation doesn't require arguments then the brackets '()' are optional.
Tab-completion for operation requests supports node types and names, operation names and the property names.
[domain@localhost:9999 /]
h2.
h2. I want to take the latest snapshot of the host.xml for a particular host
Assume your host is called "master"
/bin$ ./jboss-admin.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
Connected to domain controller at localhost:9999
[domain@localhost:9999 /] /host=master:take-snapshot
{
"outcome" => "success",
"result" => {
"domain-results" => {"step-1" => {"name" => "/home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.Alpha1-SNAPSHOT/domain/configuration/host_xml_history/snapshot/20110908-165640215host.xml"}},
"server-operations" => undefined
}
}
[domain@localhost:9999 /]
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-17182]
Create a new document in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 3 months
[JBoss AS7 Development] - JBoss AS7: How Do I?
by Anil Saldhana
Anil Saldhana [http://community.jboss.org/people/anil.saldhana] created the document:
"JBoss AS7: How Do I?"
To view the document, visit: http://community.jboss.org/docs/DOC-17182
--------------------------------------------------------------
h2. I want to take a snapshot of what the current domain is
You will have to use the CLI
bin$ ./jboss-admin.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
Connected to domain controller at localhost:9999
[domain@localhost:9999 /] :take-snapshot()
{
"outcome" => "success",
"result" => {
"domain-results" => {"step-1" => {"name" => "/home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.Alpha1-SNAPSHOT/domain/configuration/domain_xml_history/snapshot/20110908-165222603domain.xml"}},
"server-operations" => undefined
}
}
[domain@localhost:9999 /] help
For a list of commands available in the current context execute
help --commands
The resulting listing may depend on the current context. I.g. some of the commands
require an established connection to a controller (standalone or domain).
These commands won't appear in the listing unless the connection has been established.
Here are some of the most common supported commands:
cn (or cd) - change the current node path to the argument;
connect - connect to the specified host and port;
deploy - deploy an application;
help (or h) - print this message;
history - print or disable/enable/clear the history expansion.
ls - list the contents of the node path;
pwn (or pwd) - prints the current working node;
quit (or q) - quit the command line interface;
undeploy - undeploy an application;
version - prints the version and environment information.
add-jms-queue - creates a new JMS queue
remove-jms-queue - removes an existing JMS queue
add-jms-topic - creates a new JMS topic
remove-jms-topic - removes an existing JMS topic
add-jms-cf - creates a new JMS connection factory
remove-jms-cf - removes an existing JMS connection factory
data-source - allows to add new, modify and remove existing data sources
xa-data-source - allows to add new, modify and remove existing XA data sources
For a more detailed description of a specific command, execute the command with '--help' as the argument.
Tab-completion is supported for the commands, just press the tab key to start.
To use tab completion for operations requests start with './' or '/' and press the tab key
which will list the available node types or names.
If the operation request doesn't require a node path then start with ':' and press the tab key
('/:' and './:' are also possible).
Operation requests are expected to follow the format:
[node-type=node-name (, node-type=node-name)*] : operation-name ['('[name=value [, name=value]*]')']
e.g. /subsystem=web/connector=http:read-attribute(name=protocol)
Whitespaces between the separators are insignificant.
If the operation doesn't require arguments then the brackets '()' are optional.
Tab-completion for operation requests supports node types and names, operation names and the property names.
[domain@localhost:9999 /]
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-17182]
Create a new document in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 3 months
[JBoss AS7 Development] - Hacking on AS7
by Brian Stansberry
Brian Stansberry [http://community.jboss.org/people/brian.stansberry] modified the document:
"Hacking on AS7"
To view the document, visit: http://community.jboss.org/docs/DOC-15596
--------------------------------------------------------------
h4. 1. Create a github account
http://github.com http://github.com
h4. 2. Fork jboss-as into your account
http://github.com/jbossas/jboss-as http://github.com/jbossas/jboss-as
h4. 3. Clone your newly forked copy onto your local workspace
$ git clone git@github.com:[your user]/jboss-as.git
Initialized empty Git repository in /devel/jboss-as/.git/
remote: Counting objects: 2444, done.
remote: Compressing objects: 100% (705/705), done.
remote: Total 2444 (delta 938), reused 2444 (delta 938)
Receiving objects: 100% (2444/2444), 1.71 MiB | 205 KiB/s, done.
Resolving deltas: 100% (938/938), done.
$ cd jboss-as
h4. 4. Add a remote ref to upstream, for pulling future updates
git remote add upstream git://github.com/jbossas/jboss-as.git
h4. 5. Use maven (via build.sh) (make sure you use maven 3)
$ ./build.sh install
.....
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] JBoss Application Server: BOM ..................... SUCCESS [1.834s]
[INFO] JBoss Application Server: Parent Aggregator ....... SUCCESS [0.022s]
[INFO] JBoss Application Server: Domain Core ............. SUCCESS [3.051s]
[INFO] JBoss Application Server: Server Manager .......... SUCCESS [0.204s]
[INFO] JBoss Application Server: Server .................. SUCCESS [0.283s]
[INFO] JBoss Application Server: Domain Controller ....... SUCCESS [0.084s]
[INFO] JBoss Application Server: Process Manager ......... SUCCESS [0.314s]
[INFO] JBoss Application Server: Remoting ................ SUCCESS [0.390s]
[INFO] JBoss Application Server: Build ................... SUCCESS [5.696s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
h4. 6. Pulling later updates from upstream
$ git pull --rebase upstream master
>From git://github.com/jbossas/jboss-as
* branch master -> FETCH_HEAD
Updating 3382570..1fa25df
Fast-forward
{parent => bom}/pom.xml | 70 ++++----------
build/pom.xml | 13 +--
domain/pom.xml | 10 ++
.../src/main/resources/examples/host-example.xml | 2 +-
.../resources/examples/jboss-domain-example.xml | 28 +++---
.../main/resources/schema/jboss-domain-common.xsd | 12 +--
.../main/resources/schema/jboss-domain-host.xsd | 2 +-
domain/src/main/resources/schema/jboss-domain.xsd | 17 ++--
pom.xml | 100 ++++++++++++++++++--
process-manager/pom.xml | 3 +-
10 files changed, 156 insertions(+), 101 deletions(-)
rename {parent => bom}/pom.xml (85%)
(--rebase will automatically move your local commits, if you have any, on top of the latest branch you pull from, you can leave it off if you do not). Please note that --rebase is very important if you do have commits. What happens is that when git pull can't fast forward, it does a merge commit, and a merge commit puts the sucked in changes ON TOP of yours whereas a rebase puts them BELOW yours. In other words a merge commit makes the history a graph, and we prefer a cleaner, easier to follow linear history (hence the rebasing). Further once you do a merge commit it will be difficult to rebase the history before that commit (say you want to combine two commits to one later) as described in point 12.
One way to not forget --rebase the rebase option is you may want to create an alias
$ git config --global alias.up "pull --rebase"
and then just use the new alias instead of pull
$ git up upstream master
One last option, which some prefer, is to avoid using pull altogether, and just use fetch + rebase (this is of course more typing)
h4. 7. Pushing pulled updates (or local commits if you aren't using topic branches) to your private github repo (origin)
$ git push
Counting objects: 192, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (44/44), done.
Writing objects: 100% (100/100), 10.67 KiB, done.
Total 100 (delta 47), reused 100 (delta 47)
To git@github.com:[your user]/jboss-as.git
3382570..1fa25df master -> master
You might need to say -f to force the changes. Read the note on 12 though before you do it.
h4. 8. Discuss your planned changes (if you want feedback)
* On the forums - http://community.jboss.org/en/jbossas/dev/jboss_as7_development http://community.jboss.org/en/jbossas/dev/jboss_as7_development
* On IRC - irc://irc.freenode.org/jboss-as7 or https://webchat.freenode.net/?channels=jboss-as7 (http://webchat.freenode.net/?channels=jboss-as7)
h4. 9. Make sure there is a JIRA somewhere for the enhancement/fix
http://jira.jboss.org http://jira.jboss.org
h4. 10. Create a simple topic branch to isolate that work (just a recommendation)
git checkout -b my_cool_feature
h6. Note: See tips section for how to use a nice git prompt for tracking what branch you are in!
h4. 11. Make the changes and commit one or more times (Don't forget to push)
git commit -m 'JBAS-XXXX Frunubucate the Fromungulator'
git commit -m 'JBAS-YYYY Tripple Performance of Fromungulation'
git push origin my_cool_feature
+Note that git push references the branch you are pushing and defaults to master, *not your working branch*.+
h4. 12. Rebase your branch against the latest master (applies your patches on top of master)
git fetch upstream
git rebase -i upstream/master
# if you have conflicts fix them and rerun rebase
# The -f, forces the push, alters history, see note below
git push -f origin my_cool_feature
The -i triggers an interactive update which also allows you to combine commits, alter commit messages etc. It's a good idea to make the commit log very nice for external consumption. Note that this alters history, which while great for making a clean patch, is unfriendly to anyone who has forked your branch. Therefore you want to make sure that you either work in a branch that you don't share, or if you do share it, tell them you are about to revise the branch history (and thus, they will then need to rebase on top of your branch once you push it out).
h4. 13. Get your changes merged into upstream
1. Make sure your repo is in sync with other unrelated changes in upstream before requesting your changes be merged into upstream by repeating step 12.
2. Email a pull request to mailto:jbossas-pull-requests@lists.jboss.org jbossas-pull-requests(a)lists.jboss.org (if I haven't subscribed the list, do it https://lists.jboss.org/mailman/listinfo/jbossas-pull-requests here) with a link to your repo, a description of the changes, and who reviewed (if any)
3. After review a maintainer will merge your patch, update/resolve issues by request, and reply when complete
4. Don't forget to switch back to master and pull the updates1. git checkout master
git pull upstream master
h4. Appendix A. Adding a new external dependency
1. Edit pom.xml and add a property of the form "version.groupId.artifactId" which contains the Maven version of the dependency. Add your dependency to the <dependencyManagement> section, and use the property for the version. If your new dependency has any transitive dependencies, be sure to <exclude> them (or if possible, update the project so that all its dependencies are of *provided* scope).
2. Add your dependency to any AS modules that require it, but only with group/artifact.
3. Edit build/pom.xml and add your dependency with only group/artifact.
4. Create a directory in build/src/modules corresponding to the *module's* name (which will differ from the Maven group/artifact name; look at other modules to get a feel for the naming scheme), with a version of "main", like this: "build/src/modules/org/jboss/foo/main".
5. Create a module.xml file inside the "main" directory. Use a module.xml from another similar module as a template.
6. Edit build/build.xml and add a <module-def> element. The name listed in the <module-def> element corresponds to the *module* name. The group/artifact listed in the nested maven-resource element(s) refer to the *Maven* group/artifact name.
7. *Important:* Make sure you did not introduce any transitive dependencies by using "mvn dependency:tree". If you did, be sure to add <exclusion>s for each of them to your dependency as described above.
8. *Important:* Do *not* introduce a dependecy on the "*system*" module. If you need access to JDK classes which are not covered by any other dependency, use the "javax.api" module as a dependency.
Please be sure to preserve the alphabetical ordering of all POMs and the build.xml file.
h4. Appendix B. Adding a new AS submodule
1. Create the directory corresponding to the submodule and add it to the root pom.xml file. The convention is to leave off the "jboss-as-" portion, so "jboss-as-remoting" becomes "remoting".
2. Create a POM for your submodule (use another submodule as a template). Make sure all dependencies you specify do *not* include a version. The group ID should be "org.jboss.as", and the artifact ID should begin with "jboss-as-" and there should be a proper <name> for the new module.
3. Add the new submodule to the top section of the <dependencyManagement> of the top-level pom.xml. The version should be set to "${project.version}". This section is sorted alphabetically by artifact name so please preserve that ordering.
4. Add the new submodule to the modules section element of the top-level pom.xml
5. Add your submodule dependency to any AS modules that require it, but only with group/artifact.
6. Edit build/pom.xml and add the new submodule with only group/artifact.
7. Create a directory in build/src/modules corresponding to the submodule, with a version of "main", like this: "build/src/main/resources/modules/org/jboss/as/new-subsystem/main".
8. Create a module.xml file inside the "main" directory. Use a module.xml from another subsystem as a template.
9. Edit build/build.xml and add a <module-def> element for the subsystem. Use the module name and Maven coordinates from steps 6 and 2 respectively. Use another submodule as a template.
Please be sure to preserve the alphabetical ordering of all POMs and the build.xml file.
h4. Appendix C. Profiling with JProfiler
Performance tuning is an important part of AS7 development. In order to use JProfiler on a standalone AS 7 instance, first you need to add the following to your standalone.conf file:
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=com.jprofiler -agentlib:jprofilerti -Xbootclasspath/a:/path/to/jprofiler/bin/agent.jar"
The "jboss.modules.system.pkgs" property tells JBoss Modules to allow the "com.profiler" classes to be found from any class loader, which is essential to allow the JProfiler agent to run.
It's easiest to then just set up your JProfiler session as "Remote", and start the server and the profiler in any order. That's it!
h4. Appendix D. Importing into Eclipse
The directory "ide-configs/eclipse" contains both formatter and code templates. Use these to pass the CheckStyle enforcer during the build if coding from Eclipse.
h4. Tips & Tricks!
h4. Creating a Git status prompt in your terminal
This makes it easy to not forget what branch you are working in and quickly tell if you have changes. The following will adjust the PS1 on unix (or cygwin on Windows). Note that it assumes a compiled version of git, which is also the case for the OSX packages. If you are using the bundled rpm version, change the completion path to "/etc/bash_completion.d/git"
GIT_COMPLETION_PATH="/usr/local/git/contrib/completion/git-completion.bash"
if [ -f "$GIT_COMPLETION_PATH" ]; then
GIT_PS1_SHOWDIRTYSTATE=true
. "$GIT_COMPLETION_PATH"
ADD_PS1='$(__git_ps1)'
fi
if [[ ${EUID} == 0 ]] ; then
PS1="\[\033[01;31m\]\h\[\033[01;34m\] \w\[\033[33m\]$ADD_PS1\[\033[34m\] \$\[\033[00m\] "
else
PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[33m\]$ADD_PS1\[\033[34m\] \$\[\033[00m\] "
fi
h4. Partial Builds
It's common when working on a particular module to need to build that module and the overall AS distribution numerous times. Doing a full AS build can be overly time consuming in this situation. The maven rf and pl options can be helpful in limiting the build to a subset of all the AS modules. See http://java.dzone.com/articles/5-maven-tips this quick introduction to both of these maven switches.
A fairly common thing is to work on a single subsystem, so you need that subsystem built, and to also have the full AS dist rebuilt so the new version of the subsystem's jar ends up in build/target. To do this, for example with the ejb3 subsystem, you would:
mvn install -pl jboss-as-ejb3,jboss-as-build
h4.
h4. IDE Integration
h5. Eclipse
Follow the steps mentioned here http://community.jboss.org/docs/DOC-16718 http://community.jboss.org/wiki/HackingAS7usingEclipse
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15596]
Create a new document in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 3 months
[JBoss AOP Development] - Pointcut expression with annotation (JBoss 4.3 vs JBoss 5.1)
by Rafael Chies
Rafael Chies [http://community.jboss.org/people/rafachies] created the discussion
"Pointcut expression with annotation (JBoss 4.3 vs JBoss 5.1)"
To view the discussion, visit: http://community.jboss.org/message/625543#625543
--------------------------------------------------------------
Hi folks,
I went through this:
I have an application that uses JBoss AOP pointcut expression like this: pointcut="all((a)org.chies.chiesaop.ChiesAnnotation)"
This used to work fine on JBoss AS 4.3 (using jboss aop 1.5.5). When I started using JBoss 5.1 (with jboss aop 2.1.6) the pointcut stopped working at runtime. I mean, there is no problem on startup and nothing about exceptions, but the pointcut expression didn't match anymore.
Doing some tests, I discovered that the problem is on my custom annotation (ChiesAnnotation). I just put the Retention RUNTIME and the pointcut started working normally.
I know how the Retention works on annotations, and also I agree that RUNTIME must be used in this case. However, i would like to know why this works fine on JBoss 4.3 (AOP 1.5.5) and not on JBoss 5.1. What is the implementation feature of JBoss 5.1/AOP 2.1.6 that makes this use case stop working ?
Thanks in advice for the attention !
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625543#625543]
Start a new discussion in JBoss AOP Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months
Re: [jboss-dev-forums] [JBoss AS7 Development] - Detyped Description of the AS 7 Management Model
by frankie007
frankie007 [http://community.jboss.org/people/frankie007] commented on the document
"Detyped Description of the AS 7 Management Model"
To view all comments on this document, visit: http://community.jboss.org/docs/DOC-16317#comment-7581
--------------------------------------------------
Thanks for the reply Brian.
Maybe it would be usefull to add the following to the documentation. I couldn't find this anyware. It might help others.
If you want to read the operation description of a child resource you have to navigate to the child node by using the key-value pair "child name" , "*"
E.g. if you want to read the operation description of the 'add' operation on jms-topics, you'll need to build the address like this.
ModelNode address = op.get("address");
address.add("subsystem", "messaging");
address.add("jms-topic", "*");
...
--------------------------------------------------
14 years, 3 months
Re: [jboss-dev-forums] [JBoss AS7 Development] - Multiple instances of JBoss AS7 on the same machine
by Brian Stansberry
Brian Stansberry [http://community.jboss.org/people/brian.stansberry] commented on the document
"Multiple instances of JBoss AS7 on the same machine"
To view all comments on this document, visit: http://community.jboss.org/docs/DOC-16705#comment-7580
--------------------------------------------------
Ian,
You don't have to repeat everything, but it's not as smooth as it should be.
>From the root of your AS7 dist
1)
cp -r standalone instance1
cp -r standalone instance2
That doesn't result in a lot of extraneous copied files.
2) Edit instance1/configuration/standalone.xml and/or instance2/configuration/standalone/xml as desired; e.g. as described on this page for avoiding port conflicts
3) To launch instance1
./bin/standalone.sh -Djboss.server.base.dir=instance1
4) To launch instance2
./bin/standalone.sh -Djboss.server.base.dir=instance2
Things that aren't as smooth as they should be
a) The resolution of jboss.server.base.dir isn't very smart. For example, to do the common thing and launch the script from within the bin dir you have to either use an absolute path to instance1/2 or do something kludgey like:
./standalone.sh -Djboss.server.base.dir=../instance2
2) The launch script directly references the standalone/configuration/logging.properties and standalone/log/boot.log files. So, if those files aren't present the server doesn't boot properly, and both instance1 and instance2 will use the standalone/log/boot.log as their boot log file (where logging goes until the boot process starts the logging subsystem.)
I've opened https://issues.jboss.org/browse/AS7-1752 https://issues.jboss.org/browse/AS7-1752 for these 2 points.
--------------------------------------------------
14 years, 3 months