Websphere works when run but fails when debug - java

I'm using Intellij with WebSphere 8. When I run from within IDE the server works normally. When I try to run it in debug mode however, it fails with the following error:
C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin\generated_websphere_server_start_script.cmd
C:\IBM\WebSphere\AppServer\java\bin\java -Dfile.encoding=windows-1252 -classpath "C:\IBM\WebSphere\AppServer\runtimes\com.ibm.ws.admin.client_8.5.0.jar;C:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.security.crypto.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\plugins\webSphereIntegration\lib\webSphereIntegration.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\plugins\JavaEE\lib\javaee-impl.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\lib\openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\plugins\webSphereIntegration\lib\specifics\webSphereClientImpl.jar" com.intellij.javaee.oss.process.JavaeeProcess 62847 com.intellij.j2ee.webSphere.agent.WebSphereAgent
Error: JDWP agent already loaded - please check java command line options
[2014-08-11 01:58:59,248] Artifact x.ear: Server is not connected. Deploy is not available.
JVMJ9TI064E Agent initialization function Agent_OnLoad failed for library jdwp, return code -1
Detected server admin port: 8880
JVMJ9VM015W Initialization error for library j9jvmti26(-3): JVMJ9VM009E J9VMDllMain failed
Detected server http port: 9080
Disconnected from server
I tried almost everything I have no idea what the problem is. I did google it for several hours with no luck.
Do anyone know what this all is about and how can it be fixed?
Here is my server configuration:

Solution 1
unchecked the Pass environment variables check box and restart the server in debug mode. it should work properly.
Run --> Edit Configuration --> websphere server --> Startup/Conections tab
select debug, you will see the Pass environment variables check box. it need to be unchecked for debug to work.
Solution 2
if debug mode of websphere is working in eclipse and not working in intellij that reason i found out is debugging serverice on the websphere is already started and intellij is again trying to start the debggin service. so stop the service from websphere console (Servers > Server Types > WebSphere application servers > [serverName] > Debugging Service) and all the default configurations in intellij should work.

I had the same problem. Finally I figure it out. I hope this solution helps. I'm using Intellij idea 2019.1.3.. and WebSphere 8.5.5.13
check WebSphere start server script find debug env variable name (in my script (WebSphere\AppServer\bin\startServer.bat)
WAS_DEBUG)
add same debug option name to intelliJ IDEA
run- debug configuration environment tab.
Since default env variable is debug and cannot be overridden
check pass env variables
add WAS_DEBUG option as I did
or you can update WAS_DEBUG as DEBUG (same as default in IntelliJ) in server startup.bat script.
Both should work.

Pretty old, but i was able to experience too!
They will try to fix this now in: https://youtrack.jetbrains.com/issue/IDEA-193580

firstly, sorry if the translation is not good, I am Brazilian and I would like to share the solution I made.
First: Locate the file "startServer.bat in "WebSphere\AppServer\bin" and open it with any text editor.
Second: Search for the second incidence of the word "WAS_DEBUG" and replace it with "DEBUG", as shown in the image...
Third: In Intellij, go to the server settings and in the "Startup/Connection" tab, select debug.
Fourth: Now uncheck the "use default" checkbox in "Startup script" and point to the location of the "startServer.bat" file in the webSphere directory.
Fifth: Right on the left side of the checkbox, there is an option to enter a parameter. Click and a "Program Arguments" field will appear. Enter the server name, in my case it was "server1".
Okay, now just test
enter image description here
enter image description here

Related

SAP Hybris on Mac OS Catalina

