[JBoss Tools] - How to define multiple jboss 7 server instances based on the standalone folder using eclipse juno and jboss tools 4.0
by Marc Gagnon
Marc Gagnon [https://community.jboss.org/people/MarcGagnonPincourt] created the document:
"How to define multiple jboss 7 server instances based on the standalone folder using eclipse juno and jboss tools 4.0"
To view the document, visit: https://community.jboss.org/docs/DOC-48321
--------------------------------------------------------------
How to define multiple jboss 7 server instances based on the standalone folder using eclipse juno and jboss tools 4.0
I posted this in the general Jboss 7 discussion and then realized I could write it as a document...
Assume you are developping applications on your PC...
You might want to do deploy multiple instances when you need to deploy two applications, each one having different configuration.
Another reason might be that you have two applications that must be running but one of these will be stopped and restarted often while the other one could stay up. If the application which could stay up takes a while to deploy, you definitely prefer to run it in a different server instance.
It is true that we can deploy all applications in the same JBoss instance.
But sometimes, we need to isolate a specific instance with specific configuration files.
In previous versions of the JBoss server, all we had to do was to copy “server/default” to “server/foo” + provide an offset for ports.
In eclipse, the jboss plugin has to be updated.
See: http://www.eclipse.org/forums/index.php?t=msg&goto=489439 http://www.eclipse.org/forums/index.php?t=msg&goto=489439
Or: http://stackoverflow.com/questions/173487/problems-with-shutting-down-jbo... http://stackoverflow.com/questions/173487/problems-with-shutting-down-jbo...
Now, different JBoss version, different problem...
Let’s say we have this situation with application “foo” and “bar”.
Let’s say also that you want to use the basic standalone server configuration.
I will assume you are running eclipse on a windows PC with JBoss-7.1.1.Final.
Assume also that the JBoss home is C:\tools\jboss\jboss-as-7.1.1.Final
Steps to create a server instance for “foo” and control it from eclipse:
1-From the JBoss 7 home directory, copy “standalone” to “foo”.
The goal is to leave “standalone” unmodified and work on a copy.
That way, you keep your golden master available as a base for other server instances you might need.
Of course, you could also keep a copy elsewhere.
I prefer to keep “standalone” untouched and create as many copies as necessary but this is a personal preference.
2-Update foo/standalone.xml to specify the port offset to use right in the standalone.xml configuration file like this:
...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:10000}">
<socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
...
This example uses 10000 so that the resulting HTTP port will be “18080”.
Do not replace with “port-offset="10000"” : that will not work.
Believe me, we tried many combinations and this is the only way to make it work properly.
This seems to be related to the way the JBoss tools plugin works.
If you simply need to start the server from the command line, you’re done:
C:\tools\jboss-as-7.1.1.Final\bin>standalone.bat -Djboss.server.base.dir=../foo
3-In eclipse, go to Window / Preferences / Server / Runtime Environments / Add
Create a runtime environment “JBoss 7.1 Runtime foo”.
The configuration file must be a relative path like this: ..\..\foo\configuration\standalone.xml
The JBoss tools eclipse seems to expect files to be in the default “standalone” folder.
4-In the server view, right click New / Server
Select JBoss Community / JBoss AS 7.1 with the runtime created at step 3.
5-In the server view, double click on the server created at step 4 (or press F3) to open the parameter editor.
In section “Server Ports”, uncheck “Detect from Local Runtime” and specify offset 10000.
Again, we spent some time checking and unchecking these options and the only way to make it work is to override only this field.
Click on the “Deployment” tab to see deployment default settings.
Select “Use a custom deploy folder” and edit the directory fields.
Replace “standalone/deployments” by “foo/deployments”.
Replace “standalone/tmp” by “foo/tmp”.
6-In the server’s parameter editor, go back to the overview, General Information, click “Open launch configuration”.
First, uncheck “Always update arguments related to the runtime”.
The “Program arguments” should look like this:
-mp "C:/tools/jboss/jboss-as-7.1.1.Final/modules" -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -b 0.0.0.0 --server-config=..\..\foo\configuration\standalone.xml
You may use whatever parameters you need, the important thing for our setup is to specify the server configuration file relative to the default “standalone” path.
The VM arguments now:
-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 "-Dorg.jboss.boot.log.file=C:/tools/jboss/jboss-as-7.1.1.Final/foo/log/boot.log" "-Dlogging.configuration=file:/C:/tools/jboss/jboss-as-7.1.1.Final/foo/configuration/logging.properties" "-Djboss.home.dir=C:/tools/jboss/jboss-as-7.1.1.Final" "-Djboss.server.base.dir=C:\tools\jboss\jboss-as-7.1.1.Final\foo"
Again, you may have to adjust these parameters to your needs.
The important thing is to define the following:
Boot log file : -Dorg.jboss.boot.log.file=<path to boot file>
Logging configuration file: -Dlogging.configuration=<URL to log file configuration>
Base directory: -Djboss.server.base.dir=<Instance path>
7-Try to start and stop the server, look at the output to make sure the ports have the expected offset.
Make sure everything works:
Open a browser on “localhost:18080”, then open the administrative console.
In the “Runtime” section, click “Configuration” and “Environment Properties”.
Look at, say, “catalina.home” : it should be “C:\tools\jboss\jboss-as-7.1.1.Final\foo\tmp”.
That’s it!
Like I mentioned, some paths seems to be, somehow, hard coded as “standalone/...”.
This is probably because copying “standalone” like we did with “server/default” is not a use case planned for JBoss 7.
I hope that some JBoss developpers will be able to elaborate on this.
In the mean time, maybe this post could be edited and added to https://docs.jboss.org/author/display/AS71/Starting+JBoss+AS+from+Eclipse... https://docs.jboss.org/author/display/AS71/Starting+JBoss+AS+from+Eclipse...
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-48321]
Create a new document in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 3 months
Strange thread behavior in tomcat/jboss 7
by Leon Rosenberg
Hello,
We have a very weird issue, we are fighting with for about a week already.
We moved from a single machine environment into a more professional setup,
with hardware lb in front and have some issues.
Previous setup was : httpd (ssl offloading) -> jboss -> db
Now loadbalancer (ssl) -> jboss - db.
>From time to time we have a background process that consumes a lot of cpu
and lasts for some minutes. Occasionally the whole app would stop. By stop
I mean that the app is there, but reacting extremely slow. However, we
never have had more than 30% cpu usage (4 code virtual machine). What we do
see, is that we have almost 500 running http connector threads, however,
most of them are in socket.read, socket.write, and not within our code.
I started to take regular thread dumps, and wrote a little utility that
compares them, and I see that we have a lot of http connector threads that
remain in same state over multiple hours:
"http--0.0.0.0-8443-18" daemon prio=10 tid=0x0000000002efb800 nid=0x10b2
runnable [0x00007fca4fcbd000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at
org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:731)
at
org.apache.coyote.http11.InternalInputBuffer.parseRequestLine(InternalInputBuffer.java:368)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:838)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
at java.lang.Thread.run(Thread.java:722)
We have 105 threads in this state over multiple hours (even during normal
app operation).
Question: Could it be that we have connection leakage through keep-alive
connections? Is there are possibility to reduce them?
I understand that jboss have the same apache 11 connector, however all
extended configuration options are removed from the doc:
http://docs.jboss.org/jbossweb/7.0.x/config/http.html
Maybe any other points?
Thanks in advance
Leon
JBoss AS7, Java 1.7, ubuntu 10,
11 years, 3 months
[EJB3] - Invoce an EJB from anoter ear through local interface
by Denis Kostousov
Denis Kostousov [https://community.jboss.org/people/sandello] created the discussion
"Invoce an EJB from anoter ear through local interface"
To view the discussion, visit: https://community.jboss.org/message/796288#796288
--------------------------------------------------------------
I have a two J2EE 6 applications deployed to JBoss AS 7.1.1
An ejb (ejb "A") from the first ear invoke another ejb (ejb "B") from the second ear. But the JBoss server throws a ClassCastException durin lookup:
14:42:26,291 ERROR [com.techinfocom.agiserver.EjbAgiScript] (Asterisk-Java DaemonPool-1-thread-4) ynqpt0q0l20wxl8af6bt:service: : java.lang.ClassCastException: org.asteriskjava.fastagi.AgiScript$$$view82 cannot be cast to org.asteriskjava.fastagi.AgiScript
at com.techinfocom.agiserver.AgiServerUtils.getAgiScript(AgiServerUtils.java:55) [agiserver-common-2.5-SNAPSHOT.jar:2.5-SNAPSHOT-${git.branch}.${git.commit.id.abbrev}]
at com.techinfocom.agiserver.EjbAgiScript.service(EjbAgiScript.java:62) [agiserver-common-2.5-SNAPSHOT.jar:2.5-SNAPSHOT-${git.branch}.${git.commit.id.abbrev}]
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.runScript(AgiConnectionHandler.java:144) [asterisk-java-1.0.0.M3.jar:]
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.run(AgiConnectionHandler.java:116) [asterisk-java-1.0.0.M3.jar:]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_13]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_13]
14:42:26,297 ERROR [org.asteriskjava.fastagi.internal.FastAgiConnectionHandler] (Asterisk-Java DaemonPool-1-thread-4) AgiException running AgiScript com.techinfocom.agiserver.EjbAgiScript on Asterisk-Java DaemonPool-1-thread-4: org.asteriskjava.fastagi.AgiException: org.asteriskjava.fastagi.AgiScript$$$view82 cannot be cast to org.asteriskjava.fastagi.AgiScript
at com.techinfocom.agiserver.EjbAgiScript.service(EjbAgiScript.java:93) [agiserver-common-2.5-SNAPSHOT.jar:2.5-SNAPSHOT-${git.branch}.${git.commit.id.abbrev}]
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.runScript(AgiConnectionHandler.java:144) [asterisk-java-1.0.0.M3.jar:]
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.run(AgiConnectionHandler.java:116) [asterisk-java-1.0.0.M3.jar:]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_13]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_13]
Caused by: java.lang.ClassCastException: org.asteriskjava.fastagi.AgiScript$$$view82 cannot be cast to org.asteriskjava.fastagi.AgiScript
at com.techinfocom.agiserver.AgiServerUtils.getAgiScript(AgiServerUtils.java:55) [agiserver-common-2.5-SNAPSHOT.jar:2.5-SNAPSHOT-${git.branch}.${git.commit.id.abbrev}]
at com.techinfocom.agiserver.EjbAgiScript.service(EjbAgiScript.java:62) [agiserver-common-2.5-SNAPSHOT.jar:2.5-SNAPSHOT-${git.branch}.${git.commit.id.abbrev}]
... 5 more
All my ejbs uses local interfaces.
jndi name of the ejb "B":
java:global/mccc-ear/mccc-ejb/AgiScript2Ussd!org.asteriskjava.fastagi.AgiScript
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/796288#796288]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 3 months