How to debug web project in MyEclipse using JBoss server? - java

I am new to jboss and myeclipse.
I want to debug my web app using jboss 4.0.4
I am using MyEclipse.
I gone through various links and found we need to uncomment following line in run.bat file
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
then after starting run.bat console shows
Listening for transport dt_socket at address: 8787
Then next how do I tell MyEclipse to attach to port 8787 and run my application in debug mode.

You need to define a Remote Java Application in the Eclipse debug configurations:
Open the debug configurations (select project, then open from menu run/debug configurations)
Select Remote Java Application in the left tree and press "New" button
On the right panel select your web app project and enter 8787 in the port field.
Here is a link to a detailed description of this process.
When you start the remote debug configuration Eclipse will attach to the JBoss process. If successful the debug view will show the JBoss threads. There is also a disconnect icon in the toolbar/menu to stop remote debugging.

Define a new server/runtime in MyEclipse, for your JBoss 4 installation. Deploy your project to the defined server and start it in debugging mode.
For more information, go to the MyEclipse learning center, also here.
For earlier releases, check in the inbuilt help.

Related

Debug micronaut application in eclipse IDE

I have created a java micronaut application in Eclipse IDE. The microservice is able to build and run successfully via commandline but I'd like to know if there is a way to add breakpoints in the application for debugging just the way we debug any normal java application?
I did try the solution mentioned here Debug java micronaut microservice in visual studio code.
I added run.jvmArgs('-Dmicronaut.environments=dev','-noverify', '-XX:TieredStopAtLevel=1', '-Xdebug',"-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n", '-Dcom.sun.management.jmxremote') configuration
to build.gradle.
When I build and run the project again, I see
> Task :run
Listening for transport dt_socket at address: 8000
12:53:51.084 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [dev]
12:53:53.809 [main] INFO io.micronaut.runtime.Micronaut - Startup completed in 3102ms. Server Running: http://localhost:6030
So how do I add breakpoints and debug the microservice now?
In this setup, the JVM is listening on a socket for a debugger to attach. In Eclipse, you can create a remote debug configuration for this:
Run -> Debug Configurations
Make new Launch configuration under Remote Java Application
Ensure the right project is selected. Under Connection Properties, let it connect to localhost on port 8000 (which happens to be the default)
Click Debug

Not able to debug webservice using eclipse

i have tried the webservice example mentioned in the below link.
https://codezone4.wordpress.com/2012/11/08/restful-web-services-java-mysql-and-json/.
i build the application with maven deployed in tomcat then clicked on the webservice link in the chrome , not able to access my code.
Now i tried to debug with postman .
I clicked on my webservice class -> then debug -> debug configiuration
then i selected remote application
there values of host and port are
Host : localhost
Port : 8080
then it is showing establishing connection for long time and after that it is showing Failed to connect to remote vm .connection timedout
Can you please guide me how to make deugger working in eclipse to debug the rest api call.
I can find quick solution (In Windows Environment with local host):
1) Download tomcat in your favorite drive (E.g. d: drive)
2) Open startup.bat file under tomcat/bin folder in notepad
3) Replace following line (Which appear at the end of file)
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
with
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
4) Restart your tomcat as it will start with listening port 8000
5) Open Eclipse->"Run"->"Debug configuration"-> Create "Remote Java Application" and provide following information:
Name: sample-name
Project: your project folder
6) Click on Debug button
Note: Make sure Connection properties will have
Host: localhost
Port: 8000
7) Put debug point in your code
8) Open Postman and Hit sample REST API call as you will see the debug point will appear in your code
That's It!
Quoting from your query,
clicked on my webservice class -> then debug -> debug
The project you created requires the restApplication to be deployed on a running server.
Prior To Testing -> check http://localhost:8080 is up or not, and then publish the war into the server.
choose Debug As-> Debug on Server

Debug tomEE on IntelliJ

I know that this answer was asked before, but I couldn't find a clear solution from the given answers.
I want to debug a maven project that implements a web service on tomEE using IntelliJ or any other IDE.
I know that instead of calling the goal tomee:run I must call tomee:debug. And that's what I did:
In IntelliJ, I click on Run / Edit Configurations then +, I chosen Maven, I located the project directory and I set tomee:debugas command line. I started the debug and it says:
Started server process on port: 8080
Listening for transport dt_socket at address: 5005
I think this first step is correct. The second step as I understood is to create a remote configuration, and this is what I failed to do.
What I did is the following:
Run / Edit Configurationsthen +, then TomEE Server. Here I choose local or remote? In my case I think local because the project is local on the device and I call it using localhost:8080.
After that, how to configure this page? What will be the port number 5005 or 8080? And when I finish configuring this page what I do? Run or debug?
I would appreciate a detailed answer because I was not able to understand the short answers given on other questions.
Here's the solution:
Step 1:
In IntelliJ, I click on Run / Edit Configurations then + to add a new configuration, I chosen Maven, I located the project directory and I set tomee:debugas command line. I started the debug and it says:
Started server process on port: 8080
Listening for transport dt_socket at address: 5005
An alternative solution can be by locating the project directory in terminal and running the command: mvn tomee:debug
Step 2: In IntelliJ, I click on Run / Edit Configurations then + to add a new configuration, I chosen Remote, and I specify localhost with port 5005.
Now I click OK, and I debug this configuration.
Breakpoints are detectable and debugging works perfect.

