[jboss-jira] [JBoss JIRA] (AS7-3229) OptionalDataException failure during deserialization of nested bean

Scott Marlow (JIRA) jira-events at lists.jboss.org
Sat Jan 14 13:03:19 EST 2012


    [ https://issues.jboss.org/browse/AS7-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659412#comment-12659412 ] 

Scott Marlow commented on AS7-3229:
-----------------------------------

Made progress on reducing the test down to a smaller test that still fails (playing on https://github.com/scottmarlow/jboss-as/tree/cluster9_hacktest).  Will divide conquer some more to reduce further.  After removing the XPC from the test, I still could reproduce the "java.lang.IllegalArgumentException: object is not an instance of declaring class" (that seemed to occur more often).  By success, I mean that three consecutive test runs, passed.

The following passes (the second clustered bean is not injected anymore which made the difference).  I will add the XPC back in and if that works, will inject the second bean but try not tagging the second bean as clustered.
{code}
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2011, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.as.test.clustering.unmanaged.ejb3.xpc.bean;

import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

import org.jboss.ejb3.annotation.Clustered;

/**
 * @author Paul Ferraro
 * @author Scott Marlow
 */
@Clustered
@javax.ejb.Stateful(name = "StatefulBean")

public class StatefulBean implements Stateful {

//    @PersistenceContext(unitName = "mypc", type = PersistenceContextType.EXTENDED)
//        EntityManager em;

     //@EJB
     SecondBean secondBean;

     private volatile Object share = null;

    /**
     * Create the employee but don't commit the change to the database, instead keep it in the
     * extended persistence context.
     *
     * @param name
     * @param address
     * @param id
     */
    @Override
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public void createEmployee(String name, String address, int id) {

        Employee emp = new Employee();
        emp.setId(id);
        emp.setAddress(address);
        emp.setName(name);

        //em.persist(emp);
        share = emp;
    }

    @Override
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public Employee getEmployee(int id) {
        //return em.find(Employee.class, id, LockModeType.NONE);
        return (Employee)share;
    }

    @Override
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public Employee getSecondBeanEmployee(int id) {
        //secondBean.share(share);
        //return secondBean.getEmployee(id);
        return (Employee)share;
    }

}
{code}
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.as.test.clustering.unmanaged.ejb3.xpc.bean;

import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

import org.jboss.ejb3.annotation.Clustered;

/**
 * test bean that uses the same extended persistence context as StatefulBean and therefor should always be able to
 * retrieve the same entities that are only in the extended persistence context (purposely not persisted to the database).
 *
 * @author Scott Marlow
 */
@Clustered
@javax.ejb.Stateful
public class SecondBean {
//    @PersistenceContext(unitName = "mypc", type = PersistenceContextType.EXTENDED)
//        EntityManager em;

    Object sharedObject = null;

    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public Employee getEmployee(int id) {
        //return em.find(Employee.class, id, LockModeType.NONE);
        return (Employee)sharedObject;
    }

    public void share(Object shared) {
        this.sharedObject = shared;
    }
}
{code}

{code}
                
> OptionalDataException failure during deserialization of nested bean
> -------------------------------------------------------------------
>
>                 Key: AS7-3229
>                 URL: https://issues.jboss.org/browse/AS7-3229
>             Project: Application Server 7
>          Issue Type: Sub-task
>          Components: Clustering
>            Reporter: Scott Marlow
>            Assignee: Scott Marlow
>            Priority: Blocker
>             Fix For: 7.1.0.Final
>
>         Attachments: firstcall.txt, firstcall.txt, firstcall.txt, seconcall.txt, secondcall.txt, secondcall.txt
>
>
> Test case branch link is coming (I need to recreate it without the Hibernate 4.0.1-SNAPSHOT dependency).
> The bug didn't recreate with the simple test https://github.com/scottmarlow/jboss-as/commits/AS7-3229.  Might need to push the XPC serialization changes before it can be recreated.
> Exception call stack http://pastie.org/3155867

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list