[jBPM Development] - [jbpm5.1]Can get the current nodeId, correctly??
by leo li
leo li [http://community.jboss.org/people/leo87601] created the discussion
"[jbpm5.1]Can get the current nodeId,correctly??"
To view the discussion, visit: http://community.jboss.org/message/638682#638682
--------------------------------------------------------------
Dear all,
We want to get the current node name after completed a task.But it is not working correctly some time.
we found the error happen here.
long nodeId = wfInstance.getNodeInstances().iterator().next().getNodeId();
BTW, Before we setted the persistence, this issue does not happen.
The data seem had problem too, we found that the PROCESSINSTANCEINFO's lastmodificationdate(12:44:36) is the same as the pending node's log time, but the workflow had been run into Qualified at 12:44:43.
We can not see the processinstancebytearray, so not sure the processintanceinfo had been updated correctly or not?
select * from nodeinstancelog where processinstanceid =134 order by id desc;
|| ID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || TYPE (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || NODEINSTANCEID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || NODEID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || PROCESSINSTANCEID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || PROCESSID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || LOG_DATE (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || NODENAME (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) ||
| 683 | 0 | 5 | 9 | 134 | LeadProcess | 2011-11-28 12:44:43.048 | Qualified |
| 682 | 1 | 4 | 8 | 134 | LeadProcess | 2011-11-28 12:44:43.048 | Gateway |
| 681 | 0 | 4 | 8 | 134 | LeadProcess | 2011-11-28 12:44:43.048 | Gateway |
| 680 | 1 | 3 | 5 | 134 | LeadProcess | 2011-11-28 12:44:43.033 | Pending |
| 679 | 0 | 3 | 5 | 134 | LeadProcess | 2011-11-28 12:44:36.36 | Pending |
SELECT * FROM PROCESSINSTANCEINFO where iNSTANCEID =134;
|| INSTANCEID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || LASTMODIFICATIONDATE (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || LASTREADDATE (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || PROCESSID (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || PROCESSINSTANCEBYTEARRAY (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || STARTDATE (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || STATE (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) || OPTLOCK (http://localhost:8082/query.do?jsessionid=eba938cf1dbf38d4a410125bbe377788#) ||
| 134 | 2011-11-28 12:44:36.376 | 2011-11-28 12:57:39.437 | LeadProcess | aced00057765000852756c65466c6f770000000000000086000b4c65616450726f6365737300000001000000000000000400000000001200000000000000030000000000000005001b00000000000000fd00000000000100000000000000020006616374696f6e0000000074000750656e64696e67770c0006757365724964000000007400056b72697376 |
Environment : Jboss 5.1, h2 database, windows 2003. we are using the default setting of jbpm-5.1.0.Final-installer-full.zip
Here is our code of complete task.
public ProcessInstanceBO completeUserTask(long instanceId, String toState){
ProcessInstance instance = ksession.getProcessInstance(instanceId); // init process by instanceid
WorkflowProcessInstance wfInstance = ((WorkflowProcessInstance)instance);
// get currently Node instances
Iterator<NodeInstance> iterator = wfInstance.getNodeInstances().iterator();
NodeInstance nodeInstance = iterator.next();
// compelte workitem.
final long workItemId = workItemNodeInstance.getWorkItemId();
final Map<String, Object> results = new HashMap<String, Object>();
results.put(this.ACTION, toState);
ksession.getWorkItemManager().completeWorkItem(workItemId, results);
ksession.getWorkItemManager().abortWorkItem(workItemId);
// retrieve the process instance again.
instance = ksession.getProcessInstance(instanceId);
WorkflowProcessInstance wfInstance = (WorkflowProcessInstance) instance;
//retrieve the current node again. we expect that , here is the next step's nodeid, but it doesn't work correctly every time. some time it still in the last stage.
long nodeId = wfInstance.getNodeInstances().iterator().next().getNodeId();
logger.debug("Process current node id: " + nodeId );
WorkflowProcess wfProcess = (WorkflowProcess) readKnowledgeBase().getProcess(wfInstance.getProcessId());
//We cannot get the correct Node name because.
Node node = wfProcess.getNode(nodeId);
....
}
We are confusing on this issue, please help. Thanks a lots.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/638682#638682]
Start a new discussion in jBPM Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years
[JBoss AS 7 Development] - Issue with Advanced IO
by ronorato
ronorato [http://community.jboss.org/people/ronorato] created the discussion
"Issue with Advanced IO"
To view the discussion, visit: http://community.jboss.org/message/642745#642745
--------------------------------------------------------------
I have have some problems with getting HttpEventServlet to respond to the BEGIN event from my web client. Using WireShark I am seeing the handshake request begin sent from the web client to the web server. Using my tracing I am seeing the BEGIN event being called, but I am not seeing the web server respond back to the web client. This is causing the web client to timeout and retry the handshake.
Here is the event method from my servlet that implements HttpEventServlet:
public void event(HttpEvent event)
throws IOException, ServletException
{
log.info("event() entered");
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
switch (event.getType()) {
case BEGIN:
log.info("Begin for session: " + request.getSession(true).getId());
StringBuilder toLog = new StringBuilder();
Enumeration params = request.getParameterNames();
// Debug code
while(params.hasMoreElements()) {
String current = (String) params.nextElement();
toLog.append(current + "=" + request.getParameter(current));
if(params.hasMoreElements()) {
toLog.append(", ");
}
}
log.warn("BEGIN Parameters: " + toLog.toString());
messageSender.addConnection(response);
break;
.......
the debug code produces the following output:
13:43:09,688 INFO event() entered
13:43:09,688 INFO Begin for session: PJG9NHvS1qi t-vJE7uDDJisF
13:43:09,688 WARN BEGIN Parameters: message=[{"version":"1.0","minimumVersion":"0.9","channel":"/meta/handshake","id":"6","supportedConnectionTypes":["long-polling","long-polling-json-encoded","callback-polling"]}]
Any help would be greatly appreciated.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/642745#642745]
Start a new discussion in JBoss AS 7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years
[JBoss ESB Development] - Problème Jboss Webservice esb jbr-provider
by lo Ey
lo Ey [http://community.jboss.org/people/loo] created the discussion
"Problème Jboss Webservice esb jbr-provider"
To view the discussion, visit: http://community.jboss.org/message/642889#642889
--------------------------------------------------------------
Bonjour,
je débute sur jboss et je souhaiterais créer un esb de type webservice.
J'ai créé un projet de type esb ainsi qu'un provider de type JBR-provider pour mon fichier jboss-esb.xml que voici :
<?xml version="1.0"?>
<jbossesb parameterReloadSecs="5"
xmlns=" http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml... http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..."
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml... http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml... http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schem... http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schem...">
<providers>
<jbr-provider name="WSModeleProd" protocol="http" host="x.x.x.x">
<jbr-bus busid="Http-WSModeleProd-1" port="8081" />
</jbr-provider>
</providers>
<services>
<service category="ServiceCategoryWSModeleProd" name="ServiceWSModeleProd"
description="WS Frontend speaks natively to the ESB" invmScope="GLOBAL">
<listeners>
<jbr-listener name="WSModeleProd" busidref="Http-WSModeleProd-1"
is-gateway="true" />
</listeners>
<actions mep="RequestResponse">
<action name="ActionWSModeleProd" class="chu.esb.actions.SPrGatewayWSModeleProdAction"
process="WSModeleAction">
</action>
</actions>
</service>
</services>
</jbossesb>
J'ai créé la classe chu.esb.actions.SPrGatewayWSModeleProdAction que voici :
package chu.esb.actions;
....
@WebService(name = "SPrGatewayWSModeleProdAction", targetNamespace = " http://10.10.1.83:8081/SPrGatewayWSModeleProdAction http://10.10.1.83:8081/SPrGatewayWSModeleProdAction")
public class SPrGatewayWSModeleProdAction extends AbstractActionPipelineProcessor implements ISPrGatewayWSModeleProdAction {
protected ConfigTree _config;
public SPrGatewayWSModeleProdAction(ConfigTree config) {
_config = config;
}
@WebMethod
public Message WSModeleAction(@WebParam(name = "message") Message message) {
System.out.println("WSModeleAction - message=" + message.getBody());
return message;
}
public Message process(Message arg0) throws ActionProcessingException {
// TODO Auto-generated method stub
return null;
}
}
Lors du deploiement tout se passe bien, mais lorsque je tape l'url de type : x.x.x.x:8081/SPrGatewayWSModeleProdAction, j'obtiens l'erreur suivante :
org.jboss.soa.esb.couriers.FaultMessageException: java.lang.IllegalArgumentException: null 'value' arg in method call.
at org.jboss.soa.esb.listeners.message.errors.Factory.createExceptionFromFault(Factory.java:50)
at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:207)
at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.attemptDelivery(ServiceInvoker.java:675)
at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.access$200(ServiceInvoker.java:569)
at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:359)
at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:219)
at org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter.deliverSyncWithoutDecomposing(UncomposedMessageDeliveryAdapter.java:107)
at org.jboss.soa.esb.listeners.message.UncomposedMessageDeliveryAdapter.deliverSync(UncomposedMessageDeliveryAdapter.java:86)
at org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener.invoke(JBossRemotingGatewayListener.java:375)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:930)
at org.jboss.remoting.transport.coyote.CoyoteInvoker.service(CoyoteInvoker.java:392)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.IllegalArgumentException: null 'value' arg in method call.
at org.jboss.internal.soa.esb.assertion.AssertArgument.isNotNull(AssertArgument.java:43)
at org.jboss.internal.soa.esb.message.format.xml.BodyImpl.add(BodyImpl.java:83)
at chu.esb.esb_communs.ESB_Communs.setParameters(ESB_Communs.java:2586)
at chu.esb.actions.SPrGatewayWSModeleProdAction.WSModeleAction(SPrGatewayWSModeleProdAction.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
at org.jboss.soa.esb.listeners.message.OverriddenActionPipelineProcessor.process(OverriddenActionPipelineProcessor.java:73)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:649)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:603)
at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:433)
at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:550)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
... 1 more
Qu'est ce cela veut dire ?
Lorsque j'appelle mon webservice depuis une application cliente, j'obtiens une erreur (de type org.jboss.remoting.transport.http.WebServerError:) mais le fichier de log affiche tout de meme le bon message.
A t-on besoin de créer un fichier wsdl contenu dans mon projet esb webservice ? un autre fichier ? quels sont les erreurs dans ma configuration de cet esb ?
Merci pour vos lumières.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/642889#642889]
Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years
[JBoss AS 7 Development] - Hacking on AS7
by Jason Greene
Jason Greene [http://community.jboss.org/people/jason.greene] modified the document:
"Hacking on AS7"
To view the document, visit: http://community.jboss.org/docs/DOC-15596
--------------------------------------------------------------
h4.
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. As a precaution, disable merge commits to your master
git config branch.master.mergeoptions --ff-only
h4. 6. 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. 7. 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+. Luckily the option set in step 5 will prevent this from happening.+
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. 8. 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. 9. 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. 10. Make sure there is a JIRA somewhere for the enhancement/fix
http://jira.jboss.org http://jira.jboss.org
h4. 11. 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. 12. 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. 13. 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. 14. 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. Send a github pull request, by clicking the pull request link while in your repo's fork
3. An email will automatically be sent to the pull request list ( http://lists.jboss.org/pipermail/jbossas-pull-requests http://lists.jboss.org/pipermail/jbossas-pull-requests)
4. As part of the review you may see an automated test run comment on your request. Currently this link can only be viewed by Red Hat employees, but if you request a copy we can send you one. In the future we hope to make this public
5. After review a maintainer will merge your patch, update/resolve issues by request, and reply when complete
6. Don't forget to switch back to master and pull the updates1. git checkout master
git pull --ff-only upstream master
7. To update the master branch of your github repository (otherwise you will see a message like 'Your branch is ahead of 'origin/master' by XXX commits.'
if you are use 'git status' on your local master branch.1. git push origin 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/main/resources/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 ejb3,build
h4. IDE Integration
h5. Eclipse
Follow the steps mentioned here http://community.jboss.org/docs/DOC-16718 http://community.jboss.org/wiki/HackingAS7usingEclipse
h3.
h3. Checkstyle Errors
If you need to first verify that your changes pass the checkstyle audit, do this first.
mvn checkstyle:checkstyle
Then you can proceed with the build.
h3.
h3. Adding Subsystem Scripts
If you have a need to add a script to AS7, then definitely it should finally land inside bin/util directory. One important thing that you will need to have as part of your subsystem pom is the following plugin.
<!-- JAR -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.jboss.as.security.vault.VaultTool</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
Substitute your main class.
h3.
h3. How do I ensure that my code does not blow up the testsuite?
First try to run the tests as part of the build before sending a pull request.
$> ./build.sh clean install -DallTests
Sometime there are test failures that are not related to your code changes. Try to discuss this on the mailing list or IRC.
You can get a full run using
$> ./build.sh clean install -DallTests -fae
1. This additional option will allow the build to continue even when there are test failures. Doing this, you can get a stock of all the test failures and figure out how many are related to your code changes.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15596]
Create a new document in JBoss AS 7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years
[PicketBox Development] - JBoss AS7: Security : Running under a Java Security Manager
by Anil Saldhana
Anil Saldhana [http://community.jboss.org/people/anil.saldhana] created the document:
"JBoss AS7: Security : Running under a Java Security Manager"
To view the document, visit: http://community.jboss.org/docs/DOC-17431
--------------------------------------------------------------
This article will discuss ways by which you can run a JBoss AS 7.1 instance under the Java Security Manager.
h2. Prerequisites
A general understanding about configuring security permissions in a Java Security Manager policy file.
h2.
h2. Configuration
We need the following two mandatory system properties
1. -Djava.security.manager
2. -Djava.security.policy
The following is what I have at the end of the standalone.conf file
JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djboss.home.dir=$PWD/.. -Djava.security.policy==$PWD/server.policy -Djava.security.debug=failure"
Note here that I pass in the java.security.policy property a server.policy file that is in the bin directory. (I created the server.policy file)
h2.
h2. server.policy file
// ***************************************
// Trusted core Java code
//***************************************
grant codeBase "file:${java.home}/lib/ext/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${java.home}/lib/*" {
permission java.security.AllPermission;
};
// For java.home pointing to the JDK jre directory
grant codeBase "file:${java.home}/../lib/*" {
permission java.security.AllPermission;
};
//********************************************
// Trusted core JBoss code
//********************************************
grant codeBase "file:${jboss.home.dir}/jboss-modules.jar" {
permission java.security.AllPermission;
};
//********************************************
// Trusted JBoss AS Modules
//********************************************
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/jmx/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/server/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/process-controller/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/controller/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/controller-client/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/connector/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/clustering/infinispan/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/deployment-repository/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/remoting/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/platform-mbean/main/-" {
permission java.security.AllPermission;
};
//********************************************
// Trusted JBoss Modules
//********************************************
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/logmanager/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/logmanager/log4j/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/logging/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/stdio/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/msc/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/threads/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/vfs/main/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/staxmapper/main/-" {
permission java.security.AllPermission;
};
//********************************************
// Trusted 3rd Party Modules
//********************************************
grant codeBase "file:${jboss.home.dir}/modules/org/apache/log4j/main/-" {
permission java.security.AllPermission;
};
h2.
h2. Troubleshooting
h3.
h3. I do not know how to debug the permission problems.
Add extra parameters to the -Djava.security.debug system property as shown below
JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djboss.home.dir=$PWD/.. -Djava.security.policy==$PWD/server.policy -Djava.security.debug=failure,access,policy"
When this happens, you will see errors such as following:
)
12:46:33,368 ERROR [stderr] policy: evaluation (codesource) failed
12:46:33,368 ERROR [stderr] access: domain that failed ProtectionDomain (jar:file:/home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.CR1-SNAPSHOT/modules/org/jboss/as/clustering/infinispan/main/jboss-as-clustering-infinispan-7.1.0.CR1-SNAPSHOT.jar!/ <no signer certificates>)
12:46:33,368 ERROR [stderr] ModuleClassLoader for Module "org.jboss.as.clustering.infinispan:main" from local module loader @3e89c3 (roots: /home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.CR1-SNAPSHOT/modules)
12:46:33,368 ERROR [stderr] <no principals>
12:46:33,368 ERROR [stderr] java.security.Permissions@1f07597 (
12:46:33,368 ERROR [stderr] )
12:46:33,368 ERROR [stderr]
....
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission /home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.CR1-SNAPSHOT/modules/org/apache/commons/pool/main/module.xml read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) [:1.6.0_23]
at java.security.AccessController.checkPermission(AccessController.java:546) [:1.6.0_23]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) [:1.6.0_23]
at java.lang.SecurityManager.checkRead(SecurityManager.java:871) [:1.6.0_23]
at java.io.File.exists(File.java:731) [:1.6.0_23]
at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:121) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:265) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:212) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.Module.addPaths(Module.java:790) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.Module.link(Module.java:997) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.Module.getPaths(Module.java:971) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.Module.getPathsUnchecked(Module.java:982) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.Module.loadModuleClass(Module.java:495) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:485) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:421) [jboss-modules.jar:1.1.0.CR4]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:143) [jboss-modules.jar:1.1.0.CR4]
at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_23]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) [:1.6.0_23]
Here you have a security exception. The key is to look for the protection domain that failed.
In this example, the line that matters is:
access: domain that failed ProtectionDomain (jar:file:/home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.CR1-SNAPSHOT/modules/org/jboss/as/clustering/infinispan/main/jboss-as-clustering-infinispan-7.1.0.CR1-SNAPSHOT.jar!/ <no signer certificates>)
12:46:33,376 ERROR [stderr] ModuleClassLoader for Module "org.jboss.as.clustering.infinispan:main" from local module loader @3e89c3 (roots: /home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.CR1-SNAPSHOT/modules)
12:46:33,376 ERROR [stderr] <no principals>
12:46:33,376 ERROR [stderr] java.security.Permissions@1b8119a (
12:46:33,376 ERROR [stderr] )
So basically we are looking at
jar:file:/home/anil/as7/jboss-as/build/target/jboss-as-7.1.0.CR1-SNAPSHOT/modules/org/jboss/as/clustering/infinispan/main/jboss-as-clustering-infinispan-7.1.0.CR1-SNAPSHOT.jar!/
For this reason, I added the following into the server.policy file:
grant codeBase "file:${jboss.home.dir}/modules/org/jboss/as/clustering/infinispan/main/-" {
permission java.security.AllPermission;
};
This statement block gives all permissions to the jars that exist in the main directory of the module "org.jboss.as.clustering.infinispan"
In an ideal world, you would like to qualify the statement block with permissions such as SocketPermission, RuntimePermission etc rather than a AllPermission.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-17431]
Create a new document in PicketBox Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years