Eclipse and cronTriggered jobs debugging - java

I have a webapp developped in Java, using GWT, Spring and Hibernate.
This app has a cronTriggered job (which extends QuartzJobBean), set in a application-context.xml file.
How do I debug that job (which is triggered to run every minute) ?
I have tried to set breakpoints in the method executeInternal() of the job class (I am using Eclipse Java EE Helios), but they don't seem to be reached.

Change how the app is started to include the remote debugging agent. That way, you can attach to it from Eclipse. Once attached, it should respond to breakpoints set within Eclipse and from there you are in a typical debugging session. Be aware if the app uses timeouts, they can trigger while you are stopped at a breakpoint which can make it difficult to continue execution afterwards.

Related

Can you set breakpoints in code under test when using cucumber?

I'm just learning cucumber for test automation, and would like to know if it's possible to use it to debug the application the automation is for?
So basically I'd like to know if it can be used to debug the application being developed?
Thanks.
Les
Yes, as long as your running the instance of the application under test in debug mode you can set breakpoints and debug as you normally would when interacting with it manually. Cucumber does nothing that would prevent this.
You can start any java application (say you have prepared build for testing) with remote debugging enabled. So that your steps would be:
Start app you would like to test with remote debugging enabled (see docs here)
In IDE open that app sources and connect to that debugger port you have set up on step 1
Put some breakpoints
Run your cucumber tests
Since now as soon as your Cucumber tests will make your app hit break-point the service will stop and you will be able to manipulate the state through IDE.
P.S. - Since your Cucumber tests will be running separately in regular way, stopping the service at the breakpoint will lead to timeout error on client side after certain time of connection inactivity. Possible solution is to configure your client to accept longer pauses.

GAE development server ignores "threadsafe" flag

I'm using eclipse with Cloud Tools plugin for my GAE application (Java). I'm trying to make my servlet dispatch multiply requests, so I added the flag <threadsafe>true</threadsafe> in appengine-web.xml. But regardless the flag value, development server keeps dispatch requests serial (in single thread).
When I deployed the project to production then in works fine there. Also it used to work with Google plugin for Eclipse. So I supposed the problem is in Cloud Tools plugin or how I use it.
ps: the flag value keeps to be ignored even if it not valid boolean.
Thanks for help!
Currently the Cloud Tools for Eclipse plugin does not support multithreading in local run/debug: https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/498#issuecomment-250295446

How do I make modification in java class hosted on a tomcat server faster?

I have a java codebase in form a war hosted on Apache tomcat server(Production server). Now let us say i make changes in my class and i want the same to reflect on my hosted codebase. Do i have to re-start the server every time after updating the class, or is there some better way to do it
You can use auto-deploy feature of tomcat. Read the documentation here.
If it is a development testing server, you can enable debugging, and reload your changed classes without having to restart the server or redeploying your webapp.
You can enable debugging by setting the following and restarting tomcat. (you can use a desired port):
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787
In your IDE, create a debug configuration specifying server ip and the debug port you specified.
After connecting debugger, your IDE will usually prompt you to reload changed classes whenever you compile a class.
There is also a menu item also if you want to manually reload changed classes. Once you reload classes, your changes will be immediately effective.

Starting JBoss 5.1.0 from Eclipse never registers completion

I've recently run into a problem starting our JBoss 5.1.0 server from Eclipse (Kepler). Everything usually works fine, and the server starts up. I've recently been tasked with writing a new custom login module, and that's when the problems started. I've been able to get the login module to work properly, and register a proper login, but the server now will not complete startup when the new login module is in use.
I do see the message that the server has started up in the log, but Eclipse won't recognize that it has completed (e.g.: "Started in 2m:10s:000ms"), and eventually times out (I currently have it set to 1000 seconds, and it times out).
Obviously, the first step is to examine the thing that's changed recently, which is the login module. I'm working off of an existing (custom) module, and everything looks very similar to what I've coded up. Unfortunately, I cannot post any sample code, which makes the question more difficult to answer.
-Edit to add additional information-
The login module sits in a JAR file, and is using an ehcache instance to cache the user's credentials. The cache instance is accessed by the login module to look up the user's information, and if the cache misses, the cache is using an auto-populator to go grab the user's information, and populate the cache with it. The auto-population logic is encased in an EJB3 container, as a simple EJB service, and the EAR file is dropped into the deploy folder of the server.

How can I enable Java Remote debugging using quartz with spring framework?

I have an application that uses Spring-Batch and its jobs are launched through Quartz.
The problem is that my application starts using the debugging mode on, I have set some breakpoints but my application never stops on my breakpoints.
I have tested the ports, also enabled the debug on suspend mode so I can confirm that my app is connected well to the debug port.
On the other hand, I have tested my other applications that use spring-core and everything work fine, the only problem is in my app that use spring-batch and quartz which the debugger doesn't work.
Does anybody know what is happening? Why the debugger doesn't stop on my breakpoints? Do I have to configure anything in Quartz or spring-batch to allow debugging?
Thanks a lot in advance

Categories