Debugging Java application in Eclipse using transport=dt_shmem - java

Is there a way to use Eclipse to connect to a Java application started in debug mode with transport=dt_shmem?
I'm on Windows, the application is local, and everything works perfectly when using transport=dt_socket. Just out of curiosity I was wondering if I could also use dt_shmem, but I can't find anything related to that when creating a new remote application in Eclipse.
I found examples for jdb, but nothing Eclipse related.

See eclipse bug on it:
Currently have no plans to implement shared memory transport.
And
Currently, we do not have the resources to implement shared memory
transport. Contributions welcome.
However, I guess the only difference would be speed. Like said in here, shared memory is faster, but socket protocol can be used across computers.

It does not look like it. If you look at the debug launch configurations for remote debugging it gives you only choices related to using a socket. And the help only refers to that as well.

Related

While in development in Xpages Libraries, changes are not picked up

I work with multiple XPages Libraries that contain all of our Java code outside Domino Designer. I'm using Eclipse Mars and have setup the Xpages SDK to make this work. Most of the Java code is called from Xpages (or managed bean inside a nsf). But everytime when I make a change in our Java code, the change is not picked up. I need to "restart task http" on my Domino development server everytime.
When I turn on debugging and change Java code, all changes are picked up immediately but it will crash my server when I change a return type or add a new function or move classes between packages.
Is there an easier way to develop in Java without restarting the HTTP task everytime I make change (or prevent those server crashes)?
When debugging from Eclipse, if you use the Stop option, it crashes the server. If you use Continue, it works fine.
In terms of hot-swapping code, there isn't a way currently. JRebel can be used with some servers, but I don't know of anyone who has got it working with Domino.
It's not specific to plugins though. The same is true of any shared Java code, presumably because it's compiled to byte code and cached. See this blog post where I had issues with SCXD http://www.intec.co.uk/single-copy-xpage-design-some-learning-and-why-its-not-for-me/. There are various tell http osgi commands including ones for bundles etc, but I haven't found one that successfully reload plugins. I think Cameron Gregor did some investigations as well, but also couldn't find a way. It's one of the issues I highlighted with OSGi development on Domino on my blog http://www.intec.co.uk/from-xpages-to-web-app-part-seven-osgi-application-development-introduction/.

How Hot Code Swapping Works

I've been programming in Java, and I really enjoy the feature in Netbeans and other IDEs that allows you to make changes to your program while debugging without having to restart it. I am writing an application in Java which would benefit if I could update it on the fly without having to restart it. I had the idea to have a second jar that I could run when updated, which would be able to do the same thing that the IDE's do, but I have no clue how they swap the code. Can anyone enlighten me? Thank you!
IDE's such as Eclipse, when debugging use the JDI (Java debug interface). It is a collection of Java API's which allow you to create / attach onto external Java Virtual Machines. This can be used in conjunction with a Java Agent which can be used to re-define classes in the virtual machine. What Eclipse does during debug mode is create a new Virtual Machine with your code running in it. When you make an edit and re-compile; eclipse then tells the JVM to re-define the classes you have changed, by sending over the new byte-code.
You can read the JDI documentation, and take a look at the Java instrument class (which is used to configure a class-transformer) in particular. Here's a related question on setting up a JDI launcher (launch a new JVM).
I was actually learning about the same thing #work today. I found this article pretty helpful in understanding the workflow behind a few of the more complicated hotpush cases:
http://java.dzone.com/articles/5-jrebel-features-you-couldn%E2%80%99t

Can we debug Java programs with no main method?

