1 Reply Latest reply on Feb 4, 2010 5:27 PM by allforjava.allforjava.aol.in

    Customer converter: CNF exception

    allforjava.allforjava.aol.in

      Dear Team,


      Towards Seam documentation defined my custom converter to convert Clob. However it thows


      Caused by java.lang.ClassNotFoundException with message: "adr.portor.converter.ClobConverter"
      
      


      Code snippet


      @Name("clobConverter")
      @Scope(CONVERSATION)
      @Converter
      @BypassInterceptors
      public class ClobConverter implements javax.faces.convert.Converter {
      
           private static final int READ_BUFFER_SIZE = 1024*4;
           
           public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
                
                if (value == null) {
                     return null;
                }
                Clob clob = new ClobImpl(value);
                
                return clob;
           }
      
           public String getAsString(FacesContext arg0, UIComponent arg1, Object value) {
                if (value == null) {
                     return null;
                }
                
                Clob clob = null;
                if (value instanceof Clob) {
                     clob = (Clob)value;
                }else{
                     return null;
                }
                
                StringBuffer sb = new StringBuffer();
                Reader reader;
                try {
                     reader = clob.getCharacterStream();
                     if (reader == null){
                          return null;
                     }
                    char[] charbuf = new char[READ_BUFFER_SIZE];
                    for (int i = reader.read(charbuf); i > 0; i = reader.read(charbuf)) {
                         sb.append(charbuf, 0, i);
                    }
                }catch (IOException e) {
                     e.printStackTrace();
                }catch (SQLException e) {
                     e.printStackTrace();
                }
      
                return sb.toString();
           }
      
      }

        • 1. Re: Customer converter: CNF exception
          allforjava.allforjava.aol.in
          Alternatively, the old way, defining converter in faces-config.xml also throws:

          javax.faces.FacesException: adr.portor.convertor.ClobConverter
          .
          Caused by: java.lang.ClassNotFoundException: adr.portor.convertor.ClobConverter


          For Jboss 5.1 GA the *.java and *.class files are deployed into \WEB-INF\dev folder. However the WEB-INF\classes has *.java files excluding entity classes. Is it way deployment works?