[jboss-jira] [JBoss JIRA] (JBASMP-61) NoClassDefFoundError in shutdown hook
Paris Apostolopoulos (JIRA)
issues at jboss.org
Sun Feb 16 14:07:47 EST 2014
[ https://issues.jboss.org/browse/JBASMP-61?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12945039#comment-12945039 ]
Paris Apostolopoulos commented on JBASMP-61:
--------------------------------------------
I have reproduced it as well. The strange thing is the following:
If i widlfly:start with no jboss.Home property, which means it downloads a fresh zip (for the very first time), the server is initialized and then shut down ,everything seems to work fine, along with the Maven lifecycle.
If i wildfly:start again including a local to my compulter jboss.home (a freshly unzipped, untouched) archive, I get the exact same error.
the server is not running in any case but my terminal can not exist(!!!).
Jdk7, MacOSX
> NoClassDefFoundError in shutdown hook
> -------------------------------------
>
> Key: JBASMP-61
> URL: https://issues.jboss.org/browse/JBASMP-61
> Project: JBoss AS Maven Plugins
> Issue Type: Bug
> Affects Versions: 7.5.Final
> Environment: Maven 3.1.1, Oracle JDK 1.7.0_45.
> Reporter: Vlad Arkhipov
> Assignee: James Perkins
>
> {code} <build>
> <plugins>
> <plugin>
> <groupId>org.jboss.as.plugins</groupId>
> <artifactId>jboss-as-maven-plugin</artifactId>
> <version>7.5.Final</version>
> <executions>
> <execution>
> <id>start-jboss</id>
> <goals>
> <goal>start</goal>
> </goals>
> <phase>package</phase>
> <configuration>
> <jbossHome>/home/user/jboss</jbossHome>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>{code}
> If jbossHome is specified, the following exception occurs
> {code}Exception in thread "Thread-2" java.lang.NoClassDefFoundError: org/jboss/as/plugin/common/IoUtils
> at org.jboss.as.plugin.server.StandaloneServer.stopServer(StandaloneServer.java:77)
> at org.jboss.as.plugin.server.Server.stop(Server.java:108)
> at org.jboss.as.plugin.server.SecurityActions$1.run(SecurityActions.java:41)
> at java.lang.Thread.run(Thread.java:724)
> Caused by: java.lang.ClassNotFoundException: org.jboss.as.plugin.common.IoUtils
> at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
> at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
> at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
> at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227){code}
> The reason is that in the shutdown hook the class loader is already closed by Maven and cannot be used to load new classes. DefaultPlexusContainer.dispose() disposes plugins' ClassRealms and closes associated URLClassLoaders (if Java version is 7+).
> {code}ClassRealm(URLClassLoader).close() line: 282
> ClassWorld.closeIfJava7(ClassRealm) line: 113
> ClassWorld.disposeRealm(String) line: 97
> DefaultPluginRealmCache.flush() line: 189
> DefaultPluginRealmCache.dispose() line: 216
> PlexusLifecycleManager.dispose(Disposable) line: 408
> PlexusLifecycleManager.unmanage() line: 193
> DefaultPlexusContainer.dispose() line: 586
> MavenCli.doMain(MavenCli$CliRequest) line: 241
> MavenCli.main(String[], ClassWorld) line: 158 {code}
> As a temporary workaround you can either preload IoUtils class somewhere before Maven shutdowns (which is brittle) or "respawn" the current classloader in shutdown hook (which is hacky and brittle too).
> Shutdown hooks should be avoided in plugins as Maven documentation says:
> http://maven.apache.org/plugin-developers/common-bugs.html#Using_Shutdown_Hooks.
> But it seems there is currently no way to handle Maven shutdown event in a plugin, isn't it?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list