run multiple instances of JBoss 4 in a one single machine? - jboss

I need to run multiple instances of jboss in a single machine (more than 5).
I copied the entire jboss folder several times and used the -b parameter on startup.
Under jboss/server, I have the following:
default
instance1
instance2
The first instance of jboss works fine (when I run ./run.sh -c instance1 -b 1.1.1.1)
but when I start the second one (when I run ./run.sh -c instance2 -b 1.1.1.2), it hangs on
[Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml

Related

Docker dotnet run port not mapping, windows 10 host, linux container

I'm following a https://app.pluralsight.com/library/courses/docker-web-development/table-of-contents which uses the older microsoft/aspnetcore-build image but I'm running core 2.1 so I'm using microsoft/dotnet:2.1-sdk instead.
The command I'm running is:
docker run -it -p 8080:5001 -v ${pwd}:/app -w "/app"
microsoft/dotnet:2.1-sdk
and then once inside the TTY I do a dotnet run which gives me the following output:
Using launch settings from /app/Properties/launchSettings.json...
info:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using '/root/.aspnet/DataProtection-Keys'
as key repository; keys will not be encrypted at rest.
info:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
Creating key {5445e854-c1d9-4261-82f4-0fc3a7543e0a} with creation date
2018-12-14 10:41:13Z, activation date 2018-12-14 10:41:13Z, and
expiration date 2019-03-14 10:41:13Z.
warn:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key
{5445e854-c1d9-4261-82f4-0fc3a7543e0a} may be persisted to storage in
unencrypted form.
info:
Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
Writing data to file
'/root/.aspnet/DataProtection-Keys/key-5445e854-c1d9-4261-82f4-0fc3a7543e0a.xml'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv6 loopback
interface: 'Cannot assign requested address'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http://localhost:5000 on the IPv6 loopback
interface: 'Cannot assign requested address'.
Hosting environment: Development
Content root path: /app
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Then, when I open browser on my host and navigate to http://localhost:8080 I get a "This page isn't working" "localhost didn't send any data" " ERR_EMPTY_RESPONSE"
I've tried a couple different port combinations too with the same result.
Can anyone spot where I went wrong? Or have any ideas / suggestions?
Not sure if this question still relevant for you, but I also encountered this issue and left my solution here for others. I used PowerShell with the next docker command (almost the same as your command, just used internal port 90 instead of 5000 and used --rm switch which will automatically remove the container when it exits):
docker run --rm -it -p 8080:90 -v ${pwd}:/app -w "/app" microsoft/dotnet /bin/bash
And after that, I got the interactive bash shell, and when typing dotnet run I got the same output as you and cannot reach my site in the container via localhost:8080.
I resolved it by using UseUrls method or --urls command-line argument. They (UseUrls method or --urls command-line argument) indicates the IP addresses or host addresses with ports and protocols that the server should listen on for requests. Below descriptions of solutions which worked for me:
Edit CreateWebHostBuildermethod in Program.cs like below:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUrls("http://+:90") //for your case you should use 5000 instead of 90
.UseStartup<Startup>();
You can specify several ports if needed using the next syntax .UseUrls("http://+:90;http://+:5000")
With this approach, you just typed dotnet run in bash shell and then your container will be reachable with localhost:8080.
But with the previous approach you alter the default behavior of your source code, which you can forget and then maybe should debug and fix in the future. So I prefer 2nd approach without changing the source code. After typing docker command and getting an interactive bash shell instead of just dotnet run type it with --urls argument like below (in your case use port 5000 instead of 90):
dotnet run --urls="http://+:90"
In the documentation there is also a 3rd approach where you can use ASPNETCORE_URLS environment variable, but this approach didn't work for me. I used the next command (with -e switch):
docker run --rm -it -p 8080:90 -v ${pwd}:/app -w "/app" -e "ASPNETCORE_URLS=http://+:90" microsoft/dotnet /bin/bash
If you type printenv in bash you will see that ASPNETCORE_URLS environment variable was passed to the container, but for some reason dotnet run is ignoring it.

Is there an easy way to create a new Wildfly server instance

Is there an easy way to create a new Wildfly server instance.
In JBoss AS5 all you had to do is create a copy of default or all and start jboss with:
run.sh -c [New instance name]
There is no such option available in standalone.sh
The change which started with the JBoss AS7 and continues in WildFly is, the whole server configuration is hold in a single file. There are prepared some 4 default configurations (or profiles):
default (standalone.xml - used by default - without clustering and messaging)
HA (standalone-ha.xml - supports clustering)
Full (standalone-full.xml - supports messaging)
Full HA (standalone-full-ha.xml - supports both messaging and clustering)
To use the custom profile start the server with using -c switch
./standalone.sh -c standalone-full-ha.xml
If you only need to change the server configuration, you can edit the profile XML files directly, use CLI tool (jboss-cli.sh/bat) or management console.
If you want to do bigger changes (e.g. different applications in standalone/deployments directory), you can copy the whole standalone directory and edit each copy as necessary. I use following way for starting two clustered server:
cd $JBOSS_HOME
cp -r standalone standalone1; cp -r standalone standalone2
# edit the configs here if necessary ...
bin/standalone.sh -c standalone-ha.xml \
-Djboss.server.base.dir=`pwd`/standalone1 \
-Djboss.node.name=host1 &
bin/standalone.sh -c standalone-ha.xml \
-Djboss.server.base.dir=`pwd`/standalone2 \
-Djboss.node.name=host2 \
-Djboss.socket.binding.port-offset=200 &
This example creates 2 copies from a clean standalone configuration and starts a server for each copy. The second server have port offset 200 (e.g. web running on port 8280).
For standalone instances you can use the --server-config or -c option to specify a different configuration.
For example, to put JBoss in "clustered" mode
$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml
Other alternative is used a domain mode configuration, in this mode you can define different profiles, for an different servers instances.
WildFly - Operating modes
WildFly - Domain Setup

How can I specify run.bat options when running JBoss as a service?

In Windows Server 2008 R2, I can run JBoss successfully from the command line specifying options suchs as "-b 0.0.0.0". However, I want to run JBoss as a Windows service. I understand that I run /Path/To/JBoss/bin/service.bat install from the command line and this basically runs the start.bat whenever the computer starts. How do I configure the service to start with the command line arguments of -b 0.0.0.0?
Possible duplicate of How can I bind a JBoss AS 6 running as service to 0.0.0.0?
You could just hardcode -b 0.0.0.0 inside run.bat.
BTW, consider using Java Service Wrapper or YAJSW as RunJBossAsAServiceOnWindows wiki suggests. It allows to specify various service params in config.

Jboss 6 for jee5

I wanna use jboss 6 and jboss 5 on the same machine (of course, neither is online at same time ). Why? Because, I don't know jee5 apps can be run on jboss 6. Now, I use jee5 and jboss 5. And I want to migrate jee6 fully. Because of reason of compatibility, I have to use and run jee5 at the same time.
I have been located jboss6 and jboss5 on C: and set JBOSS_HOME environment variable for c:\jboss5. When I want to run jboss 6 with command c:\jboss6\bin\run -c all , jboss5 is run. Because of environment variable?
How can I run either? And what about environment variable?
Thanks.
jboss5 is run because of the environment variable as you guessed.
Just reset the environment variable to c:\jboss6 and you should be able to run jboss6.
If you want to run them both at the same time on the same machine, the easiest way to accomplish this is to make your host multi-homed (multiple ip addresses on the same machine) and have a hostname resolve to each address. You need to do something like this to prevent port conflicts (each jboss will use similar ports on the same ip address, which will cause the 2nd server to not startup).
So if this was on a home network, you could have an ip address of 192.168.1.100 for jboss5 and 192.168.1.101 for jboss6.
Now to start jboss5, set the environment variable and:
c:\jboss5\bin\run -c all -b jboss5
and to start jboss6, set the environment variable and:
c:\jboss6\bin\run -c all -b jboss6

jboss-5.1.0.GA auto start on boot

I was given the task of installing jboss-5.1.0.GA on a remote ubuntu 10.4 Lts server. With all those resources out there I was able to run jboss successfully but my problem was that I wasn't able to get auto start on boot work so that jboss would be running on the server.
I followed a couple of tutorials that said me create a separate user called jboss and to copy the jboss_init_Redhat.sh to the /etc/init.d/jboss (jboss home, java path ,jboss user and the binding to 0.0.0.0 is all set) and used /etc/init.d/jboss start
but I can't get to see the Jboss page at the Ip on a browser.,
If i do a ./run.sh -b 0.0.0.0 ==> the server is up ...
Can some body shed some light on this issue????
If you want to run JBoss AS on given interface using jboss_init_redhat.sh script look at these line:
#if JBOSS_HOST specified, use -b to bind jboss services to that address
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}
You should just define new variable before these line:
JBOSS_HOST="0.0.0.0"
You should also check shutdown command (especially when you run your server on some other address then 127.0.0.1 or 0.0.0.0), it should know how to find your server:
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown -s jnp://${JBOSS_HOST}:1099"}