2010-05-10

JBoss java.io.InvalidClassException: org.jboss.security.auth.callback.SecurityAssociationHandler; class invalid for deserialization

Just in case someone got this error:

java.io.InvalidClassException:
org.jboss.security.auth.callback.SecurityAssociationHandler;
org.jboss.security.auth.callback.SecurityAssociationHandler;
class invalid for deserialization
(Line breaks added for readability).

I got this when deploying an EJB3 application that uses Hibernate 3 to JBoss Application Server version 5.1.0.GA. It also said:

Exception in thread "main"
java.lang.RuntimeException:
failed on MarshalledValue
(Line breaks added for readability).

Semi-useful, if you're in a mood for euphemisms.


The problem


Image unrelated

JBossSX (which is a security framework) is a dependency coming from my jboss-as-ejb3 dependency (it's a Maven project that I'm creating).

jboss-as-ejb3 mixes up its jbosssx dependencies - it asks for 3 different versions (2.0.2.SP1, 2.0.2.SP2, 2.0.3.SP1). The earlier versions are known to have caused problems.


The fix


Therefore I decided to overwrite those Maven dependencies with my own. In other words, in my pom.xml, I added this:

        <dependency>
            <groupId>org.jboss.security</groupId>
            <artifactId>jbosssx</artifactId>
            <version>2.0.3.SP1</version>
        </dependency>

It is explicitly provided by me and overrules the other ones. Fixed!


JBoss 5, EJB3 + Hibernate Maven pom.xml


That's the entire pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>nl.novadoc.sample</groupId>
    <artifactId>ejb</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>ejb Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.jbossas</groupId>
            <artifactId>jboss-as-ejb3</artifactId>
            <version>5.1.0.GA</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.security</groupId>
            <artifactId>jbosssx</artifactId>
            <version>2.0.3.SP1</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>hibejb</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>jboss-maven2</id>
            <url>http://repository.jboss.com/maven2</url>
        </repository>
    </repositories>
</project>

I hope this helps if someone is in need.

I am studying Hibernate using this book: Java Persistence with Hibernate
It helps me run this website if you purchase this book using this link. Thanks!

1 comment:

  1. Great Article android based projects

    Java Training in Chennai

    Project Center in Chennai

    Java Training in Chennai

    projects for cse

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete