Uploaded image for project: 'PicketLink'
  1. PicketLink
  2. PLINK-687

Producer DefaultIdentity not serializable exception

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • PLINK_2.7.0.Final
    • PLINK_2.7.0.CR2, PLINK_2.7.0.CR3
    • IDM
    • None

      we use wildfly 8.2. with session failover (domain mode) and picketlink 2.7.0.CR2. We @Inject an instance of Identity into our @Sessionscoped bean (JSF layer),

      Infinispan then tries to serialize the session data but fails with the following error:

      Caused by: org.infinispan.commons.marshall.NotSerializableException: org.jboss.weld.injection.producer.BeanInjectionTarget
      Caused by: an exception which occurred:
      in field injectionTarget
      in field serializable
      in field holder
      in field contextual
      in object java.util.HashMap@2e33ba80
      in object org.jboss.as.clustering.marshalling.SimpleMarshalledValue@2e33ba80

      After some digging into wildfly and picketlink source we could finally hunt it down to the change in PLINK-571

      Picketlink Extension (see PicketLinkExtension) defines the producer for DefaultIdentity as follows:
      /**

      • <p>Initializes the PicketLink configuration.</p>
        *
      • @param abd
      • @param beanManager
        */
        void installIdentityBean(@Observes AfterBeanDiscovery abd, BeanManager beanManager) { this.identityBeanDefinition = new IdentityBeanDefinition(beanManager); abd.addBean(identityBeanDefinition); }

      The non serializable field is then defined in the producer as follows:

      public class IdentityBeanDefinition implements Bean<DefaultIdentity>, Serializable, PassivationCapable {

      private static final long serialVersionUID = -4725126763788040967L;

      private final BeanManager beanManager;
      private final InjectionTarget<DefaultIdentity> injectionTarget; <- this one
      private SecurityConfiguration securityConfiguration;

      ...

      @Override
      public DefaultIdentity create(CreationalContext<DefaultIdentity> creationalContext)

      { DefaultIdentity identity = this.injectionTarget.produce(creationalContext); this.injectionTarget.inject(identity, creationalContext); this.injectionTarget.postConstruct(identity); return identity; }

      We found out that picketlink compiles against Weld 1.1. but wildfly uses 2.x and therefore a different version of the CDI API.
      Are there any changes this could effect the process of Serialization? Actually the code from above (the producer) pretty much looks like the weld documentation recommends it.

      Our workaround is to deactivate the part of bean creation in the Extension and delete the class IdentityBeanDefinition.

      Finally create our own Producer for the session scope like
      @Produces @SessionScoped

      After that serialization works perfectly.

            psilva@redhat.com Pedro Igor Craveiro
            zerounix_jira Daniel Klotz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: