Tag Archives: java

How to know validation of which control is getting failed

Sometimes in XPage applications it happens that our code do not run due to validation errors.
It becomes really difficult to debug if the form contains too many fields. To simplify the debug process in this scenario I have written a code snippet which gives client id of the control for which validation is getting failed.

My First Android App

I was learning android native application development. I developed a sample application to detect the operator and circle of a given mobile number. This is an database application. You can follow the development at GitHub.

If you want to install it on you android mobile click here.

If you do not have android phone then do not worry I have an alternative for you. Click here to access the application from Internet.

Debug Java From Lotus Notes Designer

We do not prefer to write agents in Java just because we are not able to debug the Java agent in Lotus Notes Designer. As we think Designer do not have any debugger for Java, but let me clarify that Lotus Notes Designer 8.5.x (also known as Domino Designer in Eclipse) has in-built Java debugger.

It is very clear that to write a Java agent we must extend AgentBase class and implement notesmain() function. So if our Java agent requires Domino Infrastructure to execute then how can we debug it? We have to make it a Java application to debug it. So we must define main function in our Java agent.

I am assuming the name of the agent class is MyAgent.

 
[java]
protected Session _goSession;
protected AgentContext _goCtx;

public MyAgent(){}

public MyAgent(Session s, AgentContext c) {
_goSession = s;
_goCtx = c;
}

public static void main(String[] args) {
Session s = null;

NotesThread.sinitThread();

try {
s = NotesFactory.createSession();
// NotesMain(), the way Domino does
MyAgent a = new MyAgent(s, s.getAgentContext());

a.NotesMain();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (s != null) s.recycle();
} catch (Exception x) {}
NotesThread.stermThread();
}
} // end main

[/java]

After adding above code to your Java agent switch to Java Debugger Perspective and goto Debug Configuration and double click on Java Application in left side. Check stop in main option and click on debug button to start debugging.

I hope this helps you in debugging your Java agent. If any query feel free to write me back…:)

Lets Start Java

From last few days I was struggling with Eclipse and Tomcat. I was not able to execute servlet from Eclipse IDE. After doing a lot of research finally I got the solution. All I need to do is to copy a folder “tomcat/webapps/ROOT” to “workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps” (or …/tmp1/wtwebapps if you already configured another server).

Source: http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html