How to disable/bypass JBoss EWS 2.0 logging on OpenShift? - jboss

I am able to deploy a war on OpenShift using git (git add, push ...) and it works. The only problem that I encountered is that all my logs are doubled (only when I deploy on OpenShift) whereas locally (using apache tomcat 7 with only log4j framework) all my logs are only logged one time.
After having searched one day on the Internet, I have found two ways to normally fix that problem, which is to find how to disable/bypass JBoss EWS 2.0 logging on OpenShift:
Clues found on Google
1) Add a JAVA_OPT to Startup
Now, when starting the application server, you will need to add a JAVA_OPT. This flag will make sure that the JBoss Log Manager does not pick up your logging configuration and your own logging JARs will work as normal.
./standalone.sh -Dorg.jboss.as.logging.per-deployment=false
And now your application will now log using the packaged JARs, effectively bypassing JBoss Logging.
Source: http://blog.jyore.com/?p=234
2) It looks like you have a log4j configuration file in your deployment. Try passing
-Dorg.jboss.as.logging.per-deployment=false
to disable that configuration from being used.
--
James R. Perkins
Source: https://community.jboss.org/thread/224127
My implementation of these clues
For implementing these solutions I did two things:
1) I created and git push this hook below:
vim .openshift/action_hooks/pre_start_jbossews-2.0
echo "executing pre_start_jbossews-2.0"
# I also tried with JAVA_OPTS
export JAVA_OPTS_EXT="-Dorg.jboss.as.logging.per-deployment=false"
echo "Value is: $JAVA_OPTS_EXT"
Note: this hook is well triggered, because I can see the echo when the server restarts after having pushed the modifications.
2) I also added this line in catalina.properties:
vim .openshift/config/catalina.properties
-Dorg.jboss.as.logging.per-deployment=false
Conclusion at that time:
Unfortunately none of these solutions disable/bypass JBoss EWS 2.0 default logging.
I am currently stuck with double log lines, so any help would be greatly appreciated, I count on you guys.
Thank you very much in advance for your help.

On Openshift the right way to setup persistent environment values is to use rhc tool:
rhc set-env JAVA_OPTS_EXT=-Dorg.jboss.as.logging.per-deployment=false -a myapp
Then try to explicitly stop and start your application (with rhc stop and rhc start).

Related

FAIL - Failed to deploy application at context path

Before I explain the problem, I just want to point out that I am completely new to NetBeans and Tomcat and I am doing a school project. That being said, the problem is exactly what the title says. Here is the output when I try to run a simple Hello World jsp:
In-place deployment at
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\build\web
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Flostl%2FAppData%2FLocal%2FTemp%2Fcontext7180600714574256491.xml&path=/Project3
FAIL - Failed to deploy application at context path [/Project3]
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\nbproject\build-impl.xml:1058: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 0 seconds)
I am using Apache NetBeans 11.2 and Tomcat 9 if it is relevant.
Here is what I tried:
I checked the server log and it displays absolutely nothing.
I tried setting the context path directly to Project3 (i.e. including the -C:/... before Project3) in the context.xml file under META-INF folder.
I tried restarting NetBeans and cleaning and building the project.
I tried running NetBeans under admin privileges.
I might seem like such an idiot for not knowing how to fix this since no one else seems to have this problem, but please help me out.
If you have installed the Apache Tomcat appart from Netbeans, maybe your apache service is already running and it conflicts with Netbeans. You may stop the apache service and then run the application in Netbeans.
Because Netbeans start the apache service in a diffent way, so you don´t need to install the aplication on apache´s folder.
Check out the Windows Services (Services App) and stop the Apache Tomcat if running, then from Netbeans menu select Run->Run Project. Netbean will start Tomcat and deploy your web app onto the Tomcat server.
I fixed it. All I had to do was restart my computer. I feel so dumb.
clean your project if clean project failed to delete some file then,
Just check there must be a java process running at background.
If you are using windows 10 then follow these steps
open command prompt and type below commands
tasklist | findstr java (hit enter now you can see a task list with pid number )
taskkill /F /PID "PID_OF_JAVA_PROCESS" (where PID_OF_JAVA_PROCESS--> task pid hit enter)
now run the project again
I faced this problem and found a solution. It is very simple. All you need to do is stop the Tomcat services or restart your computer and run your program.

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.apache.nifi.bootstrap.RunNiFi.main

i use intellij idea to run the nifi source code from bootstrap/.../RunNiFi.main("start"): github link, but it get wrong like this: picture here
can you help me ?
thanks
and should i run the code from bootstrap/.../RunNiFi.main("start")?
You won't be able to launch a single Java class from your IDE to start NiFi, the classpath won't be setup correctly.
You'll need to run a full build and get the assembly from nifi-assembly/target and then run NiFi from the built assembly by using "bin/nifi.sh start".
You can run it directly from the unpacked assembly target, for example:
cd nifi-assembly/target/nifi-1.6.0-SNAPSHOT-bin/nifi-1.6.0-SNAPSHOT
./bin/nifi.sh start
EDIT: You can still use debugger, but it will be debugging a remote Java application. In NiFi's bootstrap.conf, uncomment the following line and restart NiFi:
#java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
This tells the NiFi JVM to listen for incoming debug requests on port 8000.
In your IDE, create a Remote debugging configuration and connect to localhost port 8000. Your break points should work like normal.
if you can read chinese, you can read my personal blog link here
I found the methods,
if you want remote debug nifi, please follow remote debug link.
if you want local debug, you can follow bellow.
(I used Intellij idea in windows to debug)
1.
$ git config --global core.longpaths true
$ git config --global core.autocrlf false
open intellij idea to git clone https://github.com/apache/nifi,
picture here,
set the import configure as default, next...
after opened the project, the nifi may get wrong message, just ignore it.
mvn -T 2 clean install -DskipTests
configure debugger
picture here,
picture here
acknowledge:
nifi quick start link: https://nifi.apache.org/quickstart.html
Running NiFi in Debug mode link: https://cwiki.apache.org/confluence/display/NIFI/Contributor+Guide#ContributorGuide-RunningNiFiinDebugmode

