facebook

[Closed] Hot Deploy produces ClassCastException every time?

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #251472 Reply

    harryajh
    Member

    Using ME 4.1.1 GA, Eclipse 3.1, weblogic 8.1 (sp3), struts 1.2.7 on win 2000 (sp4)

    I have a simple Struts based web component – whenever I make a change to any java code, save & refresh the web page I always get –

    <02-May-2006 16:10:32 o’clock BST> <Error> <HTTP> <BEA-101020> <[ServletContext(id=12584614,name=HWInt,context-path=/HWInt)] Servlet failed with Exception
    java.lang.ClassCastException
    at org.apache.struts.action.ActionServlet.getProcessorForModule(ActionServlet.java:622)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1190)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    ………………………………….

    I have to redeploy the web component after EVERY change to test – this can’t be right!

    any idea what might be wrong?

    thanks

    harry

    #251473 Reply

    harryajh
    Member

    ah ha, thought I’d seen this before – In a prevoius thread I had exactly the same thing & solved it by putting –

    <container-descriptor>
    <servlet-reload-check-secs>-1</servlet-reload-check-secs>
    </container-descriptor>

    in weblogic.xml – works fine now!

    Sorry!!!!!!!!!!!!!!!!!!

    #251680 Reply

    Riyad Kalla
    Member

    No worries, thanks for following up.

    #251778 Reply

    boxhead
    Member

    I am having the same problem. Setting the servet-reload-check-secs effectively disables hot deployment. The problem is stemming from the fact that Weblogic is trying to get stuff out of the servlet context, causing a ClassCastException. The only way around this is by redeploying. Is there a way to force MyEclipse to write the REDEPLOY file out to weblogic in situations like this?

    Here is the code that duplicates that problem:

    package com.lehman.test;

    import java.io.IOException;

    public class TestServlet extends HttpServlet {

    /**
    * The doGet method of the servlet. <br>
    *
    * This method is called when a form has its tag value method equals to get.
    *
    * @param request the request send by the client to the server
    * @param response the response send by the server to the client
    * @throws ServletException if an error occurred
    * @throws IOException if an error occurred
    */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

    response.setContentType(“text/html”);
    PrintWriter out = response.getWriter();
    out.println(“<!DOCTYPE HTML PUBLIC \”-//W3C//DTD HTML 4.01 Transitional//EN\”>”);
    out.println(“<HTML>”);
    out.println(” <HEAD><TITLE>A Servlet</TITLE></HEAD>”);
    out.println(” <BODY>”);
    out.print(” This is “);
    out.print(this.getClass());

    TestObject obj=(TestObject) getServletContext().getAttribute(“test”);

    if (obj==null)
    {
    obj=new TestObject();
    getServletContext().setAttribute(“test”,obj);
    out.println(“<BR>Created a new TestObject instance”);
    }

    out.println(“<BR>obj=”+obj);

    out.println(“<BR>M1”);
    out.println(“<BR>M2”);
    out.println(“<BR>M3″);

    out.println(” </BODY>”);
    out.println(“</HTML>”);
    out.flush();
    out.close();

    }

    }

    package com.lehman.test;

    public class TestObject {

    }

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app version=”2.4″
    xmlns=”http://java.sun.com/xml/ns/j2ee&#8221;
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”&gt;
    <servlet>
    <description>This is the description of my J2EE component</description>
    <display-name>This is the display name of my J2EE component</display-name>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>com.lehman.test.TestServlet</servlet-class>
    </servlet>

    <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/servlet/TestServlet</url-pattern>
    </servlet-mapping>

    </web-app>

    #251779 Reply

    Riyad Kalla
    Member

    I believe WL just checks the timestamp on the REDEPLOY file, in that case in MyEclipse use File > Open External File and open that file and every time you make changes, add a space then remove the space and save that REDEPLOY file.

    Currently we likely won’t make app-server specific changes to the deployers but moving forward we are looking at adopting the WTP connectors if they offer benefits to our users, that that may be a possiliblity.

    #251780 Reply

    boxhead
    Member

    Opening the REDEPLOY file and manually touching it is the same thing as clicking on the redeploy button in the myeclipse application deployer. What I am looking for is a way of automatically deploying applications without having to click on a button or touching a file.

    I don’t understand what you mean by not modifying your deployers with app-server specific stuff. It seems you guys already have many app-server specific deployers. Adding code to support the REDEPLOY file seems to be trivial because it appears you already have a weblogic specific deployer, and all you need to do is write a file out.

    I was hoping you guys would have this because I do not want to resort to creating my own eclipse builder that just does this. I also think that hot deploy is almost useless without being able to support this.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: [Closed] Hot Deploy produces ClassCastException every time?

You must be logged in to post in the forum log in