We have a vast Documentum application which I have deployed in Tomcat. The code is being maintained and compiled in Eclipse IDE.
It is very hard to track where and what data is going through which code, I have a decompiler plugin to help with this task, but it does not work with most of my code as the classes are without a main method. These classes cannot be decompiled by the plugin.
Is there any method to overcome this? So that I can see the flow of data from JSP to backend class to repository, and vise versa.
Sure. You can either connect to tomcat using remote debugging (see here) or run tomcat into eclipse itself. You need appropriate plug-in for this but typically standard eclipse distributions for server side development already have one. Open Servers view, create new server, follow the wizard and you will be done in a minute.
JPDA is a java standard tool.
It is designed for use by debuggers in any environment on any java application.
For details you can look at
http://www.ibm.com/developerworks/opensource/library/os-eclipse-javadebug/index.html
http://www.ibm.com/developerworks/library/os-ecbug/
The 1st link gives a detailed view with screen shots of remote debugging using eclipse.

spring insight with org.codehaus.paranamer

I have a java spring GWT web application. I need to use a profiler to view why is a certain function that slow (on server)... After some searching, seems that insight is a good way... tried it and it works... what I did is create a tc server instance (developer edition) with insight and add the project to it. It works.
The problem here is that I use maven plugin "org.codehaus.paranamer", that is a plugin that I use to get function paramater names... It works post-compilation to add a special private field in the class that holds the parameters names.
This is a problem with insight since it seems that it modifies the code too and that it works on the source code not the compiled version in the target folder.
What I can do to make this work? FYI, all I need is profile the app.. not necessarily with insight....
Edit:
I ended up using visualvm... It can help with profiling the app on the cpu level and the memory level... That is the way I can use the common remote profiling mechanism jerry was talking about.
For profile of JAVA apps(including tomcat instances), I strongly recommend the TPTP(Eclipse Test & Performance Tools Platform). You can read a lot here:
http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html
Especially for TPTP working with tomcat instance:
http://www.deepakgaikwad.net/index.php/2009/02/10/tutorialprofiling-with-tptp-and-tomcat.html
Some of the information in the above article may be outdated, but main workflow is the same.
For commercial profilers, I will recommend yourkit profiler: http://www.yourkit.com/
I don't know if there is a trial edition available now, but years ago, this profile is more user friendly than TPTP.

Apache MINA Vysper documentation?

I plan on making an instant messaging app on Android and iOS, where you can chat to other people with the app, along with some custom features.
I’m going to use the XMPP protocol, and make a custom extension for it. I plan on making a Java application running on Amazon Web Services (AWS) so it's scalable.
After researching server options I’ve decided to use Apache Vysper.
However, I’ve never made a proper Java application before, and have never used XMPP, AWS or Vysper – so I’m rather reliant on good documentation :-)
The Apache Vysper project is very new and so the docs are a bit sparse. I was wondering if I was missing something, should I be using the general MINA docs as well? Are there other resources
elsewhere I don’t know about?
“Apache Vysper can run stand-alone or embedded into another
application.”
To be honest I’m just as lost when it comes to working out what to use to make a Java application anyway. Do you know if the AWS Java SDK has everything I need to make an application to use on AWS? And then is it a simple matter of integrating Vysper into this? Or do I need to make a Java application using something such as the Spring framework?
Thanks for taking the time to help me. If you know anything that could clarify the situation I would really appreciate it :-) --and sorry be being a bit useless, but hey, we've all got to start somewhere right ;)
First of all, as the founder of Vysper I apologize that the documentation is lacking completeness.
To answer your question(s).
Most Java applications bring their own ready-to-go start scripts with them.
Vysper is no exception. You get the pre-packaged download here:
http://mina.apache.org/vysper-project/downloads.html
Ok, before running it, you need to have Java installed, whether you're on your own machine, AWS, a server or a virtual machine anywhere else. Get it from Oracle, or use the package management of your Linux distribution. Make sure that after installing Java, you can execute "java -version" on the command line and you are all set.
Then, unpack the Vysper download, change to the bin/ directory and execute "run.sh" or "run.bat", depending on your OS.
Please note that support for Vysper - besides here on StackOverflow - is available on the MINA user mailing list here:
http://mina.apache.org/vysper-project/mailing_lists.html

Categories