java.lang.NoClassDefFoundError: net/java/ao/Entity
Asked by lamella:

When I try to add a watermark to the word exported by confluence, confluence suddenly throws this exception, I can guarantee that it can work normally before

--------------

This is error code

```
[INFO] [talledLocalContainer] 2022-03-29 09:40:05,882 ERROR [main] [ContainerBase.[Catalina].[localhost].[/confluence]] log Exception sending context initialized event to listener instance of class [com.atlassian.confluence.plugin.PluginFrameworkContextListener]
[INFO] [talledLocalContainer] java.lang.NoClassDefFoundError: net/java/ao/Entity
[INFO] [talledLocalContainer]  at java.lang.ClassLoader.defineClass1(Native Method)
[INFO] [talledLocalContainer]  at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2410)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2194)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1607)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
[INFO] [talledLocalContainer]  at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1927)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.util.BundleClassLoaderAccessor.loadClass(BundleClassLoaderAccessor.java:43)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.factory.OsgiPluginInstalledHelper.loadClass(OsgiPluginInstalledHelper.java:52)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.factory.OsgiPlugin.loadClass(OsgiPlugin.java:209)
[INFO] [talledLocalContainer]  at com.atlassian.activeobjects.plugin.ActiveObjectModuleDescriptor.getEntityClass(ActiveObjectModuleDescriptor.java:190)
[INFO] [talledLocalContainer]  at com.atlassian.activeobjects.plugin.ActiveObjectModuleDescriptor.access$200(ActiveObjectModuleDescriptor.java:43)
[INFO] [talledLocalContainer]  at com.atlassian.activeobjects.plugin.ActiveObjectModuleDescriptor$4.apply(ActiveObjectModuleDescriptor.java:183)
[INFO] [talledLocalContainer]  at com.atlassian.activeobjects.plugin.ActiveObjectModuleDescriptor$4.apply(ActiveObjectModuleDescriptor.java:181)
[INFO] [talledLocalContainer]  at com.google.common.collect.Iterators$6.transform(Iterators.java:785)
[INFO] [talledLocalContainer]  at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47)
[INFO] [talledLocalContainer]  at com.google.common.collect.Iterators.addAll(Iterators.java:358)
[INFO] [talledLocalContainer]  at com.google.common.collect.Sets.newHashSet(Sets.java:276)
[INFO] [talledLocalContainer]  at com.google.common.collect.Sets.newHashSet(Sets.java:259)
[INFO] [talledLocalContainer]  at com.atlassian.activeobjects.plugin.ActiveObjectModuleDescriptor.getEntities(ActiveObjectModuleDescriptor.java:181)
[INFO] [talledLocalContainer]  at com.atlassian.activeobjects.plugin.ActiveObjectModuleDescriptor.init(ActiveObjectModuleDescriptor.java:76)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.factory.UnrecognizedModuleDescriptorServiceTrackerCustomizer.canFactoryResolveUnrecognizedDescriptor(UnrecognizedModuleDescriptorServiceTrackerCustomizer.java:75)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.factory.UnrecognizedModuleDescriptorServiceTrackerCustomizer.addingService(UnrecognizedModuleDescriptorServiceTrackerCustomizer.java:51)
[INFO] [talledLocalContainer]  at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
[INFO] [talledLocalContainer]  at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
[INFO] [talledLocalContainer]  at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
[INFO] [talledLocalContainer]  at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
[INFO] [talledLocalContainer]  at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
[INFO] [talledLocalContainer]  at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.factory.OsgiPluginInstalledHelper.onEnable(OsgiPluginInstalledHelper.java:74)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:407)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:252)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:120)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:97)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.DefaultPluginManager.lambda$enableDependentPlugins$22(DefaultPluginManager.java:1246)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1230)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1215)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1115)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.DefaultPluginManager.lambda$lateStartup$4(DefaultPluginManager.java:652)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63)
[INFO] [talledLocalContainer]  at com.atlassian.plugin.manager.DefaultPluginManager.lateStartup(DefaultPluginManager.java:645)
[INFO] [talledLocalContainer]  at com.atlassian.confluence.plugin.ConfluencePluginManager.lateStartup(ConfluencePluginManager.java:149)
[INFO] [talledLocalContainer]  at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:81)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1858)
[INFO] [talledLocalContainer]  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] [talledLocalContainer]  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] [talledLocalContainer]  at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
[INFO] [talledLocalContainer]  at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:969)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
[INFO] [talledLocalContainer]  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] [talledLocalContainer]  at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
[INFO] [talledLocalContainer]  at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer]  at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
[INFO] [talledLocalContainer]  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
[INFO] [talledLocalContainer]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [talledLocalContainer]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] [talledLocalContainer]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer]  at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
[INFO] [talledLocalContainer]  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: net.java.ao.Entity not found by com.igsl.plugin.watermark-plugin-confluence [290]
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
[INFO] [talledLocalContainer]  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
[INFO] [talledLocalContainer]  at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
[INFO] [talledLocalContainer]  ... 89 more
```

