193 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
Re: Domino REST performance analysis
Thu, Mar 16th 2017 87
Domino & Java 1.8: Thank you, IBM!
Tue, Mar 14th 2017 24
Domin & REST: Debug your Plugin
Tue, Mar 7th 2017 10
Domino & REST: More about Jackson
Fri, Mar 3rd 2017 7
Domino & REST: Accessing Domino’s Environment / Check Authentication
Thu, Mar 2nd 2017 8
Domino & REST: Consuming JSON
Wed, Mar 1st 2017 9
Domino & REST: A basic Servlet
Tue, Feb 28th 2017 16
Top 10
Re: Domino REST performance analysis
Thu, Mar 16th 2017 87
Domino & Java 1.8: Thank you, IBM!
Tue, Mar 14th 2017 24
Domino & REST: A basic Servlet
Tue, Feb 28th 2017 16
Jackson: Skip Objects conditionally
Wed, Feb 8th 2017 12
DomiNodeJS: Node.js on Domino
Fri, Aug 26th 2016 10
Domin & REST: Debug your Plugin
Tue, Mar 7th 2017 10
Testing XPages (2): BrowserMob Proxy
Thu, Sep 17th 2015 9
Domino & REST: Consuming JSON
Wed, Mar 1st 2017 9
XPages: Execute Events with HTTP Get
Tue, Sep 30th 2014 8
XPages: Running Google’s Chrome V8 Javascript Engine
Sun, Nov 9th 2014 8


Domin & REST: Debug your Plugin
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
Sven Hasselbach    

When developing OSGi Plugins, you should have your own development server running on your local machine. Not only because of the faster deployment of changes (a new version of a plugin must always deployed with a HTTP restart), but because of the Java debugging posibilities: Only one Eclipse instance can connect to the JVM, and every request processed by the server will start the debugger. If multiple users a accessing the server while you are debugging, your Eclipse will try to debug every incoming request, and this can lead into a confusing situation for all.

To enable debugging, you first have to add two parameters to the notes.ini:

JavaEnableDebug=1
JavaDebugOptions=transport=dt_socket,server=y,suspend=n,address=8000

This starts the debugging on port 8000. Feel free to change the value to every port you want. Because of security reasons you should not start debugging on a productive machine.

After restarting the domino server, you can connect to the JVM in your Eclipse IDE by creating a new JVM remote debugging session. Create a new debug configuration…

… choose (1) „Remote Java Application„, (2) give a name to it, (3) select the plugin project, (4) enter the port the server listens, and click on (5) „Apply„.

If you want to connect to your server, you need to start debugging by clicking on the project:

After setting a breakpoint and sending a request to the servlet, Eclipse switches to the Debug perspective where you can look what happens with your servlet.

Sometimes you are connecting to the „wrong“ JVM, because a Java agent is running and/or a DOTS task does it’s job. It’s better to disable these tasks on your development server.

During debugging you are able to hotswap your code, but keep in mind that after a restart of the HTTP JVM all your changes are no longer „installed“. You have to build a new plugin or replace your code during runtime again.

In the next blog post, let’s talk about our development tools.



---------------------
http://hasselba.ch/blog/?p=2326
Mar 07, 2017
11 hits



