You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Joe Sulewski <jo...@cobre.com> on 2002/07/13 04:33:27 UTC

Interesting problem deploying a portlet

Hello,

I'm new to jetspeed so please bare with me. I created and successfully 
deployed the sample HelloPortlet example from the documentation. I added 
it to my classpath and everything worked fine. But when I try to change 
it by making it create a class in my classpath I get the following text 
in my portlet:

org.apache.turbine.util.TurbineException: Error rendering Velocity 
template: /controls/html/jetspeed.vm: Invocation of method 'getContent' 
in class mysite.com.portlets.MyPortlet threw exception class 
java.lang.NoClassDefFoundError

I'm running Tomcat 4.03 with Jdk1.3.1_03 on a Windows 2000 system. I 
didn't copy my class to jetspeeds web-inf/classes directory. Instead I 
jar'ed my classes into a jar file and put the jar file in:

c:\jakarta-tomcat-4.0.3\webapps\jetspeed\WEB-INF\lib

I looked at the jar file with winzip and I see my .class files. And if I 
take the code that creates an instance of my own class out it works just 
fine. But the moment I create my own class, whamo! I get the above 
message. So my question is as follows, how do I make Jetspeed see my own 
classes.

Thanks for any help in this matter,
Joe

ps I did try copying my class directory structure to 
c:\jakarta-tomcat-4.0.3\webapps\jetspeed\WEB-INF\classes and removed my 
jar file from the lib and the same problem happened.

If it helps here is my code:
package mysite.com.portlets;

import org.apache.jetspeed.portal.portlets.AbstractPortlet;
import org.apache.turbine.util.RunData;
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.StringElement;

/**
 *
 * @author  administrator
 */
public class F1LivePortlet extends AbstractPortlet{
   
    public ConcreteElement getContent (RunData runData)
    {
        mysite.com.portlets.MyPortlet 
myPortlet=mysite.com.portlets.MyPortlet();
        //return (new StringElement(myPortlet.getContent());
        return (new StringElement ("Hello World"));
    }
}

<?xml version="1.0" encoding="UTF-8"?>
<registry>
    <portlet-entry name="MyPortlet" hidden="false" type="instance" 
application="false">
        <meta-info>
            <title>My Portlet</title>
            <description>Sample of my Portlet</description>
        </meta-info>
        <classname>mysite.com.portlets.MyPortlet</classname>
        <media-type ref="html"/>
    </portlet-entry>
</registry>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Interesting problem deploying a portlet

Posted by Joe Sulewski <jo...@cobre.com>.
I figured out my problem. I was compiling with jdk1.4 and running with 
jdk1.3

Joe


Joe Sulewski wrote:

> Hello,
>
> I'm new to jetspeed so please bare with me. I created and successfully 
> deployed the sample HelloPortlet example from the documentation. I 
> added it to my classpath and everything worked fine. But when I try to 
> change it by making it create a class in my classpath I get the 
> following text in my portlet:
>
> org.apache.turbine.util.TurbineException: Error rendering Velocity 
> template: /controls/html/jetspeed.vm: Invocation of method 
> 'getContent' in class mysite.com.portlets.MyPortlet threw exception 
> class java.lang.NoClassDefFoundError
>
> I'm running Tomcat 4.03 with Jdk1.3.1_03 on a Windows 2000 system. I 
> didn't copy my class to jetspeeds web-inf/classes directory. Instead I 
> jar'ed my classes into a jar file and put the jar file in:
>
> c:\jakarta-tomcat-4.0.3\webapps\jetspeed\WEB-INF\lib
>
> I looked at the jar file with winzip and I see my .class files. And if 
> I take the code that creates an instance of my own class out it works 
> just fine. But the moment I create my own class, whamo! I get the 
> above message. So my question is as follows, how do I make Jetspeed 
> see my own classes.
>
> Thanks for any help in this matter,
> Joe
>
> ps I did try copying my class directory structure to 
> c:\jakarta-tomcat-4.0.3\webapps\jetspeed\WEB-INF\classes and removed 
> my jar file from the lib and the same problem happened.
>
> If it helps here is my code:
> package mysite.com.portlets;
>
> import org.apache.jetspeed.portal.portlets.AbstractPortlet;
> import org.apache.turbine.util.RunData;
> import org.apache.ecs.ConcreteElement;
> import org.apache.ecs.StringElement;
>
> /**
> *
> * @author  administrator
> */
> public class F1LivePortlet extends AbstractPortlet{
>      public ConcreteElement getContent (RunData runData)
>    {
>        mysite.com.portlets.MyPortlet 
> myPortlet=mysite.com.portlets.MyPortlet();
>        //return (new StringElement(myPortlet.getContent());
>        return (new StringElement ("Hello World"));
>    }
> }
>
> <?xml version="1.0" encoding="UTF-8"?>
> <registry>
>    <portlet-entry name="MyPortlet" hidden="false" type="instance" 
> application="false">
>        <meta-info>
>            <title>My Portlet</title>
>            <description>Sample of my Portlet</description>
>        </meta-info>
>        <classname>mysite.com.portlets.MyPortlet</classname>
>        <media-type ref="html"/>
>    </portlet-entry>
> </registry>
>
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>