This post will help you to successfully run the Module2.1 project on Eclipse for CS-305: Software Security.
In module 2, you are asked to conduct a code review and mitigation plan for a web application that uses the Spring Framework. You are given the codebase to upload to Eclipse for manual review.
Download Java SE Development Kit 12.0.2
Start by downloading Java SE Development Kit 12.0.2 from Oracle’s website. Here is a direct link for this specific version: https://www.oracle.com/java/technologies/javase/jdk12-archive-downloads.html#
Upload the codebase to Eclipse
After downloading Java SE Development Kit 12.0.2 and uploading the codebase to Eclipse, run the application as “Java Application.” After running the application, you might get an error such as the following:
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'httpRequestHandlerAdapter', defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Fixing the error for the Module2.1 project in Eclipse
To fix the error for the Module2.1 project in Eclipse, open pom.xml and navigate to the file.
Under dependencies, look for this dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>2.6.5.RELEASE</version></dependency>
If you hover over the exclamation mark, it should read as follows:
Overriding managed version 3.2.4.RELEASE for spring-data-rest-webmvc.
To fix the error for project Module2.1, simply replace 2.6.5.RELEASE
to 3.2.4.RELEASE
or whatever version Eclipse is telling you and save the changes you made.
After following the above steps, I was able to successfully launch the application. This is the success message I got:
Take note of the port number being used, mine was port 8080.
Tomcat initialized with port(s): 8080 (http)
Now you can access the webpage by opening your browsing and going http://localhost:8080/
Hopefully these instructions helped you successfully run the Module2.1 project
Don’t forget to mention upgrading org.springframework.data
as part of your mitigation plan.