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!

3 comments:

  1. Hello people! Professional college essay writers from https://essaysrescue.com/samedayessay-review/ will always provide you with high-quality support from the best authors you will find on the Internet. They work closely with you to provide the highest quality that includes all of the following

    ReplyDelete
  2. Your posts are always so well-written and thoughtful. Keep them coming. Check this Geometry World profile for meaningful advice and fresh insights now. Geometry Dash World features fast-paced levels and rhythmic gameplay, perfect for players looking for quick gaming fun.

    ReplyDelete