I just update my Mac OS to Catalina version and my Hybris server stopped turning on. So on command ./hybrisserver.sh start I get this
MacBook-Pro-Sasha:platform sashayukhimchuk$ ./hybrisserver.sh start
Starting hybrisPlatform on Tomcat...
/Users/sashayukhimchuk/hybris/CXCOMM181100P_1-70004085/hybris/bin/platform/tomcat/bin/wrapper.sh:
line 1388: 4614 Killed: 9
"/Users/sashayukhimchuk/hybris/CXCOMM181100P_1-70004085/hybris/bin/platform/tomcat/bin/./wrapper-macosx-universal-64"
"/Users/sashayukhimchuk/hybris/CXCOMM181100P_1-70004085/hybris/bin/platform/tomcat/conf/wrapper.conf"
wrapper.syslog.ident="hybrisPlatform"
wrapper.pidfile="/Users/sashayukhimchuk/hybris/CXCOMM181100P_1-70004085/hybris/bin/platform/tomcat/bin/hybrisPlatform.pid"
wrapper.daemonize=TRUE wrapper.name="hybrisPlatform"
wrapper.displayname="hybrisPlatform on Tomcat"
wrapper.statusfile="/Users/sashayukhimchuk/hybris/CXCOMM181100P_1-70004085/hybris/bin/platform/tomcat/bin/hybrisPlatform.status"
wrapper.java.statusfile="/Users/sashayukhimchuk/hybris/CXCOMM181100P_1-70004085/hybris/bin/platform/tomcat/bin/hybrisPlatform.java.status" wrapper.script.version=3.5.29 --
Waiting for hybrisPlatform on Tomcat..................
WARNING: hybrisPlatform on Tomcat may have failed to start.
I had to allow the wrapper-macosx-universal-64 and some other libs in Systemsettings > Security > General while starting the Hybris Server.
Remove the app (and all the necesary side apps) from Mac OS quarantine:
xattr -d com.apple.quarantine wrapper-macosx-universal-64
You can find the blocked wrapper under /bin/platform/tomcat/bin
If you get an error saying that the wrapper-macosx-universal-64 or libwrapper-macosx-universal-64.jnilib cannot be opened because the developer cannot be verified, proceed as follows:
Go to system preferences security and privacy
Click the General tab.
In the list, select the executable that you tried to run, and unblock it.
Run the command again.
to fix it, u need new tomcat in bin/platform. I just create new hybris project with .zip and copy tomcat folder to my hybris project and after some confirming about security in Mac OS setting, it works
It's probably could happen as a result that wrapper-macosx-universal-64 was deleted by macOS during a security check.
You can copy the file from the original path in hybris zip archive -
hybris-dir/bin/platform/tomcat/wrapper-macosx-universal-64
to your installation and follow the actions related to macos developers security check to allow starting the tomcat

How to start Apache Zeppelin in debug mode?

I need to start Zeppelin in debug mode in order to add breakpoints in Intellij to remote debug the code.
How do I do this? There is no documentation available on this.
You can set this property
In zeppelin-env.sh
export ZEPPELIN_MEM="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8111"
Similarly you can do for interpreter-mem
Only catch is you can remote debug only one intrepreter process since there are no unique properties for each interpreters.
See How to contribute page for details about debugging.
First, let's update zeppelin-env.sh to properly set the configuration to get the JVM to start in debug mode.
Edit $ZEPPELIN_HOME/conf/zeppelin-env.sh
Add the following to the file:
export ZEPPELIN_MEM="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8111"
Now that we have updated the zeppelin-env.sh, the next time Apache Zeppelin starts, it will be listening for a remote debugger on port 8111.
To debug an interpreter, update ZEPPELIN_INTP_MEM envrionment variable instead.
But as Ram has already mention, it would only work for one interpreter, because of port conflict.
Configure IntelliJ IDE to connect and debug the remote Apache Zeppelin
Go to Run->Edit Configuration
Create a new remote configuration in your IntelliJ IDE:
Configure IntelliJ to stop on exceptions
Go to Run->View Breakpoints
Enable 'Java Exception Breakpoints'
Select condition checkbox, and add the following condition :
!(this instanceof java.lang.ClassNotFoundException ||
this instanceof java.util.MissingResourceException ||
this instanceof javax.naming.NoInitialContextException ||
this instanceof java.lang.NoSuchMethodException)
You should now have Exception breakpoints configured like:
Full credit goes to Luciano Resende - see complete article here:
http://lresende.blogspot.com/2016/08/launching-apache-zeppelin-in-debug-mode.html

Weblogic server not running from jdeveloper

When i tried to run an application on jdeveloper, the server wont start and it shows the following message
*** Using HTTP port 7101 ***
*** Using SSL port 7102 ***
C:\Users\Ayodeji.Ayodeji\AppData\Roaming\JDeveloper\system11.1.2.3.39.62.76.1\DefaultDomain\bin\startWebLogic.cmd
[waiting for the server to complete its initialization...]
\IBM\WebSphere was unexpected at this time.
Process exited.
Finally i got the problem solved. I tried to locate the startWebLogic.cmd file in the specified path, and went through the file, then i realise its trying to access my classpath, so on checking my classpath from the environment variables, its has only entries to Websphere so i deleted the entry, restarted JDeveloper and my server is up and running.
I had the same issue with Eclipse setting Weblogic, I was trying to start the Server, but got the same error.
\IBM\WebSphere was unexpected at this time.
It was due to Window 7 folder security issue. As soon as I realized that, I close eclipse and start eclipse with Administration Right. That resolved the issue.
1.Go to
C:\Users\Ayodeji.Ayodeji\AppData\Roaming\JDeveloper\
Ayodeji.Ayodeji should be your PC User name
then change
system11.1.2.3.39.62.76.1
Folder name to another name and run.

