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

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.

Related

Jboss 7 CLI - unable to start interactive mode but gui mode works

The jboss CLI does not seem to start when it was working a few hours back. I was using the CLI to setup JNDI data source and setting up two way SSL for certificate based authentication using the elytron framework.
kerth#ubuntu:~/jboss-eap-7.1/bin$ ./jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /]
kerth#ubuntu:~/jboss-eap-7.1/bin$ echo $?
0
Starting the Jboss CLI with -c or --connect also does not enter the interactive mode. It just exits with a exit code 0 without any error.
kerth#ubuntu:~/jboss-eap-7.1/bin$ ./jboss-cli.sh -c
[standalone#localhost:9990 /]
kerth#ubuntu:~/jboss-eap-7.1/bin$ echo $?
0
The gui mode of the CLI(./jboss-cli.sh --gui) however works. Not sure if i am missing something.
Enabling the Jboss CLI logging does not have any ERROR or WARN logs.
Using a freshly downloaded installation zip of jboss 7.1 and trying to start the CLI also does not work(No environment variables set). A freshly downloaded Jboss 7.2 CLI however works.
Any help is appreciated. Thanks
I am using the default interfaces,
Jboss version - 7.1 update 4,
OS - Ubuntu 18
Either your code pasted is wrong or I think you are missing "connect" before you connect you can't work with the CLI.
Execute the cli with ./jboss-cli.sh
type "connect" withouth the quotation marks.
Execute the desired commands
type "exit"
or alternatively you could do ./jboss-cli.sh -c to connect as well.

GlassFish WAR file deployment to a non-default port

I am attempting to deploy a war file (Oracle's APEX Listener) to a GlassFish 3.1.2.2 server deployed on an RHEL server (I am also seeing the same issues on an Ubuntu server at home).
I used the following command to create the domain:
$GLASSFISH_HOME/bin/asadmin create-domain --portbase 8100 myDomain
[I am also creating multiple domains on the same GlassFish server (one GF instance with multiple domains) using values of 8200, 8300, and 8400 for the portbase value and using different domain names.]
I then start the domain using:
$GLASSFISH_HOME/bin/asadmin start-domain myDomain
Next, I attempt to deploy the APEX.WAR file using:
$GLASSFISH_HOME/bin/asadmin deploy --contextroot apex apex.war
But, I get the following error:
Remote server does not listen for requests on [localhost:4848]. Is the server up? Unable to get remote commands. Closest matching local
command(s):
help Command deploy failed.
I have also used the following commands with the same result:
$GLASSFISH_HOME/bin/asadmin deploy apex.war
$GLASSFISH_HOME/bin/asadmin deploy --target myDomain apex.war
$GLASSFISH_HOME/bin/asadmin deploy --target domain apex.war
And I get the same error each time.
I can deploy the file using the admin gui, but this is for a customer installation and I would really like to do as much as possible from the bash shell script I have created.
I am also installing the Java 1.7.0_45 JDK and modifying the $GLASSFISH_HOME/config/asenv.conf file to include AS_JAVA=
The error is actually correct because the admin port is 8148. But, how do I get GlassFish to "know" to use 8148 instead of 4848.
I have also tried this by:
$GLASSFISH_HOME/bin/asadmin create-domain --adminport 8148
--domainproperties http.ssl.port=8152
but this gets the same results as above.
Thanks for reading this tome of a post and any info on how to fix this would be greatly appreciated!
/dave
You can specify the port to which asadmin should connect as a parameter like this:
asadmin --port 4949 start-domain
If this isn't enough you can even specify the hostname with --host.
Have a look at the official documentation to see all possible parameters.
i get the same error ,you should do like this:
$GLASSFISH_HOME/bin/asadmin --port 8148 deploy apex.war
and input username and password the default user is admin and password is adminadmin
good luck for you!

Can't stop or restart JBoss AS 4.2.3 as a service in Fedora

i have a little issue with a Jboss AS 4.2.3 . I'm developing an application in Seam so i'm using Jboss as server. In the client company they have a Jboss AS 4.2.3 installed on Fedora and configured as a service, so it starts automatically on boot machine with PostgreSQL. So, if i run chkconfig --list i can see Jboss here as a service.
But the problem is when i try to restart, stop or start this service (i have root permissions) using this command:
service jboss stop/restart
But i don't know what happens that looks like it doesn't find the Jboss AS instance that's running because i get this message:
JOBSS_CMD_START = cd /opt/java/jboss/bin; /opt/java/jboss/bin/run.sh -c default
No JBossas is currently running
But it's running because if i enter localhost:8080 on a browser it loads the Jboss page. The server admin of the company doesn't know also why the service can't restart or stop or start and only i know that he followed this tutorial to install and configure JBoss AS:
thewiki4opentech.org/index.php/How_to_install_JBoss_AS_in_CentOS_/RedHat/_Fedora
Also, i tried with
/etc/init.d/jboss stop
And i get the same output. If i use
/opt/java/jboss/bin/start.sh -c default
It tries to start a second instance of Jboss AS but it gives me errors because is trying to use the same ports as already started Jboss instance.
And it's difficult to me because i'm connecting remotely using Teamviewer and i want to deploy an EAR but i can't because i can't restart the service to extract the ear. So i wanna ask you for help if you know why the Jboss AS that's running can't be stopped or started using service jboss stop.
As aditional info, i'm using the config to access Jboss apps from other machines (using 0.0.0.0) and the server has a static IP. The config of my hosts file is this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.106 entertechserver.localdomain entertechserver
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Regards.
Well, i think that i found the answer. The server admin copy the script run.sh to /etc/init.d/ but we saw that there's another script named jboss_init_redhat.sh that i think is optimized for redhat/fedora systems, so we used this script to copy to /etc/init.d/ and it works!! Now when i stop it gives me the next output:
JBOSS_CMD_START = cd /opt/java/jboss/bin; /opt/java/jboss/bin/run.sh -c default -b 0.0.0.0
waiting for processes to stop
Really i haven't seen the difference between both scripts yet but it will be intersting to take a look.
Regards.

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"}