Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » "Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch" and o(Errors when testing with Jenkins and Maven Surefire)
"Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch" and o [message #844682] Sat, 14 April 2012 08:23 Go to next message
Daniel P. is currently offline Daniel P.Friend
Messages: 3
Registered: March 2011
Junior Member
Hello,

we have some problems testing classes using the UML2 plugins.
We are using version 3.0.0 to be more compatible.

When testing locally, everything works fine. But we also have a Jenkins/Maven/Surefire testing setup and keep getting strange errors when testing.

It always seems to stem from methods trying to create CommunicationPath instances.

I'll try and post the code parts where the errors happen and then the corresponding error message:

CommunicationPath newPath = sourceNode.createCommunicationPath(false, AggregationKind.COMPOSITE_LITERAL,"", 1, 1, targetNode, false, AggregationKind.NONE_LITERAL, "", 1, 1);


The parameters all seem to be correct (the nodes are existent and in a model).

Stacktrace
java.lang.ClassFormatError: Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at org.eclipse.uml2.uml.util.UMLUtil.getOwnedAttributes(UMLUtil.java:9153)
	at org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociationEnd(TypeOperations.java:155)
	at org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociation(TypeOperations.java:232)
	at org.eclipse.uml2.uml.internal.operations.NodeOperations.createCommunicationPath(NodeOperations.java:124)
	at org.eclipse.uml2.uml.internal.impl.NodeImpl.createCommunicationPath(NodeImpl.java:396)


The next is another instance of creating a communication path. The code used is the same, the nodes are the same, the model is the same.

Stacktrace
java.lang.ClassFormatError: org/eclipse/uml2/uml/util/UMLUtil$2
	at org.eclipse.uml2.uml.util.UMLUtil.getOwnedAttributes(UMLUtil.java:9153)
	at org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociationEnd(TypeOperations.java:155)
	at org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociation(TypeOperations.java:232)
	at org.eclipse.uml2.uml.internal.operations.NodeOperations.createCommunicationPath(NodeOperations.java:124)
	at org.eclipse.uml2.uml.internal.impl.NodeImpl.createCommunicationPath(NodeImpl.java:396)


Can somebody help me in understanding what is going wrong here?
Re: "Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch& [message #846009 is a reply to message #844682] Sun, 15 April 2012 17:03 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Daniel,

It looks like you're running into the 64 kB limit for the compiled code
size of a method that some JVMs implement, and which is at least one of
the reasons why the EMF Generator has the option to initialize a
package from the Ecore model at run-time. Models the size of UML2
easily generate XyzPackageImpl::init() methods that are larger than 64
kB.

Looking at the particular class in your scenario, I'll take a stab and
guess that the doSwitch(int, EObject) method is too large. It's 5146
lines long.

Does your JVM have any tuning parameters that you can specify on the
command-line to increase the size of methods that it will tolerate?
This method is accepted by every JVM I've used in recent memory.

I suppose it might be nice if the EMF Generator provided for breaking
up large doSwitch()s, somehow, but I'm not sure what that would look
like and what other problems might ensue. Especially as it doesn't
seem generally to be a problem in most deployments.

Cheers,

Christian


On 2012-04-14 08:23:02 +0000, Daniel W. said:

> Hello,
>
> we have some problems testing classes using the UML2 plugins.
> We are using version 3.0.0 to be more compatible.
>
> When testing locally, everything works fine. But we also have a
> Jenkins/Maven/Surefire testing setup and keep getting strange errors
> when testing.
>
> It always seems to stem from methods trying to create CommunicationPath
> instances.
>
> I'll try and post the code parts where the errors happen and then the
> corresponding error message:
>
> CommunicationPath newPath = sourceNode.createCommunicationPath(false,
> AggregationKind.COMPOSITE_LITERAL,"", 1, 1, targetNode, false,
> AggregationKind.NONE_LITERAL, "", 1, 1);
>
> The parameters all seem to be correct (the nodes are existent and in a model).
>
> Stacktrace
> java.lang.ClassFormatError: Invalid method Code length 67309 in class
> file org/eclipse/uml2/uml/util/UMLSwitch
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>
> at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> at org.eclipse.uml2.uml.util.UMLUtil.getOwnedAttributes(UMLUtil.java:9153)
> at
> org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociationEnd(TypeOperations.java:155)
>
> at
> org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociation(TypeOperations.java:232)
>
> at
> org.eclipse.uml2.uml.internal.operations.NodeOperations.createCommunicationPath(NodeOperations.java:124)
>
> at
> org.eclipse.uml2.uml.internal.impl.NodeImpl.createCommunicationPath(NodeImpl.java:396)
>
>
> The next is another instance of creating a communication path. The code
> used is the same, the nodes are the same, the model is the same.
>
> Stacktrace
> java.lang.ClassFormatError: org/eclipse/uml2/uml/util/UMLUtil$2
> at org.eclipse.uml2.uml.util.UMLUtil.getOwnedAttributes(UMLUtil.java:9153)
> at
> org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociationEnd(TypeOperations.java:155)
>
> at
> org.eclipse.uml2.uml.internal.operations.TypeOperations.createAssociation(TypeOperations.java:232)
>
> at
> org.eclipse.uml2.uml.internal.operations.NodeOperations.createCommunicationPath(NodeOperations.java:124)
>
> at
> org.eclipse.uml2.uml.internal.impl.NodeImpl.createCommunicationPath(NodeImpl.java:396)
>
>
> Can somebody help me in understanding what is going wrong here?
Re: "Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch" [message #846622 is a reply to message #846009] Mon, 16 April 2012 09:57 Go to previous messageGo to next message
Daniel P. is currently offline Daniel P.Friend
Messages: 3
Registered: March 2011
Junior Member
The JVM I'm using is the Oracle JDK 1.6 Update 31 one, the HotSpot JVM. I haven't found any switches for adjusting allowed method size yet. I must be blind, it seems...

[Updated on: Mon, 16 April 2012 10:07]

Report message to a moderator

Re: "Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch& [message #846647 is a reply to message #846009] Mon, 16 April 2012 14:00 Go to previous message
Daniel P. is currently offline Daniel P.Friend
Messages: 3
Registered: March 2011
Junior Member
I finally found out what happened here.

1. The tests work locally.
2. In Jenkins, the tests produced these errors.

What do I do different locally? I don't use JaCoCo bytecode instrumentation for generating Code Coverage.

It seems that the UMLSwitch class was 64KB or near that for itself. Then add bytecode instrumentation to it and BAM! Method too long.

I added an exclude filter to my setup, and now no more errors occur.
Previous Topic:Problem with the "registration" of an UML2 profile
Next Topic:EMF wizard, UML2 and package name case
Goto Forum:
  


Current Time: Tue Apr 23 09:54:18 GMT 2024

Powered by FUDForum. Page generated in 0.03915 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top