NoClassDefFoundError (org.eclipse.core.runtime.Platform)

498 views
Skip to first unread message

Syed Rizvi

unread,
Mar 5, 2015, 12:06:21 PM3/5/15
to google-a...@googlegroups.com
Hi,
I am making a maven based GAE project. It's a service that is supposed to serve some data to its clients. The project works perfectly on the local machine, but gives the NoClassDefFoundError when deployed to GAE. Here's the complete StackTrace:

Error for /cron/loadDataset
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.core.runtime.Platform at org.eclipse.ocl.common.OCLCommon.getPreference(OCLCommon.java:74) at org.eclipse.ocl.lpg.AbstractBasicEnvironment.getValue(AbstractBasicEnvironment.java:440) at org.eclipse.ocl.options.ParsingOptions.getValue(ParsingOptions.java:330) at org.eclipse.ocl.AbstractEnvironment.createTypeChecker(AbstractEnvironment.java:1214) at org.eclipse.ocl.AbstractEnvironment.getTypeChecker(AbstractEnvironment.java:1196) at org.eclipse.ocl.AbstractEnvironment.getAdapter(AbstractEnvironment.java:1236) at org.eclipse.ocl.util.OCLUtil.getAdapter(OCLUtil.java:102) at org.eclipse.ocl.util.TypeUtil.getTypeCheckerAdapter(TypeUtil.java:800) at org.eclipse.ocl.util.TypeUtil.findAttribute(TypeUtil.java:171) at org.eclipse.ocl.AbstractEnvironment.doLookupProperty(AbstractEnvironment.java:657) at org.eclipse.ocl.AbstractEnvironment.lookupProperty(AbstractEnvironment.java:638) at org.eclipse.ocl.AbstractTypeResolver.findTupleType(AbstractTypeResolver.java:430) at org.eclipse.ocl.AbstractTypeResolver.resolveTupleType(AbstractTypeResolver.java:382) at org.eclipse.ocl.AbstractTypeResolver$ResolveSwitch.caseTupleType(AbstractTypeResolver.java:1008) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:267) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:117) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:122) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:105) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.eclipse.ocl.AbstractTypeResolver.resolve(AbstractTypeResolver.java:127) at org.eclipse.ocl.AbstractTypeResolver$ResolveSwitch.caseCollectionType(AbstractTypeResolver.java:1003) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:168) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:117) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:122) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:122) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:105) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.eclipse.ocl.AbstractTypeResolver.resolve(AbstractTypeResolver.java:127) at org.eclipse.ocl.util.TypeUtil.resolveType(TypeUtil.java:617) at org.eclipse.ocl.util.OCLStandardLibraryUtil.getSetType(OCLStandardLibraryUtil.java:2216) at org.eclipse.ocl.util.OCLStandardLibraryUtil.createCollectionOperations(OCLStandardLibraryUtil.java:1754) at org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl.build(OCLStandardLibraryImpl.java:375) at org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl.init(OCLStandardLibraryImpl.java:205) at org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl.<clinit>(OCLStandardLibraryImpl.java:97) at org.eclipse.ocl.ecore.EcoreEnvironment.getOCLStandardLibrary(EcoreEnvironment.java:271) at org.eclipse.ocl.parser.AbstractOCLAnalyzer.booleanLiteralExpCS(AbstractOCLAnalyzer.java:3041) at org.eclipse.ocl.parser.AbstractOCLAnalyzer.primitiveLiteralExpCS(AbstractOCLAnalyzer.java:2922) at org.eclipse.ocl.parser.AbstractOCLAnalyzer.literalExpCS(AbstractOCLAnalyzer.java:3107) at org.eclipse.ocl.parser.AbstractOCLAnalyzer.oclExpressionCS(AbstractOCLAnalyzer.java:1983) at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invCS(AbstractOCLAnalyzer.java:1440) at org.eclipse.ocl.parser.AbstractOCLAnalyzer.invOrDefCS(AbstractOCLAnalyzer.java:1420) at org.eclipse.ocl.parser.OCLAnalyzer.parseInvOrDefCS(OCLAnalyzer.java:266) at org.eclipse.ocl.internal.helper.HelperUtil.parseQuery(HelperUtil.java:164) at org.eclipse.ocl.internal.helper.OCLHelperImpl.createQuery(OCLHelperImpl.java:176) at org.eclipse.emf.query.ocl.conditions.AbstractOCLCondition.<init>(AbstractOCLCondition.java:211) at org.eclipse.emf.query.ocl.conditions.BooleanOCLCondition.<init>(BooleanOCLCondition.java:149) at org.eclipse.emf.query.ocl.conditions.BooleanOCLCondition.<init>(BooleanOCLCondition.java:107) at org.sociotech.communitymashup.data.impl.DataSetImpl.getAttachments(DataSetImpl.java:3032)

As you can see in the Platform.class.PNG screenshot, the class is present (At least at compile time. I don't know how it vanishes at runtime?), The dependencies are downloaded from the public Maven repo. Just one external JAR is included from my local repo using:
<dependency>
<groupId>com.mywork</groupId>
<artifactId>emfjson</artifactId>
<version>0.4.1</version>
<scope>compile</scope>
</dependency>

All these Maven dependencies including the external JAR are packaged with the WAR file (as seen in Dependencies.PNG). Where could the problem lie? I have spent days but still cannot find where the problem exists.

Your help would be greatly appreciated!

Dependencies.PNG
Platform.class.PNG

Patrice

unread,
Mar 11, 2015, 6:37:35 PM3/11/15
to google-a...@googlegroups.com
Hey Syed,

This kind of question would be better suited for Stack Overflow. If it's an actual defect, go on our public issue tracker to report it.

Thank you!

Syed Rizvi

unread,
Mar 12, 2015, 5:04:10 AM3/12/15
to google-a...@googlegroups.com
Hey Patrice,

I actually posted this on StackOverflow yesterday. Nothing helpful yet though. Will now report on the public issue tracker as you suggested.

Thank you!


On Wednesday, March 11, 2015 at 11:37:35 PM UTC+1, Patrice wrote:
Hey Syed,

This kind of question would be better suited for Stack Overflow. If it's an actual defect, go on our public issue tracker to report it.

Thank you!

On Thursday, March 5, 2015 at 12:06:21 PM UTC-5, Syed Rizvi wrote:
Hi,
I am making a maven based GAE project. It's a service that is supposed to serve some data to its clients. The project works perfectly on the local machine, but gives the NoClassDefFoundError when deployed to GAE. Here's the complete StackTrace:

Error for /cron/loadDataset
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.core.runtime.Platform at org.eclipse.ocl.common.OCLCommon.getPreference(OCLCommon.java:74) at org.eclipse.ocl.lpg.AbstractBasicEnvironment.getValue(AbstractBasicEnvironment.java:440) at org.eclipse.ocl.options.ParsingOptions.getValue(ParsingOptions.java:330) at org.eclipse.ocl.AbstractEnvironment.createTypeChecker(AbstractEnvironment.java:1214) at org.eclipse.ocl.AbstractEnvironment.getTypeChecker(AbstractEnvironment.java:1196) at org.eclipse.ocl.AbstractEnvironment.getAdapter(AbstractEnvironment.java:1236) at org.eclipse.ocl.util.OCLUtil.getAdapter(OCLUtil.java:102) at org.eclipse.ocl.util.TypeUtil.getTypeCheckerAdapter(TypeUtil.java:800) at org.eclipse.ocl.util.TypeUtil.findAttribute(TypeUtil.java:171) at org.eclipse.ocl.AbstractEnvironment.doLookupProperty(AbstractEnvironment.java:657) at org.eclipse.ocl.AbstractEnvironment.lookupProperty(AbstractEnvironment.java:638) at org.eclipse.ocl.AbstractTypeResolver.findTupleType(AbstractTypeResolver.java:430) at org.eclipse.ocl.AbstractTypeResolver.resolveTupleType(AbstractTypeResolver.java:382) at org.eclipse.ocl.AbstractTypeResolver$ResolveSwitch.caseTupleType(AbstractTypeResolver.java:1008) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:267) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:117) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:122) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:105) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.eclipse.ocl.AbstractTypeResolver.resolve(AbstractTypeResolver.java:127) at org.eclipse.ocl.AbstractTypeResolver$ResolveSwitch.caseCollectionType(AbstractTypeResolver.java:1003) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:168) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:117) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:122) at org.eclipse.ocl.types.util.TypesSwitch.doSwitchSuperTypes(TypesSwitch.java:122) at org.eclipse.ocl.types.util.TypesSwitch.doSwitch(TypesSwitch.java:105) at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69) at org.eclipse.ocl.AbstractTypeResolver.resolve(AbstractTypeResolver.java:127) at org.eclipse.ocl.util.TypeUtil.resolveType(TypeUtil.java:617) at org.eclipse.ocl.util.OCLStandardLibraryUtil.getSetType(OCLStandardLibraryUtil.java:2216) at org.eclipse.ocl.util.OCLStandardLibraryUtil.createCollectionOperations(OCLStandardLibraryUtil.java:1754) at org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl.build(
...

Vinny P

unread,
Mar 13, 2015, 1:10:02 AM3/13/15
to google-a...@googlegroups.com
On Thu, Mar 5, 2015 at 11:06 AM, Syed Rizvi <amma...@gmail.com> wrote:

Error for /cron/loadDataset
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.core.runtime.Platform
As you can see in the Platform.class.PNG screenshot, the class is present (At least at compile time. I don't know how it vanishes at runtime?), The dependencies are downloaded from the public Maven repo. 
All these Maven dependencies including the external JAR are packaged with the WAR file (as seen in Dependencies.PNG). Where could the problem lie? I have spent days but still cannot find where the problem exists



I'm curious to see what is actually on App Engine servers. I'd try uploading your application, then downloading it again using appcfg: https://cloud.google.com/appengine/docs/java/tools/uploadinganapp#Downloading_an_Application . As the sample in the link shows, you should also get back a printed list of the files and directory structure.

The problem is that there might be a deeper issue here. Your stack trace shows that the exception message comes from Platform. A NoClassDefFoundError can also pop from errors in statically-initialized code, and unfortunately Platform has exactly that: http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.7/org.eclipse.core/runtime/3.7.0/org/eclipse/core/runtime/Platform.java . It looks like part of the static code calls org.eclipse.core.internal.runtime.Messages which (within static) calls org.eclipse.osgi.util.NLS.initializeMessages which makes some calls requiring privileged actions - meaning that GAE's SecurityManager would have to allow the calls, and I'm not sure if those calls run properly due to the GAE sandbox - you'd have to ask a Googler to investigate.

Happily enough, there's a shortcut instead of drilling through mountains of code to debug: try moving your application to use Managed VMs. If this really is a SecurityManager issue, the more-permissive Managed VM instance should be able to run the code perfectly fine.

 
 
-----------------
-Vinny P
Technology & Media Consultant
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com
 
Reply all
Reply to author
Forward
0 new messages