Recent Blog Posts
87
Re: Domino REST performance analysis
Thu, Mar 16th 2017 8:51p   Sven Hasselbach
I have created a Quick-n-Dirty performance test for Csaba’s „10K record test“: Loading time 200 ms overall, 60 ms TTFB. Do you want to know how this works? Feel free to come to SNoUG next week or to Rudi’s EntwicklerCamp and join my sessions.
24
Domino & Java 1.8: Thank you, IBM!
Tue, Mar 14th 2017 1:16p   Sven Hasselbach
For years it was a lot of pain when developing for the Domino platform using Java 1.6 only. But now, Java 1.8 is available, and this allows to use the latest versions for a lot of libraries and development tools. After installing FP8 to the Client, Eclipse allowes to use the Domino JRE in a JavaSE-1.8 environment: This gives access to the latest M2Eclipse plugin (1.7.0). The old version problem when running with JRE 1.6… … is solved: Eclipse Updates? No problem, just do it! Latest
11
Domin & REST: Debug your Plugin
Tue, Mar 7th 2017 11:14a   Sven Hasselbach
When developing OSGi Plugins, you should have your own development server running on your local machine. Not only because of the faster deployment of changes (a new version of a plugin must always deployed with a HTTP restart), but because of the Java debugging posibilities: Only one Eclipse instance can connect to the JVM, and every request processed by the server will start the debugger. If multiple users a accessing the server while you are debugging, your Eclipse will try to debug every inco
7
Domino & REST: More about Jackson
Fri, Mar 3rd 2017 10:16a   Sven Hasselbach
When creating a REST API servlet, Jackson provides a huge list of possibilities to manipulate the JSON data, mostly using annotations. Let’s demonstrate some of them with this little class, which has only two properties: public class Demo { private String foo; private String bar; public String getFoo() { return foo; } public void setFoo(String foo) { this.foo = foo; } public String getBar() { return bar; } public void setBar(String bar) { this.bar = ba
8
Domino & REST: Accessing Domino’s Environment / Check Authentication
Thu, Mar 2nd 2017 11:00a   Sven Hasselbach
If we want to access Domino’s Environment, it is the ContextInfo class which gives us all we need. Everything you need to do to use the class is described in an earlier blog post. The class gives mainly access to the following methods: Method Description getDataDirectory() Path to notes data directory getEnvironmentString(String envName) Returns the environment variable getServerDatabase() The actual database as NAPI object, if any getServerVariable(String varName) Variables
9
Domino & REST: Consuming JSON
Wed, Mar 1st 2017 7:25a   Sven Hasselbach
Consuming JSON is as easy as pie: Just create a new method to the RestApiServlet,  add a @POST annotation, and declare the object you want to the parameters of the method:     @POST     @Path("/helloworld/")     @Consumes(MediaType.APPLICATION_JSON)     public Response postHelloWorld(HelloWorld helloWorld) {         return Response.ok(helloWorld, MediaType.APPLICATION_JSON).build();     } In this example we are using the same URI „/helloworld/„; because
16
Domino & REST: A basic Servlet
Tue, Feb 28th 2017 1:49p   Sven Hasselbach
To have a good starting point when creating RESTful applications on top of Domino, I have created a „Hello World“ example of a JEE Application, based on Apache Wink & Jackson 2.5.0. The Jackson AnnotaionProcessor is registered into Apache Wink application and is enabled by default, the JAXB processor is also included as the secondary AnnotationProcessor. The benefit of this is that only one global ObjectMapper instance is created and is reused, wich allows a better performance as
8
Domino & REST: Listeners for Initialization & Destroying of a Servlet
Mon, Feb 27th 2017 9:15a   Sven Hasselbach
If you need to know when your Servlet is initialized or destroyed, you can use a ServletContextListener in your application. First, create the class AppServletContextListener and implement the javax.servlet.ServletContextListener interface. This provides two methods for capturing the events: contextInitialized and contextDestroyed: package ch.hasselba.servlet; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class AppServletContextListener  
12
Jackson: Skip Objects conditionally
Wed, Feb 8th 2017 7:51a   Sven Hasselbach
I had a simple problem when implementing this brilliant solution in one of my REST applications: As soon I was using @JsonAnyGetter / @JsonAnySetter and the HidableSerializer together, a NPE was thrown during serialization. The Problem occured in Jackson 1.9.13 and even 2.5.0, the latest version usable with the actual Domino JVM. Stack Trace org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: ch.hasselba.Test["[anySetter]"]) null  
7
Entwicklercamp 2017: Meine Vorträge & Hands-On
Thu, Jan 19th 2017 7:51a   Sven Hasselbach
Dieses Jahr spreche ich wieder auf dem Entwicklercamp, und halte neben den Vorträgen auch noch eine Hands-On Session: Track 1 – Session 2: XPages erweitern und ausbauen – Ausgabe 2017 Im Laufe des Jahres 2016 kamen einige Themen hinzu, und dank FP8 wird es wohl auch einige Neuerungen geben, über die man mal reden müsste… Track 4 – Session 3: High-Performance REST Applications Hochperformante REST Schnittstellen entwickeln, die auf dem Domino Server laufen? Der Vor




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition