Glassfish: Running in an java.lang.NoSuchMethodError Exception, when porting a Glassfish2 project

Using the default installation with the standard domain “domain1” of a fresh Glassfish3 installation, I deployed an old Entprise project. The project worked perfectly with Glassfish2, but on Glassfish3 I did ran into an java.lang.NoSuchMethodError:

[#|2012-08-07T15:38:25.983+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=20;_ThreadName=Thread-2;|org.apache.commons.collections.MapUtils.putAll(Ljava/util/Map;[Ljava/lang/Object;)Ljava/util/Map;at org.glassfish.apf.AnnotationInfo@cb88c8

java.lang.IllegalStateException: org.apache.commons.collections.MapUtils.putAll(Ljava/util/Map;[Ljava/lang/Object;)Ljava/util/Map;at org.glassfish.apf.AnnotationInfo@cb88c8

at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:487)

at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:429)

at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:405)

at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380)

at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:243)

at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252)

at com.sun.enterprise.deployment.archivist.ApplicationArchivist.readModulesDescriptors(ApplicationArchivist.java:657)

at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:258)

at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:240)

at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:175)

at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:94)

at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:827)

at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:769)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)

at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)

at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)

at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)

at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)

at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)

at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)

at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)

at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)

at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)

at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)

at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)

at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)

at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)

at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)

at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)

at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)

at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)

at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)

at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)

at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)

at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)

at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)

at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)

at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)

at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)

at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

at java.lang.Thread.run(Thread.java:662)

Caused by: org.apache.commons.collections.MapUtils.putAll(Ljava/util/Map;[Ljava/lang/Object;)Ljava/util/Map;at org.glassfish.apf.AnnotationInfo@cb88c8

at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:367)

at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:375)

at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:289)

at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:217)

at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:134)

at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:598)

at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:442)

… 64 more

Caused by: java.lang.NoSuchMethodError: org.apache.commons.collections.MapUtils.putAll(Ljava/util/Map;[Ljava/lang/Object;)Ljava/util/Map;

at de.xxx(Unknown Source)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:247)

at com.sun.enterprise.deployment.util.TypeUtil.getMethod(TypeUtil.java:399)

at com.sun.enterprise.deployment.MethodDescriptor.getMethod(MethodDescriptor.java:333)

at org.glassfish.ejb.deployment.annotation.handlers.TransactionAttributeHandler.processAnnotation(TransactionAttributeHandler.java:101)

at org.glassfish.ejb.deployment.annotation.handlers.AbstractAttributeHandler.processAnnotation(AbstractAttributeHandler.java:183)

at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:344)

… 70 more

The corresponding apache commons library for this method should have been bundled in the EAR – so what was the problem?

As I was pretty sure that the directory structure and deployment rules of the EAR where right I was quite confused. To figure out the problem I first checked if I was using the libraries appropriately, if they were correctly wrapped and if there was any library conflict. After some investigations it was quite obvious that there was already another library with a different version and thus a different method signature installed. The resolution was quite simple – just remove the conflicting library (“commons-collections-3.1.jar”) as it was not used by any other application.

rm commons-collections-3.1.jar

Related Posts

Eclipse: convert upper case text to lower case and viceversa with a simple shortcut

simple

November 7, 2012

Development, Java

No Comment

This is just a quick post to share these 2 little shortcuts to convert text from lower case to uppercase and vice-versa in Eclipse. Lower case: CTRL+SHIFT+Y (CMD+SHIFT+Y on Mac OS X) Upper case: CTRL+SHIFT+X (CMD+SHIFT+X on Mac OS X) Camel case: Anyone knows a shortcut? You can select one or more characters to convert.

Read More

OpenERP: Connect Kettle to OpenERP

[1] http://kettle.pentaho.com [2] http://ci.pentaho.com/view/Data%20Integration/job/Kettle/ [3] http://apps.openerp.com/addon/1833?filter=%7B%22order_by%22%3A+%22click_counter+desc%22%2C+%22author%22%3A+78%7D&page=0 [4] http://erpmoldeo.wordpress.com/2011/02/10/openerp-kettle-and-terminatooor/ [5] http://www.akretion.com/en/products-and-services/openerp-kettle-bi-connector-terminatooor [6] http://forums.pentaho.com/showthread.php?98831-Asking-OpenERP-module-for-pentaho-data-integration-(Kettle)

Read More

Leave a Reply

RSS RSS Feed

  • An error has occurred, which probably means the feed is down. Try again later.

Categories

Tags