RE: Pluto 1.1.4 - java.lang.InstantiationException while deploying

Murthy Gandikota <[email protected]>
Newsgroups gmane.comp.jakarta.pluto.user
Message-ID <[email protected]>
I still get this exception:
4    [main] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ptest]  - Servlet /ptest threw load() exception
java.lang.InstantiationException

Here is the modified 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 >
<taglib>
      <taglib-uri>http://java.sun.com/portlet</taglib-uri>
      <taglib-location>tld/portlet.tld</taglib-location>
   </taglib>
<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>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
 <url-pattern>/PlutoInvoker/HelloWorld</url-pattern>
</servlet-mapping>

</web-app>

Should I use JetSpeed? I thought Pluto-1.1.4 can handle invocation. Also GenericPortlet is an abstract class. HelloWorld is extending this abstract class. Is there some bug in my JRE  that disables instantiation of a class that is extending an abstract class? Guess I don't understand this concept.
Why an abstract class? Why not an interface? Also, what is the purpose of
org.apache.pluto.core.PortletServlet that is used in the testsuite that came
with Pluto-1.1.4. I tried extending HelloWorld to PortletServlet. It is not coming up with an instantiation exception, but has certain session parameters missing viz:

javax.portlet.response
javax.portlet.request
org.apache.pluto.core.method

I tried injecting these parameters in index.jsp as:
request.getSession().setAttribute("javax.portlet.response", request);
request.getSession().setAttribute("javax.portlet.request",response );
request.getSession().setAttribute("org.apache.pluto.core.method", new Integer(1));

But that didn't work. There is an InternalPortletRequest and InternalPortletResponse that get set by the Invoker.

Any help appreciated.
Thanks
Murthy


-----Original Message-----
From: Elliot Metsger [mailto:[email protected]]
Sent: Saturday, September 01, 2007 9:46 AM
To: [email protected]
Subject: Re: Pluto 1.1.4 - java.lang.InstantiationException while deploying

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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.