Eclipse : Failed to connect to remote VM. Connection refused. [duplicate]

This question already has answers here:
Eclipse Error: "Failed to connect to remote VM"
(26 answers)
Closed 9 years ago.
When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused.
What's the problem may be? I already tried with most of the solutions out in the web but none of that solved my issue. Could any one can assist me to fix this? Advance thanks..
when you have Failed to connect to remote VM Connection refused error, restart your eclipse
Which server are you using?
Like already said:
In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
You'll have to set the JVM property of the server to debug
For Glassfish:
Log in to admin-console > Configurations > server-config > JVM-Settings > check DEBUG checkbox > restart server
For Tomcat:
create file debug.bat/.sh (depending on your OS) in %TOMCAT_HOME%/bin directory and write
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start
in it.
After you've created this file start server by executing debug.bat/.sh.
Now you should be able to debug remotely in Eclipse after you set the necessary properties in your debug configuration.
Hope this helped! Have Fun!
EDIT
If you're running tomcat in a Win environment as a service you don't have a catalina.bat file in the bin-directory of your tomcat installation.
To set your server into debug-mode please try the following:
Run the Configuration option in Windows Menu or run %catalina_home%/bin/tomcat6w.exe
In Java tab, add this line to Java:
options:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Sometimes the port which you are trying to access, gets occupied and won't be released.
Try some tools to find whether the port is in use or not.
I also faced the same issue. I tried giving different port numbers but unfortunately it didn't work. I tried restarting the system (not the application server), and it worked :)
I faced the same issue. But i resolved it by changing my port numbers to different one.
The port number in the Eclipse configuration and the port number of
your application might not be the same.
You might not have been started your application with the right
parameters.
Those are the simple problems when I have faced "Connection refused" error.
As suat said, most of the time the connection refused is due to the fact that the port you set up is in use or there is a difference between the port number in your remote application debugging configuration in Eclipse and the port number used in the address attribute in
-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n.
Check those things. Thanks!
If you need to debug an application working on Tomcat, make sure that your Tomcat-folder/bin/startup.bat (if using windows) contains the following lines:
set JPDA_TRANSPORT="dt_socket"
set JPDA_ADDRESS=8000
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
I ran into this problem debugging play framework version 2.x, turned out the server hadn't been started even though the play debug run command was issued. After a first request to the webserver which caused the play framework to really start the application at port 9000, I was able to connect properly to the debug port 9999 from eclipse.
[info] play - Application started (Dev)
The text above was shown in the console when the message above appeared, indicating why eclipse couldn't connect before first http request.

Cannot run project from IntelliJ IDEA because of jdwp error

I have a project in IntelliJ IDEA I want to run locally. When I click its debug button it says:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Disconnected from server
Error occurred during initialization of VM
agent library failed to init: jdwp
When I click the run button it works. What is the matter?
This is probably too late to help you, but maybe it will help somebody else. The answer is based on a support forum posting by Aleksei Sosnovski.
This can happen when your JAVA_OPTS contains two -Xrunjdwp arguments. E.g., one of these arguments might come from the server start script invoked by IntelliJ to start the container, and another may be added by IntelliJ itself. You can check by looking at JAVA_OPTS in the log when launching the container without debug. If you see an -Xrunjdwp argument, just find where it is set in the container startup script, and remove it.
I guess you already are debugging the server app? In this case it's not possible to connect another instance of debugger.
Most likely the problem happens because you have specified the debugging options in the "VM parameters" field of your run configuration. Everything will work if you remove them.
I had the same problem in my case -Xrunjdwp was set twice: one in the IDEA debug configuration and again in the system variables in CATAALINA_OPTS.
once I removed it from system variables (inside the IDEA it is read only) problem was fixed
Thanks for the tips, it helped me work out the problem too. Mine was due to having
set DEBUG_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
In my catalina.bat
check server.xml if you have jvmEntries get rid of that entry from server.xml
<!-- <jvmEntries xmi:id="JavaVirtualMachine_1" classpath="" bootClasspath="" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" runHProf="false" hprofArguments="" debugMode="false" debugArgs="-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777" genericJvmArguments="">
Open admin console (http://localhost:9060/ibm/console/login.do)
Application servers > server1 > Debugging service
un-check Enable service at server startup if checked restart server.
On Intellij uncheck the 'Pass environment variables' box in Run/Debug configuration

Categories