3 Replies Latest reply on Apr 3, 2007 11:18 AM by William DeCoste

    Help! ClassCastException: $Proxy?? Issue

    Benjamin Seyinbour Expert

      I have spent a whole week trying to solve a problem without success. Frankly, I don't know what else to do except to turn for help here.

      For development:
      JDeveloper
      JbossAS
      Window 2003 Server

      Components:
      Entity bean(AddressEntity.java)
      Session bean(AddressFacade.java)
      Session bean interfaces(AddressFacadeRemote,java, AddressFacadeLocal.java )
      JSF page(create.jsp)
      JSF backing bean (Create.java)

      Deployment:
      foopojo.jar contain POJO and persitence.xml
      fooejb.jar contains Session bean classes and jboss.xml
      odmweb.war contains: jsp files, backing beans, jboss.web, faces-config.xml, web.xml etc.
      odmapp.ear contains: foopojo.jar, fooejb.jar, fooweb.war, application,xml and jboss-app.xml


      application.xml contains

      <module>
       <web>
       <web-uri>fooweb.war</web-uri>
       <context-root>fooweb</context-root>
       </web>
       </module>
       <module> <ejb>fooejb.jar</ejb> </module>
       <module><ejb>foopojo.jar</ejb> </module>
      </application>
      


      The application is deployed as EAR (fooapp.ear) to jboss-4.2.0.CR1


      I have in my backing bean (Create.java):

      public String addButton_action() {
       try {
      
       //NOTE: addressEntity is property in this class
       addressEntity.setCreatedBy(user.getUserName());
       java.util.Date timestamp = new java.util.Date(System.currentTimeMillis());
       addressEntity.setDateCreated(timestamp);
       addressEntity.setDateLastModified(timestamp);
       addressEntity.setVersion(1);
       addressEntity.setHits(0);
       getAddressFacadeRemote().createEntity(addressEntity);
       info("Address was successfully created.");
       } catch (Exception ex) {
       ex.printStackTrace();
       error(ex.getLocalizedMessage());
       }
       return "address_create";
       }
      
       public AddressFacadeRemote getAddressFacadeRemote() {
       if(this.addressFacadeRemote == null){
       try {
       Context ctx = new InitialContext();
       //NOTE: RemoteJNDIName is "fooapp/AddressFacade/remote" in the session bean AddressFacade;
       //NOTE: Next is Line# 236 as reported in the exception thrown
       this.addressFacadeRemote = (AddressFacadeRemote) ctx.lookup(AddressFacade.RemoteJNDIName);
       }
       catch (NamingException e){
       throw new RuntimeException(e);
       }
       }
       return addressFacadeRemote;
       }
      


      Create.jsp is an input form
      1. I start the page
      2. Fill the form
      3. Click a button to process the data
      4. The system check for error but there is no error to display
      5. The system throws the following error:

      08:49:33,578 ERROR [STDERR] java.lang.ClassCastException: $Proxy117
      08:49:33,593 ERROR [STDERR] at com.xxx.vmo.foo.pojo.address.Create.getAddressFacadeRemote(Create.java:236)
      08:49:33,593 ERROR [STDERR] at com.xxx.vmo.foo.pojo.address.Create.addButton_action(Create.java:846)
      08:49:33,593 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      


      I can't go past this error no matter what I try. I would appreciate, very much, is anyone would help.

      Thanks in advance.