Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: Unable to find main class

Checkout our recommended article on interview questions on Spring Security.
Solutions: 
 
 
Solution 1 :
 
You needed to change the packaging parameter to jar from pom. Also, the repositories, pluginRepositories, the maven-compiler-plugin and the spring-boot-maven-plugin’s version and executions weren’t needed.
 
Solution 2: 
 
Try mvn install and see if it works

Solution 3:


Preview:
<properties>
    <!-- The main class to start by executing java -jar -->
    <start-class>com.mycorp.starter.HelloWorldApplication</start-class>
</properties>
Solution 4:
 
Enable the main() method in your Application.java.
 
Configure spring-boot-maven-plugin to specify the class with the main class (Spring should find it anyway if you have one, but good to be explicit):


Preview:
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>${spring-boot-version}</version>
    <configuration>
        <mainClass>the.package.of.Application</mainClass>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

117 total views, no views today

Error: Could not find or load main class

Solutions :
 
 
1. Same Problem occur with me
I went to project > properties > javaBuildPath.
There In order of export , I moved up my java/main to the top priority.
 
 
2 .
went to run configurations: – run->run configurations In the Classpath tab

Select Advanced

Add where Eclipse usually put the *.class for the projects, which is in bin. So I added the bin directory for the project.

 
 
3. Project -> Clean
Make sure Project -> Build automatically is active
Project -> Properties -> Java Build Path -> Libraries: Remove any external libs you have ever added. Don’t remove standard libraries like the JRE System Library.
Try to run your main class now. The “class could not be found / load” error should be gone. Try adding your external libs/jars one after each other.
I hope it helps someone out there.

122 total views, no views today

java.lang.object cannot be resolved / javax.cache.Cache cannot be resolved. It is indirectly referenced from required .class files

Problem Statements :
Description
Location
Type
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
line 1
Java Problem
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
Unknown
Java Problem
The method myMethod(SomeClass) from the type MyOtherClass refers to the missing type (insert java type here: InputStream|File|Vector|IOException|etc)
line 123
Java Problem

Solutions : 

  • Close the project and reopen it.
  • Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries)
    OR
  • Delete and Re-import the project and if necessary do the above steps again.
The following steps could help:
  1. Right-click on project » Properties » Java Build Path
  2. Select Libraries tab
  3. Find the JRE System Library and remove it
  4. Click Add Library… button at right side » Add the JRE System Library (Workspace default JRE)

Add this  entry in your POM.xml file


Preview:


<dependency>

<groupId>javax.cache</groupId>

<artifactId>cache-api</artifactId>

</dependency>

116 total views, 1 views today

Required request body content is missing: org.springframework.web.method.HandlerMethod

Checkout my recommended article on Spring Security Interview Questions.

You can’t send a request body with an HTTP GET request. You should modify your call so that it only supports POST, and POST your JSON to that endpoint.

If you want to GET information about a bean, you should create a separate controller method that does that (and does not require a request body).

Also, double-check your endpoint definitions  in the $.ajax call.

131 total views, 1 views today