Search code examples
eclipsespring-bootgradlespring-tool-suitebuildship

Gradle (wrapper) + STS + Spring Boot: Error: Could not find or load main class 1.1,


One project among many started giving me the following error when running Gradle Tasks -> application -> bootRun:

Error: Could not find or load main class 1.1,

However, the following both work:

  • Running ./gradlew bootRun from the command-line
  • Starting the service with STS Boot Dashboard

It's odd that the Gradle Task window's execution is coming up with the class 1.1,.

Ideas?

Configuration

  • Windows 10 Pro
  • STS 3.9.4.RELEASE
  • Eclipse Buildship 2.2.1
  • Gradle Wrapper 4.5.1
  • Spring Boot 2.0.3.RELEASE

Attempts

  • Ran ./gradlew clean build
  • Refreshed Gradle Tasks in the window
  • Right-clicked project and ran Gradle -> Refresh Gradle Project
  • Restarted STS
  • Deleted ./metadata and restarted STS
  • Deleted ./bin and ./build directories
  • Unloaded the project and re-imported as Gradle project
  • Ran "STS -clean"

... always the same result


Solution

  • I have the same issue. Anyway in Eclipse Oxygen it just suddenly stops working but in terminal it is fine.

    https://github.com/JetBrains/kotlin-native/issues/1747

    Maybe this link would help. It is not working for me but I believe it points to the right direction.

    Solution he purposes:

    No, removing of node does not help. But the follow line in the Gradle script solve the problem:

    System.getProperties().remove( 'org.osgi.framework.system.capabilities' )
    

    The value of the property is:

    osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0, 1.1, 1.2",osgi.ee; osgi.ee="JRE"; version:List<Version>="1.0, 1.1",osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8",osgi.ee; osgi.ee="JavaSE/compact1"; version:List<Version>="1.8",osgi.ee; osgi.ee="JavaSE/compact2"; version:List<Version>="1.8",osgi.ee; osgi.ee="JavaSE/compact3"; version:List<Version>="1.8"
    

    It look like that you try to add all environment variable to the command line but does not quote correctly.