how to redeploy application using management console in jboss EAP 6.3.0 GA?

I am using JBOSS EAP 6.3.0, I want to redeploy my application using management console. I don't see redeploy or enable/disable or refresh option under below section
Runtime>>Manage Deployments
EDIT:
The question was related to domain mode. See comments.
ORIGINAL:
The section you mention is correct. You can try different browser as I see no issues as you can check in
If you want an alternative you can use jboss-cli.sh (.bat) for this purpose:
$JBOSS_HOME/bin/jboss-cli.sh -c --command="/deployment=DEPLOYMENT_NAME:redeploy"
or interactive mode
$JBOSS_HOME/bin/jboss-cli.sh -c
> /deployment= [you can use tab to get deployment-name hints]
> /deployment=DEPLOYMENT_NAME:redeploy

How to run multiple JBoss EAP 6.3 instances as Windows services

We are migrating our JBoss EAP 4.3 infrastructure to EAP 6.3 (standalone).
We currently run several instances on each machine by having different server folders:
JBOSS_HOME\server\instance_1
...
JBOSS_HOME\server\instance_n
and a different set of startup scripts for each instance:
JBOSS_HOME\bin\run_instance_1.bat ; JBOSS_HOME\bin\service_instance_1.bat
...
JBOSS_HOME\bin\run_instance_n.bat ; JBOSS_HOME\bin\service_instance_n.bat
This way you can define SERVERNAME and SERVERIP for each instance from service_instance_X.bat.
The problem I'm facing is that I cannot seem to find a similar mechanism on EAP6.3. The closest I got was this command:
JBOSS_HOME\bin\standalone.bat -Djboss.bind.address=%SERVERIP% -Djboss.bind.address.management=%SERVERIP% -Djboss.server.base.dir
=%JBOSS_HOME%\%INSTANCENAME%
which does the job, but that does not help when running it as a service.
There is one promising option to prunsrv which is ++JvmOptions, where you can pass -D and -X options to JVM at service install time, but even when the install command runs successfully with the added options, it keeps starting up using JBOSS_HOME\standalone as jboss.server.base.dir.
Should I rather have custom service.bat, standalone.bat and standalone.conf.bat scripts? Looks like the best approach, but migrating or patching might become troublesome.
Any ideas would be welcome.
Sebastian
I had it working with the last option I mentioned: custom service_instancename.bat, standalone_instancename.bat and standalone_instancename.conf.bat.
But I had to edit several parts of the scripts. Definitely not ideal, but I see no other choice. If anyone came up with a better idea, please share.

JBoss Application Server redeploy

I need a windows shell script which will redeploy my .ear file. I wrote one:
net stop "JBAS50SVC"
copy /y O:\TEMP\app.ear C:\jboss-4.2.3.GA\server\default\deploy\app.ear
net start "JBAS50SVC"
But the problem is that when I try to stop the JBoss service it does not fully unload itself (my suggestion), so when I start it there's no app deployed in JBoss.
You mentioned that JBoss becomes very slow when you use autoDeploy and keep the server running for a month or more. That's likely to be because your permanent generation memory is filling up over time. See this related question.
I think you'd be best served by using the autoDeploy feature as other suggest, and restarting the entire server periodically to clear out PermGen. There's several ways to track PermGen utilization; I add the following to JAVA_OPTS in run.conf:
-XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -Xloggc:$LOGDIR/gc.log
Typically to redeploy an application that is self-contained in an ear in jboss just requires replacing the ear. If there is more to the application (such as classes that have to go in the jboss lib directory) then it may require a restart.
In terms of how to restart it, it depends what you are using to start jboss as a service. Some service starters do not actually control the jvm after they start it, so restarting the service just starts a second instance. You can shutdown jboss with the shutdown script in the JBOSS_HOME/bin directory (shutdown.bat) and then deploy and restart the service. Be sure to pause when you do this, as the shutdown command will issue the shutdown request, the server may still be running.
You can just COPY/RENAME the EAR file to deploy directory. JBoss will automatically take care of re-deployment for you.
As mentioned earlier jboss automatically deploys everything you copy into the deploy directory by default.
If not, check if you are working on a vhost that doesnt autodeploy ear files.
<Host name="vhost2" autoDeploy="false" .... />
other than that, I feel like this is a totally different error due to the fact that jboss takes care of deployment for you. Please check the log files for startup errors of your application.
You might want to check the JBoss community wiki on this, there are undoubtedly easier and more reliable methods than a batch file.
Stopping the server should not undeploy the application - that wouldn't make much sense.