0

I´m trying to deploy an OSGi container in Domino using PDE tool with Equinox. I´m following the instruction in this IBM slideshow: http://www.slideshare.net/fiorep/domino-osgi-development?next_slideshow=1

However (as per slide #52) when I browse to http://localhost/simpledemo (after clicking Debug from Debug Configuration), I get a "404 file not found" error.

"simpledemo" is the alias mapped in the puligin.xml file (slide 44). The servlet name is however SimpleServlet.

Any ideas what is going on?? Any help is much appreciated.

My environment: Windows 2012 Server (on VM),Eclipse 3.6.2, Equinox, PDE tool and Domino Server 6.01 server.

reference: Deploying OSGi Servlet to Domino

SimpleServlet.Java

 package com.ibm.ls2012;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;

public class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

public SimpleServlet() {

}

@Override

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
   final PrintWriter pw = resp.getWriter();

   resp.setContentType("text/html");
   pw.println("<HTML");
   pw.println("<HEAD><TITLE>SHOW112 - Simple Servlet Demo</TITLE></HEAD>");
   pw.println("<BODY>");
   pw.println("<BR>");
   pw.println("hello world. feeling cold yet?");
}}
Community
  • 1
  • 1
mikki
  • 3
  • 4
  • Have you done "restart task http"? Also, it might be useful to show web.xml code. It's definitely possible using pde launch configuration, I've done it a couple of times recently – Paul Stephen Withers Nov 20 '15 at 07:15
  • I´ve restarted the HTTP server, Domino server and the Windows 2012 server several times. Now that you mention, I actually dont see a web.xml file. I´ve seen the option to create in new Eclipse version while creating a Dynamic Web project. Do I need one? – mikki Nov 20 '15 at 08:30

2 Answers2

0

I followed the similar demo and for some reason have something slightly different. I'm not sure if something's changed or if I took a slightly different approach based on experience of Vaadin web applications on Liberty.

My plugin.xml has:

<extension
    point="com.ibm.pvc.webcontainer.application">
    <contextRoot>
       /helloWorldWC
    </contextRoot>
    <contentLocation>
       WebContent
    </contentLocation>
</extension>

So that's giving a root for the plugin application of "localhost/helloWorldWC/".

Then, in the WebContent\WEB-INF there's a web.xml that is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
    <servlet>
        <servlet-name>HelloWorldServlet</servlet-name>
        <servlet-class>com.paulwithers.helloWorld.HelloWorldServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloWorldServlet</servlet-name>
        <url-pattern>helloWorld</url-pattern>
    </servlet-mapping>
</web-app>

So this is saying anything with a subsequent URL pattern of "helloWorld", so "localhost/helloWorldWC/helloWorld" should use the HelloWorldServlet. That's defined in the preceding element as mapping to com.paulwithers.helloWorld.HelloWorldServlet class. You can change the url-pattern to "*" and then localhost/helloWorldWC will map to the HelloWorldServlet class.

To extend that, instead of pointing to an individual servlet class, you can point to a class that extends javax.ws.rs.core.Application which can contain a getClasses() method that returns a Set of all servlets contributed. Each servlet can then have an @Path annotation to define what the path used should be (all this is standard JAX-RS, I believe). It's a process I used in the attachment to this blog post. The attachment uses OpenNTF Domino API, but the core elements of interest to you - plugin.xml, web.xml, Application class and annotations on Servlet class - are standard.

Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33
  • I see where the confusion is (and why you were talking about web.xml). I was asking about the first deployment with Equinox and PDE tool. I think the part you mention starts at Slide 59 with Expeditor Web Container. have you had a chance to make the Equinox deployment work? – mikki Nov 20 '15 at 13:28
  • by the was my plugin.xml file for the Equinox deployment: – mikki Nov 20 '15 at 13:39
0

First thing I would check is that the plugin is correctly loaded. From the server console type: tell http osgi ss {yourpluginname}. Make sure the plugin is loaded and has an active state. If state is installed, then you have a missing constraint issue, to diagnose, type tell http osgi diag {pluginid}. Note: you can get the pluginid from the first ss command.

If state is resolved, then you need to start it manually using the following command: tell http osgi start {pluginid}. Note: being in a resolved state is not expected, the Domino Server should automatically start all plugins.

