Compiling Plugin

R

RamRod

I am trying to compile a simple Struts plugin. I am using the latest
Struts download and I have struts.jar in my classpath. I am getting a
compilation error.

The error message is :

WileyPlugin.java:14: WileyPlugin is not abstract and does not override
abstract method init
(org.apache.struts.action.ActionServlet,org.apache.struts.config.ModuleConfig)
in org.apache.struts.action.PlugIn
public class WileyPlugin implements PlugIn {
^

The code is in file WileyStruts.java and is as follows:

import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ApplicationConfig;
import org.apache.struts.action.ActionServlet;

public class WileyPlugin implements PlugIn {
public static final String PROPERTIES = "PROPERTIES";

public WileyPlugin() {
}

public void init(ActionServlet servlet,
ApplicationConfig applicationConfig)
throws javax.servlet.ServletException {
System.err.println("---->The Plugin is starting<----");
Properties properties = new Properties();

try {
File file =
new File("/props.txt");
FileInputStream fis =
new FileInputStream(file);
properties.load(fis);
ServletContext context = servlet.getServletContext();
context.setAttribute(PROPERTIES, properties);
Properties rProperties = (Properties)
context.getAttribute(PROPERTIES);
System.err.println("---->Prop: LDAP " +
Properties.getProperty("LDAP"));
}
catch (FileNotFoundException fnfe) {
throw new ServletException(fnfe.getMessage());
}
catch (IOException ioe) {
throw new ServletException(ioe.getMessage());
}
}

public void destroy() {
System.err.println("---->The Plugin is stopping<----");
}
}

Any ideas ?

Thanks, Rod.
 
T

Tor Iver Wilhelmsen

abstract method init
(org.apache.struts.action.ActionServlet,org.apache.struts.config.ModuleConfig)
public void init(ActionServlet servlet,
ApplicationConfig applicationConfig)

ApplicationConfig != ModuleConfig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top