This is the pom file

```
<?xml version="1.0" encoding="UTF-8"?>

<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>

    <parent>
        <groupId>com.atlassian.pom</groupId>
        <artifactId>public-pom</artifactId>
        <version>5.0.24</version>
    </parent>

    <groupId>com.igsl.plugin</groupId>
    <artifactId>watermark-plugin-confluence</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <organization>
        <name>IGSL</name>
        <url>https://www.igsl-group.com/</url>
    </organization>

    <name>watermark-plugin-confluence</name>
    <description>This is the watermark plugin for Atlassian Confluence.</description>
    <packaging>atlassian-plugin</packaging>

<!--    <repositories>-->
<!--        <repository>-->
<!--            <id>com.e-iceblue</id>-->
<!--            <url>https://repo.e-iceblue.cn/repository/maven-public/</url>-->
<!--        </repository>-->
<!--    </repositories>-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.confluence</groupId>
                <artifactId>confluence-plugins-platform-pom</artifactId>
                <version>${confluence.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
<!--        <dependency>-->
<!--            <groupId>e-iceblue</groupId>-->
<!--            <artifactId>spire.doc.free</artifactId>-->
<!--            <version>3.9.0</version>-->
<!--        </dependency>-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>
        <dependency>
            <groupId>com.ctc.wstx</groupId>
            <artifactId>woodstox-osgi</artifactId>
            <version>3.2.1.1</version>
        </dependency>

        <!--         pdf start-->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext-asian</artifactId>
            <version>5.2.0</version>
        </dependency>
        <!--         pdf end-->
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <version>1.2.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.collections</groupId>
            <artifactId>google-collections</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>4.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-json</artifactId>
            <version>${hutool.version}</version>
        </dependency>


        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
            <version>${osgi.javaconfig.version}</version>
        </dependency>
        <!-- OSGi Java Config dependencies -->
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>4.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2-atlassian-1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>confluence-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                    <enableQuickReload>true</enableQuickReload>
                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <!-- Add package to export here -->
                        <Export-Package>com.igsl.plugin.api,</Export-Package>
                        <!-- Add package import here -->
                        <!--                        <Import-Package>org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>-->
                        <Import-Package>
                            org.springframework.osgi.*
                            ;resolution:="optional", org.eclipse.gemini.blueprint.*
                            ;resolution:="optional"
                            ;org.bouncycastle.cms.*;resolution:="optional"
                        </Import-Package>
                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <confluence.version>7.0.5</confluence.version>
        <confluence.data.version>${confluence.version}</confluence.data.version>
        <amps.version>8.0.2</amps.version>
        <plugin.testrunner.version>2.0.2</plugin.testrunner.version>
        <osgi.javaconfig.version>0.2.0</osgi.javaconfig.version>
        <spring.version>4.2.5.RELEASE</spring.version>
        <!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <atlassian.spring.scanner.version>2.1.9</atlassian.spring.scanner.version>
        <hutool.version>5.3.5</hutool.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>
```


Answers:
author: lamella
body: I just rolled back my code and it works fine now, although I still don't know what went wrong


Tags: active-objects

confluence-server

server