0 Replies Latest reply on May 2, 2007 6:28 PM by drjonesac2

    Can JBoss do it?

    drjonesac2

      Hello All,

      I have recently been saddled with the task of making a servlet application designed for Tomcat work in a JBoss portlet. I have successfully created a portlet for the application and it works as long as I don't try to use any of the previous servlet code. My major problem is the NoClassDefFoundError I get when trying to use reflection in the old code. The second part of my problem is the code we are using requires access from the browser to a servlet to process ajax requests. (I haven't even begun to tackle that one).

      So the first problem. The portlet is a .war file with a basic structure. It has a WEB-INF/lib folder that I put the prior apps .jar file into. I have one class that creates the portlet. All is happy. The portlet uses this doView method:


      protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
       {
       response.setContentType("text/html");
       PrintWriter writer = response.getWriter();
       try{
       PortletRequestDispatcher prd = this.getPortletContext().getRequestDispatcher("/app");
       prd.include(request, response);
       }
       catch(Exception e){
       writer.print("Error Writing Widget:"+e.getStackTrace());
       }
       writer.close();
       }
      


      app is declared in my web.xml and the portlet gets there no problem. The issue is there is a bit of reflection used in a class that the servlet calls. There is where it poops out and I get the NoClassDefFoundError on a class I know exists in the prior app .jar file.

      The googling around I have done suggests it probably has something to do with the way JBoss does class loading but I am at a loss to try and figure out what I need to change to get this to work. If anyone out there has run into a similar situation where reflection wont work inside of a portlet .war file please post your comments.

      On the second issue, how do I access a servlet URL from a browser in a portlet?

      Thanks in advance.