Why localhost:8081/share can not be open?

I am trying to do alfresco tutorial. Under "Configuring the Custom Model in Alfresco Share" header I reached "Configuring the Custom Model in Alfresco Share". Then I run:
mvn integration-test -Pamp-to-war
Both for content-tutorial-repo and content-tutorial-share. Both repo and share started normally. But path http://localhost:8081/share redirects me to http://localhost:8081/share/page/ and to http://localhost:8081/share/page/user/admin/dashboard after login. But tutorial says:
Now open your browser and point it to http://localhost:8081/share. Log in using admin/admin and let’s see what’s different.
What’s different is that the “is sub-type” dropdown in the rule configuration panel now has our custom types and the “has aspect” dropdown now has our custom aspects.
But I see only dashboard no "Define Rule" as it shown on tutorial. What is wrong? How to open true /share path on alfresco?
You can define rules for folder, so:
click [Repository] menu,
choose some folder and click [View Details]
finally click [Manage Rules]
http://docs.alfresco.com/5.1/tasks/library-folder-rules-define-create.html
Hope you all are doing well.
I have two tomcat instances on my machine(apache-tomcat-7.0.5 and apache-tomcat-6.0.24).To run tomcat 7 I have made below changes in server.xml:-
shutdown port is changed from 8005 to 8006
connector port changed from 8080 to 8081
redirect port changed from 8443 to 8445
For AJP port changed from 8009 to 8010
Thank You.

Moskito inspect monitoring tool integration with Java web application issue

I have an issue setting up an rmi port on Apache Tomcat server
(set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401)
Here are the steps i have done and getting the error respectively.
Issue with MoSKito tool while configuring RMI port on Tomcat
I am also tried to configure MoSkito inspect on my java web application. as part of it, i have been trying to make RMI port using "set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401" on catalina.bat. there is no error as such but 9401 is not getting connected.
Steps followed:
1) My OS is Windows 7
2) I have installed Apache Tomcat v7
3) I have downloaded Moskito inspect .war file from http://www.moskito.org/download.html and
4) Installed Moskito inspect on my tomcat server, the MoSKito inspect web UI is loading good.
5) I have created a sample java web application and deployed on same tomcat server. and web application also working good.
6) Now i have taken step to configure RMI port 9041 using below command on \bin\catalina.bat file(since i am on Windows OS).
I have put the below command on top of the file in \bin\catalina.bat
set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401
7) and started tomcat server, and then opened Moskito application on browser and gone to Quick Connect option on and given localhost and rmi port 9401 to call remote invocation.
Its failed.... its always giving error as MoSKito encountered an error:
Cannot connect to localhost#localhost:9401, due: Can not resolve manually set reference. Server at localhost, port: 9401 is down or not properly configured
[net.anotheria.moskito.webui.util.APILookupUtility.findRemote(APILookupUtility.java:168), net.anotheria.moskito.webui.util.APILookupUtility.findRemote(APILookupUtility.java:142), net.anotheria.moskito.webui.util.APILookupUtility.getAdditionalFunctionalityAPI(APILookupUtility.java:113),
Q1: How to set -DlocalRmiRegistryPort=9401 on tomcat on Windows OS.
Q2: Once we set port, how to ensure port is set properly and its up and ready state for connection.
Q3: Once port is set properly, then how to set / configure specified java web application needs to be configured for MoSKito, since we could have more than one java web application on same tomcat server.
Please guide me, thank you :)
in order to be able to connect to a MoSKito monitored application you have to enable an agent that binds itself to port 9401 and answers your replies. To do so, you have to add a dependency to your pom (if you are using maven):
<!-- Enabling MoSKito Inspect Embedded -->
<dependency>
<groupId>net.anotheria</groupId>
<artifactId>moskito-inspect-remote</artifactId>
<version>${moskito.version}</version>
</dependency>
Please keep in mind that the current MoSKito version is 2.5.4
If you are using a servlet 3.0 compatible container (tomcat 7, jboss wildfly) you are done. If you are using an older container you may need to add following to your web.xml:
<listener>
<listener-class>net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemoteListener</listener-class>
</listener>
If you are using no container at all, you can start it manually:
net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemote.startMoSKitoInspectBackend()
Now for you questions:
Q1: via catalina.bat. You were doing it correctly.
Q2: if the agent is configured everything will work correctly.
Q3: You may want to check out step by step guide here:
http://blog.anotheria.net/msk/the-complete-moskito-integration-guide-step-1/
Regards
Leon

Categories