1 Reply Latest reply on Nov 12, 2007 10:19 AM by pmuir

    ClassCast Exception when trying to get a Seam Managed Statef

    griffitm

      Hi All,

      I am getting this error when trying to get a seam managed component from a servlet.

      java.lang.ClassCastException: org.javassist.tmp.java.lang.Object_$$_javassist_0
       at action.gov.hhs.fda.ocio.fdaaa.servlet.ExcelExportServlet.service(ExcelExportServlet.java:42)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


      The offending line in the servlet looks like this:
      DeliverableSearchAction searchAction = (DeliverableSearchAction) Component.getInstance("deliverableSearch");


      The component is defined as:
      @Stateful
      @Name("deliverableSearch")
      @Scope(ScopeType.SESSION)
      public class DeliverableSearchAction implements DeliverableSearch, Serializable { ...
      


      I have the following mapping in my components.xml file:
      <web:context-filter url-pattern="/excel"/>


      I have the following servlet mapping in my web.xml:
       <servlet>
       <servlet-name>Excel Export Servlet</servlet-name>
       <servlet-class>action.gov.hhs.fda.ocio.fdaaa.servlet.ExcelExportServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Excel Export Servlet</servlet-name>
       <url-pattern>/excel</url-pattern>
       </servlet-mapping>
      


      Can anyone point out what I am doing wrong? I'd simply like to get a reference to the seam managed bean so I can get my data from it and export it in Excel format using POI.

      Any help would be much appreciated!

      MG