You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Wayne Holder (JIRA)" <pl...@jakarta.apache.org> on 2005/01/26 19:38:18 UTC

[jira] Created: (PLUTO-101) ClassCastException in PortletServlet.init()

ClassCastException in PortletServlet.init()
-------------------------------------------

         Key: PLUTO-101
         URL: http://issues.apache.org/jira/browse/PLUTO-101
     Project: Pluto
        Type: Bug
  Components: portlet container  
    Versions: 1.0.1-rc2    
 Environment: Windows 2000, SP4 with  Java 1.5
    Reporter: Wayne Holder
    Priority: Blocker


After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:

  portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();

I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.

As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:

  public void init (ServletConfig config) throws ServletException {
    super.init(config);
    portletInitialized = false;
    String classString = config.getInitParameter("portlet-class");
    try {
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      System.out.println("ClassLoader.toString(): " + loader);
      System.out.println("classString: " + classString);
      Class pClass = loader.loadClass(classString);
      System.out.println("pClass: " + pClass);
      Object pObj = pClass.newInstance();
      System.out.println("pObj.getClass(): " + pObj.getClass());
      System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
      portletClass = (javax.portlet.Portlet) pObj;
      //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
      ...

and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.

When I then access the portlet in the wfh app I get a traces like this in the console:

ClassLoader.toString(): WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@30d82d

classString: com.nglm.fwk.sys.TestPortletWFH
pClass: class com.nglm.fwk.sys.TestPortletWFH
  implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
pObj instanceof javax.portlet.Portlet: false         <--- ???
- StandardWrapper.Throwable
java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
        at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)

which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:

ClassLoader.toString(): WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@30d82d

classString: com.nglm.fwk.sys.TestPortletWFH
pClass: class com.nglm.fwk.sys.TestPortletWFH
  implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
pObj instanceof javax.portlet.Portlet: true

So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.

BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.

Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Nick Lothian (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=history ]

Nick Lothian updated PLUTO-101:
-------------------------------

    Priority: Major  (was: Blocker)

Changing priority to major, since we know this works for most people

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Wayne Holder (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58682 ]
     
Wayne Holder commented on PLUTO-101:
------------------------------------

I don't know if anyone elase cares about this issues (even through it's been bugging me), but here's some more info.  First, in my post just prior to this one I stated that I had solved the problem by moving the portlet-api-1.0.jar file from  \shared\lib\ to  \common\endorsed\.  Even though this got me to the point where I could run my portlet, the "fix" still bugged me and I wanted to understand what was going on.  Ultimately, I discovered that the real cause was a conflict was a duplicate copy of the class files that define the portlet interface.  One set was contained in portlet-api-1.0.jar and another was being included in my web app by my development tool when it built the deployed .war file.

Note: one of the first replies I got to my original post by Nick Lothian had warned me to be careful that there were not multiple copies of the pluto.jar file.  I assumed he was referring to the file pluto-1.0.1-rc2.jar, which is also placed at \shared\lib\ by the RC2 build.  I replied that there was only one copy of this file but, perhaps Nick meant to check for exactly what I've now determined.  If so, I'd have saived myself a lot of pain if I'd crrectly understood his suggestion.

In any case, because of the placement of portlet-api-1.0.jar at \shared\lib\ it's possible for Tomcat to load multiple copies of the portlet interfaces classes (in this case Portlet.class) if your web app also includes a copy of these classes.  In my case, my development tool needed the classes to compile my portlet code but then also packaged the jar with these classes into the deployed .war file.  Once I changed the build script to exclude adding the jar file with the portlet classes, and moved portlet-api-1.0.jar back to \shared\lib\, everything worked as it should.

Wayne

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Wayne Holder (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58272 ]
     
Wayne Holder commented on PLUTO-101:
------------------------------------

