1
0
-1

I created a hello world web service plugin but can't install it. Please guide me in the right direction.

ERROR 27 Apr 2019 07:42:12 org.joget.plugin.base.PluginManager  - Failed bundle start for org.joget.hokeybond.cockpit [21]: org.osgi.framework.BundleException: Unable to resolve org.joget.hokeybond.cockpit [21](R 21.4): missing requirement [org.joget.hokeybond.cockpit [21](R 21.4)] osgi.contract; (&(osgi.contract=JavaServlet)(version=3.1.0)) Unresolved requirements: [[org.joget.hokeybond.cockpit [21](R 21.4)] osgi.contract; (&(osgi.contract=JavaServlet)(version=3.1.0))]

org.osgi.framework.BundleException: Unable to resolve org.joget.hokeybond.cockpit [21](R 21.4): missing requirement [org.joget.hokeybond.cockpit [21](R 21.4)] osgi.contract; (&(osgi.contract=JavaServlet)(version=3.1.0)) Unresolved requirements: [[org.joget.hokeybond.cockpit [21](R 21.4)] osgi.contract; (&(osgi.contract=JavaServlet)(version=3.1.0))]

	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4368)

	at org.apache.felix.framework.Felix.startBundle(Felix.java:2281)

	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)

	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)

	at org.joget.plugin.base.PluginManager.startBundle(PluginManager.java:295)

	at org.joget.plugin.base.PluginManager.upload(PluginManager.java:552)

Where is this contract coming from? joget's apache-tomcat/lib/servlet-api.jar is 3.1

Here is the dependency for servlet-api:

<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.servlet-api</artifactId>
<version>1.1.2</version>
</dependency>

I checked the manifest file of this org.apache.felix.http.servlet-api, and can confirm that it supports 3.1 API

Here is the web service:

package org.joget.hokeybond.cockpit;

import org.joget.plugin.base.ExtDefaultPlugin;
import org.joget.plugin.base.PluginWebSupport;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class MyExperiment extends ExtDefaultPlugin implements PluginWebSupport {
    public void webService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // Write to response
        response.getWriter().write("Hello World!");
    }

    public String getName() {
        return "Experiment";
    }

    public String getVersion() {
        return "1.0";
    }

    public String getDescription() {
        return "Experiment";
    }
}

and this is the Activator:

package org.joget.hokeybond.cockpit;

import java.util.ArrayList;
import java.util.Collection;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

public class Activator implements BundleActivator {

    protected Collection<ServiceRegistration> registrationList;

    public void start(BundleContext context) {
        registrationList = new ArrayList<ServiceRegistration>();
        registrationList.add(context.registerService(MyExperiment.class.getName(), new MyExperiment(), null));
    }

    public void stop(BundleContext context) {
        for (ServiceRegistration registration : registrationList) {
            registration.unregister();
        }
    }
}
    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi, did you look at the Plugin Tutorials? In many of the examples they include the dependency to 

       
      <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.0</version>
      </dependency>
       
        CommentAdd your comment...