Re: Pluto 1.1.4 - java.lang.InstantiationException while deploying
Elliot Metsger <[email protected]>
| Newsgroups | gmane.comp.jakarta.pluto.user |
|---|---|
| Message-ID | <[email protected]> |
It looks like your web.xml is incorrect.
For Pluto 1.1, you need to have <load-on-startup> (which you have
commented out), the <init-param> portlet-name (check), and you need a
<servlet-mapping> "HelloWorld" to "/PlutoInvoker/HelloWorld/" (which you
don't have at all).
The other elements in your web.xml (portlet-guid, portlet-class) are for
Pluto 1.0. Which are fine to keep in your web.xml if you are planning
to deploy the portlet in multiple container.
I think the existing servlet mapping you have is incorrect for both
pluto 1.1 and pluto 1.0 containers.
As an aside, your web.xml contains a doctype for servlet 2.3, but your
<web-app> and following is in the servlet 2.4 namespace. That may
confuse things as well. Tomcat is probably forgiving but other servlet
containers may not be.
Elliot
Murthy Gandikota wrote:
> Hi
> I am testing a HelloWorld app. Here is the HelloWorld.java
>
> package testpluto;
>
> import javax.portlet.GenericPortlet;
> import javax.portlet.RenderRequest;
> import javax.portlet.RenderResponse;
> import javax.portlet.PortletException;
> import java.io.IOException;
>
> import javax.servlet.*;
>
> public class HelloWorld extends GenericPortlet {
> protected void doView(RenderRequest request,
> RenderResponse response) throws
> PortletException, IOException {
> response.setContentType("text/html");
> response.getWriter().println("Hello Portlet");
> }
> }
>
> I have successfully compiled this class and
> The path to it is WEB-INF/classes/tespluto
>
> Then I added these to the web.xml
>
> <?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 version="2.4"
> xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
> <servlet>
> <servlet-name>HelloWorld</servlet-name>
> <display-name>HelloWorld Wrapper</display-name>
> <description>Automated generated
> Portlet Wrapper</description>
> <servlet-class>javax.portlet.GenericPortlet
> </servlet-class>
> <init-param>
> <param-name>portlet-name</param-name>
> <param-value>HelloWorld</param-value>
> </init-param>
> <!-- <load-on-startup>1</load-on-startup> -->
> <init-param>
> <param-name>portlet-class</param-name>
> <param-value>testpluto.HelloWorld
> </param-value>
> </init-param>
> <init-param>
> <param-name>portlet-guid</param-name>
> <param-value>HelloPluto.HelloWorld
> </param-value>
> </init-param>
> <!-- <load-on-startup>1</load-on-startup> -->
> </servlet>
> <servlet-mapping>
> <servlet-name>HelloWorld</servlet-name>
> <url-pattern>/hello/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
> The WEB-INF/portlet.xml
> <portlet-app
> xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
> version="1.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
> http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
> <portlet>
> <portlet-name>HelloWorld</portlet-name>
> <display-name>Change Case Portlet</display-name>
> <portlet-class>testpluto.HelloWorld</portlet-class>
> <supports>
> <mime-type>text/html</mime-type>
> <portlet-mode>view</portlet-mode>
> </supports>
> <portlet-info>
> <title>Hello World</title>
> </portlet-info>
> <init-param>
> <name>config</name>
> <value>/WEB-INF/ptest-config.xml</value>
> </init-param>
> </portlet>
>
>
> </portlet-app>
>
> The index.jsp
> <jsp:forward page="/hello">
>
> I restarted Pluto several times and all these times when accessing
> http://localhost:8080/ptest/hello
>
> I get the following error in the Catalina.out
>
> 4 [http-8080-Processor25] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ptest].[HelloWorld] - Allocate exception for servlet HelloWorld
> java.lang.InstantiationException
> at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at java.lang.Class.newInstance0(Class.java:350)
> at java.lang.Class.newInstance(Class.java:303)
> at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1055)
> at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:757)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)
>
> I have been breaking my head over these for nearly 40 hours now.
> Sorry, I don't know maven and don't intend to know at this time. I am fine with ant.
> It took me a while to understand the deploy. I even tried deploying from the manager/admin screens. Still
> The same result.
>
> I'd appreciate all of the help you can give me in making this successful.
>
> Thanks
> Murthy
>