As to cross context, yes, my server.xml file has <context/> tags with crossContext="true" for the three web apps I have active, /pluto, /testsuite/ and /wfh (which is the new web app I'm trying to make work.)

The only other information I can add is that, to get this to work as much as it does, I've had to manually add in the extra items into my apps web.xml file, as the Deploy class just does not work (details below.)  Also, it took some analysis to discover that I needed to add my web apps name to the portletcontexts.txt file, as the purpose of this file is not documented anywhere I can see.  But, until I added an entry for /wfh I got another exception.

It would be nice to know exactly what preconditions are required to configure a web app to run under pluto using the deployed configuration rather than to have to rely on a deploy class that that doesn't seem to work.

So, if someone can check me on this and verify that I'm correct; to make my portlet run under pluto, I added this servlet tag into my wfh web app's web.xml:

  <servlet>
    <servlet-name>TestPortlet</servlet-name>
    <display-name>TestPortlet Wrapper</display-name>
    <description>Automated generated Portlet Wrapper</description>
    <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
    <init-param>
      <param-name>portlet-class</param-name>
      <param-value>com.nglm.fwk.sys.TestPortlet</param-value>
    </init-param>
    <init-param>
      <param-name>portlet-guid</param-name>
      <param-value>wfh.TestPortlet</param-value>
    </init-param>
  </servlet>

and then I added this mapping, too:

  <servlet-mapping>
    <servlet-name>TestPortlet</servlet-name>
    <url-pattern>/TestPortlet/*</url-pattern>
  </servlet-mapping>

and, for reference, the tags in portlet.xml that match up with this are as follows:

  <portlet>
    <description>WebFH Test Portlet</description>
    <portlet-name>TestPortlet</portlet-name>
    <display-name>WebFH Test Portlet</display-name>
    <portlet-class>com.nglm.fwk.sys.TestPortlet</portlet-class>
    <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>VIEW</portlet-mode>
    </supports>
    <supported-locale>en</supported-locale>
    <expiration-cache>-1</expiration-cache>
  	<portlet-info>
      <title>WFH Test Portlet</title>
      <short-title>WFHPTest</short-title>
      <keywords>Test, Testen</keywords>
    </portlet-info>
  </portlet>


BTW, I added exactly these same mapping into testsuite and was able to get my portlet to run there (still doess, too).  My problems only began when I tried to create the new wfh web app containing exactly the same portlet.

Now, as to trying to use Deploy, after compiling the source to get access to this class, I tried to run it in the hope it might configure some missing attribute I was missing that was, perhaps, the cause of the ClassCastException.  But, even after giving Deploy all the needed arguments and paths, it always throws this exception inside the prepareWebArchive() method:

deploying 'wfh' ...
finished!
prepare web archive 'wfh' ...
[Castor] Failed to locate messages resource org.exolab.castor.util.resources.messages
CASTOR-Exception: org.exolab.castor.mapping.MappingException: [Missing message mapping.nested]
java.io.IOException: Failed to load mapping file C:\Pluto-RC2\webapps\pluto\WEB-INF\data\xml\portlet
definitionmapping.xml
        at org.apache.pluto.portalImpl.Deploy.prepareWebArchive(Deploy.java:165)
        at org.apache.pluto.portalImpl.Deploy.main(Deploy.java:523)

But, the file at the path displayed:

  C:\Pluto-RC2\webapps\pluto\WEB-INF\data\xml\portletdefinitionmapping.xml

does exist, and I can open it and read it.  So, not clear on why this exception is happening.  But, any help would be appreciated.  Thanks.

Wayne

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "David DeWolf (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=history ]
     
David DeWolf resolved PLUTO-101:
--------------------------------

    Resolution: Won't Fix

I've been playing with different ideas on how we can remove the necessity of placing all container dependencies (not just the portlet-api-xx.jar) in a common/lib or similar directory and instead just place them in the portal driver's webapp. Unfortunately the only solutions I've come up with involve either some classloader magic which would go against the servlet-spec by programmatically modifying the app servers context class loader or by adding container specific logic.  I'm not happy with either approach.

Until someone comes up with a better solution (or we decide as a whole to support multiple implementations of container specific logic - uck!), this annoyance will have to remain.  If someone has any bright ideas, please let me know.

FWIW, when using an app server which supports ear deployments, you *can* package the dependencies as a shared library within the ear instead of in the app servers common classpath (which will allow visibility by ALL apps).

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Wayne Holder (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58565 ]
     
Wayne Holder commented on PLUTO-101:
------------------------------------

Solution found!!

After some experimentation, I discovered that the solution was to simply move the portlet-api-1.0.jar from

  \shared\lib\

to:

  \common\endorsed\

I'm not sure this is the optimal place for this jar, but I think it does demonstrate the the core issue is some kind of problem with how the classloaders are being used.

Wayne

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Wayne Holder (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58343 ]
     
Wayne Holder commented on PLUTO-101:
------------------------------------

For what it's worth, I upgraded to Tomcat 5.5.7, and rebuilt all the related files to see if this might fix the problem with the ClassCastException, but no luck.  Still happens.  As before, the portlet runs fine if I add it into testsuite, but not when I deploy it in its own web app.  Very strange.

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Wayne Holder (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58190 ]
     
Wayne Holder commented on PLUTO-101:
------------------------------------

AS a follow on, I added in the compat jar files so I could run RC2 under Java 1.4.2 (was previously using Java 1.5, as required by the default config of the RC2 download), but to no effect.  The ClassCastException still happens under 1.4.2, as under 1.5.0.  I plan to try using Tomcat 5.0 instead of the included Tomcat 5.5 when time permits.

Wayne

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder
>     Priority: Blocker

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Nick Lothian (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58143 ]
     
Nick Lothian commented on PLUTO-101:
------------------------------------

Can you check that there are no extra copies of the pluto jars in unexpected locations?

There should be only one copy of pluto.jar in tomcat

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder
>     Priority: Blocker

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-101) ClassCastException in PortletServlet.init()

Posted by "Nick Lothian (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-101?page=comments#action_58253 ]
     
Nick Lothian commented on PLUTO-101:
------------------------------------

Have you turned on cross context dispatching for your portlet?

> ClassCastException in PortletServlet.init()
> -------------------------------------------
>
>          Key: PLUTO-101
>          URL: http://issues.apache.org/jira/browse/PLUTO-101
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>  Environment: Windows 2000, SP4 with  Java 1.5
>     Reporter: Wayne Holder
>     Priority: Blocker

>
> After downloading rc2 and installing it to run using Java 1.5, I created a new web app named wfh which contianed a portlet named TestPortletWFH but, when I tried to run it, I always got a ClassCastException in PortletServlet.init() on this line of code:
>   portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
> I then moved the same portlet into the testSuite app and, after making the needed adjustments to the XML, founf that it ran fine there, but not in the wfh app.  Note: I changed portletcontexts.txt to include a path to wfh along with the path to testsuite.
> As I was unable to easily debug the code, I decided to rebuild rc2 from source, changing the code in PortletServlet.init(), as follows:
>   public void init (ServletConfig config) throws ServletException {
>     super.init(config);
>     portletInitialized = false;
>     String classString = config.getInitParameter("portlet-class");
>     try {
>       ClassLoader loader = Thread.currentThread().getContextClassLoader();
>       System.out.println("ClassLoader.toString(): " + loader);
>       System.out.println("classString: " + classString);
>       Class pClass = loader.loadClass(classString);
>       System.out.println("pClass: " + pClass);
>       Object pObj = pClass.newInstance();
>       System.out.println("pObj.getClass(): " + pObj.getClass());
>       System.out.println("pObj instanceof javax.portlet.Portlet: " + (pObj instanceof javax.portlet.Portlet));
>       portletClass = (javax.portlet.Portlet) pObj;
>       //portletClass = (javax.portlet.Portlet) Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance();
>       ...
> and a related function, getInterfaces(), that lists the interfaces implemented by the loaded class.
> When I then access the portlet in the wfh app I get a traces like this in the console:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: false         <--- ???
> - StandardWrapper.Throwable
> java.lang.ClassCastException: com.nglm.fwk.sys.TestPortletWFH
>         at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:69)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
> which seems completely illogical since, as you can see, the code reports that the loaded class implements javax.portlet.Portlet, yet the "instanceof javax.portlet.Portlet" test returns false...  To make matters even stranger, running the exact same portlet in testsuite yields this trace:
> ClassLoader.toString(): WebappClassLoader
>   delegate: false
>   repositories:
>     /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@30d82d
> classString: com.nglm.fwk.sys.TestPortletWFH
> pClass: class com.nglm.fwk.sys.TestPortletWFH
>   implements: interface javax.portlet.Portlet, interface javax.portlet.PortletConfig
> pObj.getClass(): class com.nglm.fwk.sys.TestPortletWFH
> pObj instanceof javax.portlet.Portlet: true
> So, either my computer has slipped into the twilight zone, or there's something really screwy going on with the classloader, or the JVM.
> BTW, the exact same wfh app runs fine under rc1, so this seems to be a new issue.  It's possible this may be related to Java 1.5, but I've yet to have enough time to delve that deeply into the issue.
> Wayne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira