mongrel tomcat launcher not working on neon

Edit: The solution is here

I used to use sydeo to launch Tomcat and then switched to Mongrel which I’ve been using for a few years. I had trouble with Mongrel in Eclipse Neon.

Symptoms

  • Clicking Start – get pop up with “The chosen operation is not available” and “Plugin net.sf.mongrel.plugin was unable to load class net.sf.mongrel.actions.StartActionDelegate” in the Eclipse log
  • Clicking Restart – get pop up with “The chosen operation is not available” and “Plugin net.sf.mongrel.plugin was unable to load class net.sf.mongrel.actions.RestartActionDelegate” in the Eclipse log
  • Clicking Stop – get pop up with “The chosen operation is not available” and “Plugin net.sf.mongrel.plugin was unable to load class net.sf.mongrel.actions.StopActionDelegate” in the Eclipse log
  • Opening Mongrel in the Eclipse preferences – get “An error has occurred while creating this preference page” and “Unable to create the selected preference page. An error occurred while automatically activating bundle net.sf.mongrel.plugin (1288).” The full Eclipse message in the error log is at the bottom of this post.

Attempt at solving

I checked the update site from Marketplace (by pasting the update site into “install new software” into Eclipse) and saw that there is only one version of Mongrel available. So it isn’t that I’m not using the latest version. I also tried uninstalling Mongrel and re-installing it. Nope. (You can uninstall a plugin through Marketplace if you installed it that way). Nothing.

I also learned I’m not the only one with this problem.

Workaround

The workaround is to use the WTP (web tool plugin) that comes with Eclipse as described here. Not a big deal. I just like the single button approach. I had upgraded to Java 8 since I last used WTP so I immediately got “unable to start Tomcat” with this log message in the console:

java.lang.UnsupportedClassVersionError: com/javaranch/jforum/csrf/CsrfListener : Unsupported major.minor version 52.0 (unable to load class com.javaranch.jforum.csrf.CsrfListener)

It was immediately obvious to me that WTP was pointing to Java 7 since I successfully launched this project in Mars a few days ago. I clicked on “runtime” in the Tomcat profile and choose Java 8 from the pull down. This updated the classpath and then I was successful.

Full message in case curious

eclipse.buildId=4.6.0.I20160606-1100

java.version=1.8.0_45

java.vendor=Oracle Corporation

BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US

Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product -keyring /Users/nyjeanne/.eclipse_keyring

Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product -data file:/Users/nyjeanne/Documents/workspace/ -product org.eclipse.epp.package.jee.product -keyring /Users/nyjeanne/.eclipse_keyring

org.eclipse.equinox.registry

Error

Fri Jun 24 10:48:29 EDT 2016

Unable to create the selected preference page.

java.lang.ClassNotFoundException: An error occurred while automatically activating bundle net.sf.mongrel.plugin (975).

at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:116)

at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)

at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:325)

at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:334)

at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:411)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:361)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:353)

at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)

at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)

at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)

at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)

at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)

at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:291)

at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)

at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:286)

at org.eclipse.ui.internal.PluginAction.createDelegate(PluginAction.java:122)

at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:219)

at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:228)

at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)

at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436)

at org.eclipse.jface.action.ActionContributionItem$$Lambda$34/501727405.handleEvent(Unknown Source)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)

at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)

at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)

at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)

at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)

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

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

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

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

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)

at org.eclipse.equinox.launcher.Main.run(Main.java:1519)

Caused by: org.osgi.framework.BundleException: Error loading bundle activator.

at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:716)

at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)

at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)

at org.eclipse.osgi.container.Module.doStart(Module.java:581)

at org.eclipse.osgi.container.Module.start(Module.java:449)

at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:470)

at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)

… 51 more

Caused by: java.lang.ClassNotFoundException: org.eclipse.core.internal.compatibility.PluginActivator cannot be found by net.sf.mongrel.plugin_1.0.0.201101221622

at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:448)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:361)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:353)

at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:757)

at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:711)

… 57 more

performance engineer’s guide to hotspot JIT compilation – monica beckwith – qcon

For more QCon posts, see my live blog table of contents. This presentation is about the compiler and also the runtime.

Major pieces

  • Execution engine
    • Heap management/garbage collection
    • JIT compilation
  • Runtime
    • VM Class loading
    • Interpretter
    • Byte code verification,etc

Runtime goal – convert from bytecode to native code and do optimizations along the way

Compilation Techniques and Notes

  • Pre-compiled/ahead of time
  • profile guided – based on critical hotspots
  • Adaptive optimization (Java uses Profile guided and Adaptive optimization)
  • Identify root of compilation
  • replace method or on stack – depends on number of times through loop
  • Server compiler has a higher threshold than client compiler for the threshold at which you need optimizations
  • Tiered compilation – tier 1 is client compiler with no profiling info, tier 2 and 3 are client compiler with profiling info. Then comes server compiler
  • CodeCache order of magnitude larger when tiered compilation is enabled. If need more can use -XX:ReservedCodeCacheSize
  • Inlining – many different parameters when figuring out when to inline
  • Vectorization – SIMD (SIngle Instruction Multiple Data). Can generate stubs and benefit from caching size chunks. For SuperWord Level Parallelism, you need to unroll the loop, do analysis/pre-optimization, etc. Still in infancy with Hotspot.
  • Escape analysis – Want to see if object only is used in a compile method. Need entire graph to confirm not in a static field/returned from method/passed as parameter/etc. If really local, can optimize by storing in registers.
  • Objects are 8 byte aligned by default. Fields are aligned by type.
  • OOP (ordinary object pointer) is a managed pointer. The size can be changed to optimize.
  • Compressed Class Pointers – part of the Metaspace. Class data is outside of heap.

Deoptimization

  1. dependency issues
  2. class unloading/redefinition
  3. uncommon path
  4. profiled info isn’t useful for path [like with databases when db assumes something different than you want]

If curious about details

To get information about what compiler thinks/did:

  • PrintCompilation – ex: what level instructions were compiled at
  • PrintInlining – use -XX:+UnlockDiagonsticVMOptions

how containers have panned out – adrian trenaman – qcon

For more QCon posts, see my live blog table of contents. Adrian is from Gilt.

History

  • No off the shelf software to run a flash sale business. Therefore Gilt has to do something custom.
  • Started with Ruby on Rails in 2007. Didn’t scale well enough
  • Moved to Java in 2011
  • Moved to microservices in 2015
  • In a 30 day period, moved bulk of Gilt to Amazon

Problems

  • Isolation problem – nobody should be able to take down someone else’s work
  • A noon outage in 2013 – what happened
  • Impedance mismatch problems. “Developers often think of machines as something that’s all theirs, magically provided by the hardware fairy.”

Machines for Gilt Japan

  • Run 20-40 containers per machine.
  • Load balancer between two racks of three boxes each.
  • Separate machines for the database and email.
  • From developer’s point of view, a machine is a machine.

What did Gilt Japan learn

  • Scalable by time of day
  • Solves impedance mismatch – developers see “a machine”
  • Limits damage one person can do
  • Infra/Devops engineer embedded into engineering team
  • Outstanding potential problems
    • Static infrastructure
    • Resource hogging

Docker topology

  • Dark canary – only for internal use
  • Canary – First prod install. Let it run for a while (ex through a noon cycle for Gilt)
  • Release – Once happy with canary, roll it out to other nodes
  • Gilt has a lot of read only traffic which limits damage you can do and reduces need for staging environment.
  • Gilt has one container per host/EC2 instance
  • Want to have as few moving parts/risk points in deployment process
  • “We could solve this now, or just wait six months and Amazon wil provide a solution”

Projects

  • ION Roller
    • Immutable deployment – Destroy original cluster when done with this process for Docker upgrades.
    • Slow to setup/tear down environments.
    • Can be expensive for continuous deployment
    • Open source, but in house.
  • Nova
    • Uses yaml to deploy
    • No Docker registry. Base images are on Docker. Releases aren’t needed on there so go straight to Amazon
    • Less boilerplate
    • Immutable deployment on mutable infrastructure. Docker container is immutable.
  • Fighting bit rot, chaos-monkey style
    • Don’t want things to run forever in Prod.
    • What if there is a security vulnerability
    • Every day, kill oldest AMI randomly. This forces latest AMI with fixes and fail early.
    • Doesn’t solve vulnerability in Docker container. Would need new release with new base image for that. Hasn’t happened to Gilt yet.
  • Sundial
    • For running batch jobs
    • Automatically reschedules if fail
    • Define a process – group of tasks with dependencies between them

EC2

  • Less configuration
  • Automatic rollout
  • Integrations
  • IAM roles are at instance level, not container level

Using Docker as a local build platform

  • Different projects use different versions of build tools
  • Docker can be used as a versioned build container.
  • A year from now, will still have everything need to run code

Lessons

  • Containers let separate what deploy from how.where deploy it
  • Still the wild west on how containers are deployed
  • Seek immutability in the container, not in the stack
  • The competitive advantage for Gilt is to be able to deploy quickly/frequently/safely to production and therefore can innovate faster. Gilt lets engineers deploy whenever they want without asking permission.