David Taieb
  • 206
  • 2
  • 8
  • t´s a missing Constraint issue. The Plug-in is Installed. But tell http osgi diag {pluginid}` gave me a message `Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7". I`ll have to trouble shoot this! Coincidentally, I`m also trying to run Eclipse Mars side by side and it´s refusing because of "Java execution environment does not exist". Weird because Eclipse 3.6.x works fine and JAVA_HOME variable points to JDK path. Guess tell http osgi start {pluginid} will work only after I fix this Constraint issue. I really appreciate your time on this, David!! – mikki Nov 23 '15 at 09:15
  • Any idea where to look for "Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7" error? Everything looks good with JDK : jdk1.7.0.79 installed in Program File (made Eclipse Mars happy) and JDK jdk1.7.0.51 installed in Program Files (x86) directory (makes Eclipse 3.6.x happy). – mikki Nov 23 '15 at 13:40
  • I noticed the following Warnings for build.properties for projects com.ibm.ls2012 and com.ibm.notes.java.api (i just followed the exact names from the Slides)--- "There is no jre.complitation.profile build entry and the project has Java compliance preferences set" – mikki Nov 23 '15 at 15:04
  • by changing the Bundle-RequiredExecutionEnvironment property of Manifest.mf (for com.ibm.ls2012) helped activate the Plugin. After server startup it was in Lazy status (Bundle-ActivationPolicy in manifets.mf?). I was able to make the Plugin Active with the Start osgi command. But navigating to localhost/simpledemo gives a blank page and does not activate the DEbugger in Eclipse--- but there are some HTTP JVM errors being spit out in the Domino server Console I need to check. – mikki Nov 23 '15 at 16:10
  • HTTP JVM errors were due to aplugin name Typo in the plugin.xml. Back to blank page and not switching to Eclipse debugger. – mikki Nov 23 '15 at 16:50
  • Look in META-INF/MANIFEST.MF of your plugin. My guess if that your development environment is set up with a 1.7 JRE and it was referenced there by accident. I recommend you load the Domino JRE into your eclipse environment and use it while developing your plugin. This will make sure that you're always at the same level as the Domino server JRE. – David Taieb Nov 23 '15 at 17:06
  • now the Debugger opens in Eclipse and goes to code breakpoint in SimpleServlet.java. But hitting ´`resume`on the DEbugger does not result in that (much coveted) output page shown in slide #54 of your presentation. Ideas?? -------------------------------------------------------------------------------------- PS: it got lost in my comments above but yes i changed the Bundle-RequiredExecutionEnvironment value to Java 1.6 from 1.7 and I could move forward. Domino Server 9.x is running 1.6. Thanks again, for your time and response! – mikki Nov 24 '15 at 10:17
  • PS: I had the SErvlet printout a a Hello world" text. That shows-- When i hit `resume`in debug mode or if I just browse to localhost/simpledemo outside of Eclipse...but... not the Slide 54 output from your presentation. – mikki Nov 24 '15 at 12:19
  • mikki, can you clarify what problem you're hitting now. If I understand correctly, it now works correctly outside the debugger but not while in the debugger? If so, are you seeing any errors in the log? – David Taieb Nov 25 '15 at 13:48
  • The only problem I have now is that I don´t get the output shown in slide #54 of your Presentation. I added a ´hello world` text to test the SimpleServlet output. This is displayed in the browser after I click Resume in the Eclipse Debugger. So I would say the implementation is finally working now...but I don't know why I´m NOT getting your output. The Console does not report anything. – mikki Nov 27 '15 at 11:48
  • Are you using the SimpleServlet code as shown in the slides? It would help if you could paste the contents of the servlet you are using – David Taieb Nov 27 '15 at 17:43
  • i copied everything in your presentation including downloading older version of Eclipse. Please see SimpleServlet.java code above (in my original problem description). Thanks again!! – mikki Nov 30 '15 at 10:48
  • Code seems ok to me. What are you expecting that you don't get in the output page? – David Taieb Nov 30 '15 at 18:10
  • I´m not getting the Output shown in the slide 54 of this presentation: http://www.slideshare.net/fiorep/domino-osgi-development?next_slideshow=1 ..I´m curious how you got this. – mikki Dec 01 '15 at 07:19
  • That's because you need to add the specific code in your servlet. Please see in slide 53 for a code snippet example – David Taieb Dec 01 '15 at 21:16
  • yes ofourse. I really appreciate your help!! Next time I´m in Boston I owe you lunch :) (not in IBM Cafeteria - I used to work for IGS in Boulder,CO) – mikki Dec 02 '15 at 08:53