0 Replies Latest reply on Dec 15, 2001 10:37 PM by Toby Hede

    FinderException: InputStream does not contain a serialized o

    Toby Hede Newbie

      Using JBoss 3.0 and MySQL I get the following error in my custom Finder (findByUsername)

      java.rmi.ServerException: Finder failed: ; nested exception is: javax.ejb.EJBException: Internal error getting results for field member id: java.sql.SQLException: Unable to load to deserialize result: java.io.StreamCorruptedException: InputStream does not contain a serialized object
      [2001-12-16 13:51:01,747,Default,ERROR] javax.ejb.EJBException: Internal error getting results for field member id: java.sql.SQLException: Unable to load to deserialize result: java.io.StreamCorruptedException: InputStream does not contain a serialized object

      I have a custom primary key for my User CMP object and the problem seems to be related to my primary key class, because I can change the cmp field to java.lang.String and everything will work fine, the finder returns the user by username and all my Tests run through.

      My bean class defines the pk as the custom class:

      public abstract UniqueID getId();
      public abstract void setId(Unique id);

      The PK class is defined as below:

      public class UniqueID implements java.io.Serializable
      {

       public String id;

       public UniqueID() throws DataTypeException {
          this.id = makeID();
       }

       public String makeID() {
          Do Stuff . . .
       }
      )

      And the relevant ejb-jar.xml parts are defined:

      <primkey-field>id</primkey-field>
      <prim-key-class>java.lang.String</prim-key-class>
      <cmp-field>
          <![CDATA[Unique Id of this Account.]]>
          <field-name>id</field-name>
      </cmp-field>


        <query-method>
          <method-name>findByUsername</method-name>
          <method-params>
              <method-param>java.lang.String</method-param>
          </method-params>
          </query-method>
        <ejb-ql>SELECT OBJECT(ua) FROM UserAccount ua WHERE ua.username=?1</ejb-ql>



      And in jbosscmp-jdbc.xml:

      <cmp-field>
        <field-name>id</field-name>
        <column-name>account_id</column-name>
        <sql-type>VARCHAR(36)</sql-type>
        <jdbc-type>VARCHAR</jdbc-type>
      </cmp-field>

      Any ideas? have I missed something obvious here?