Apache
ODE (Orchestration Director Engine) can be deployed and run in three
different environments. One of them is deploying ODE as a web service
in Axis 2, by deploying the ode war distribution inside an
application server like Apache tomcat. Once it is deployed and
started you may need to debug ODE, to understand what is going inside
the engine. The following is a short guide on how to debug Apache ODE
with tomcat in both Windows and Linux environments.
If
you don't know how to deploy ODE and run with Apache tomcat first
visit and read the this previous blog post.
Applicable
with:
Apache
Tomcat : 7.0.11 Download
Apache
ODE: 1.3.5 Download
Debug
ODE in Ubuntu 10.04
Apache
Tomcat can be debugged with JPDA debugger by starting tomcat with
catalina script. To do this start go to Tomcat_Home/bin
folder and
enter the following command.
apache-tomcat-7/bin$
sh catalina.sh jpda run
This
will start catalina server in debug mode and you can see it displays
the message, "Listening for transport dt_socket at address: 8000" in terminal as shown in Figure 1.
Another method would be setting the JAVA_OPTS to start up java for listening to debugger connections by giving,
apache-tomcat-7/bin$ export JAVA_OPTS=
"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
When it is set start the catalina server in the usual manner as 'sh catalina.sh run' and tomcat will be started in debug mode.
Now we can create a remote debug configuration by giving Host: localhost and Port: 8000 in our IDE which we have used to open the ode source code, and debug ODE by using that. Remember to use the same port used as JPDA_ADDRESS in tomcat as your IDE's remote debug port. The default port address is 8000.
Creating
a Remote Debug Configuration in Idea 10.0.3
This
is how to create a remote debug with IntelliJ Idea 10.
- Go to Run --> Edit Configurations in the IDE
Figure 2: Creating a Remote Debug Configuration
|
Figure 3: Created New Remote Debug |
- This will create a new remote debug configuration for us. Let's name it as 'ode' and fill the Host field with 'localhost' and Port field with '8000'. Then click OK.
Figure 4: Setting up Host and Port for remote debugging |
- The new remote debug is successfully created now. After the tomcat server is started, select 'ode' remote debug and start it by clicking icon in Idea. It will connect to the server via the defined port and you can start debug ODE now.
Figure 5: Debugging ODE |
Note:
port 8000 is the default port address used in tomcat for JPDA
debugging, however if port 8000 is busy(due to some other application
running there), you can change it into another port.
- Open catalina.sh script in the Tomcat_Home/bin folder and search for JPDA_ADDRESS, you will see JPDA_ADDRESS="8000" defined there. Change it to any available port and restart tomcat under JPDA debugger. The server will listen from the new address now.
Figure 6: Edit the JPDA_PORT in catalina script |
You can also change this port (let's say to 8010) by giving,
apache-tomcat-7/bin$
export JPDA_ADDRESS=8010 in terminal.
- Now go back to the 'ode' remote debug and select 'Edit Configurations' to edit its configurations.
-
When Debug Configuration window appears set the Port address into the modified port,8010. Once it is set ODE can be debugged using the new port again.
Debug
ODE in Windows
Debugging
in Windows is also very similar to in Linux, except the commands that
should be used. All the following demonstrations are performed in Windows
7 version.
- To start tomcat, go to the tomcat home's bin folder and start catalina.bat file under jpda debugger as follows.
C:\Apache-Tomcat-7\bin>
catalina.bat jpda start
Now
catalina will start in remote debugging mode under JPDA debugger
using its default port 8000. When it is started you will see tomcat
starts a new debug console as shown below in Figure 8.
Figure 8: tomcat Debugger Console in Windows |
This can be also done by setting an environment variable JAVA_OPTS, and starting the tomcat server with usual command.
C:\Apache-Tomcat-7\bin> catalina.bat run
When it is started create a new remote debug configuration as described in the previous section by configuring the correct Port address and Host. Once the remote debug configuration is connected to the server, you can debug ODE successfully.
C:\ Apache-Tomcat-7\bin> set JAVA_OPTS=
"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
C:\Apache-Tomcat-7\bin> catalina.bat run
When it is started create a new remote debug configuration as described in the previous section by configuring the correct Port address and Host. Once the remote debug configuration is connected to the server, you can debug ODE successfully.
Note:
To change the port address from 8000 to another port 'set' command
can be used in Windows. Go to Apache-Tomcat-7\bin and enter;
C:\
Apache-Tomcat-7\bin> set JPDA_ADDRESS="8010"
Figure 9: Change JPDA_ADDRESS in tomcat |
When
tomcat is started again you will see that it has changed the
listening port into '8010' as we changed. Change the Port address in
the remote debug into this new address and start debugging again.
Figure 10: Debugging tomcat in Different Port |
Hi
ReplyDeleteI am trying to debug ODE and I followed your steps for tomcat5.5 and IDEA 10.0.3, but its giving me this error
Error running ode: Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
I was working with the default 8000 JPDA debugger but then i changed it to 9090 in catalina.bat and remote debug configurations in IDEA and its still the same error. The server output is showing me this
19:53:27,314 WARN [ODEAxisOperationDispatcher] No operation has been found!
19:53:27,338 ERROR [AxisEngine] The endpoint reference (EPR) for the Operation not found is /ode/processes/helloWorld and the WSA Action = null
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /ode/processes/helloWorld and the WSA Action = null
at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:89)
at org.apache.axis2.engine.Phase.invoke(Phase.java:334)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:160)
at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:838)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:262)
at org.apache.ode.axis2.hooks.ODEAxisServlet.doGet(ODEAxisServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:843)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:679)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1293)
at java.lang.Thread.run(Thread.java:595)
can you please help me!!
Hi,
ReplyDeleteAs your first question,
"Error running ode: Unable to open debugger port : java.net.ConnectException "Connection refused: connect" message usually occurs when you haven't started your tomcat server before debugging it with Idea. Make sure you have started tomcat in debug mode first and then start the remote debug.Can you check what is the console output when you gives the 'catalina.bat jpda start' command?
About the second part i think you got this error log when trying to run the sample HelloWorld process. In that case you need to call the operation which is rendered in your HelloWorld Service when running the process from your web browser. Therefore your input URL in the browser should be like this.
http://localhost:8080/ode/processes/helloWorld/hello?TestPart=Hi
Try this in your browser after starting ODE and you will see the response.
The following thread has a good explanation on this.
http://stackoverflow.com/questions/4264657/how-to-run-the-helloworld-ode-from-the-browser
Hi Ishara,
ReplyDeletethanks you very very much for your step by step explanation. It worked really well following your steps.
Now you have a new fan from Frankfurt/Germany :-)
I got this error when I am running. How to fix it?
ReplyDeleteERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp