Mvn Spring-boot:run

There is a problem in Spring-boot:run command because it gives the MOJOExecutionExceptionUntitled

The problem is not with mvn…run but with your setup.
Most likely, your uri in mflix/src/main/resources/application.properties is wrong.

I am getting seven errors due to toHexString() that is missing. Am I doing something wrong too???

[ INFO ] Scanning for projects…

[ INFO ]

[ INFO ] ----------------------< mongodb.university:mflix >----------------------

[ INFO ] Building mflix 1.0-SNAPSHOT

[ INFO ] --------------------------------[ jar ]---------------------------------

[ INFO ]

[ INFO ] >>> spring-boot-maven-plugin:2.0.3.RELEASE:run (default-cli) > test-compile @ mflix >>>

[ INFO ]

[ INFO ] maven-resources-plugin:2.6:resources (default-resources) @ mflix

[ INFO ] Using ‘UTF-8’ encoding to copy filtered resources.

[ INFO ] Copying 17 resources

[ INFO ]

[ INFO ] maven-compiler-plugin:3.7.0:compile (default-compile) @ mflix

[ INFO ] Changes detected - recompiling the module!

[ INFO ] Compiling 34 source files to /Users/usman/M220J/mflix/target/classes

[ INFO ] /Users/usman/M220J/mflix/src/main/java/mflix/api/services/MoviesService.java: Some input files use unchecked or unsafe operations.

[ INFO ] /Users/usman/M220J/mflix/src/main/java/mflix/api/services/MoviesService.java: Recompile with -Xlint:unchecked for details.

[ INFO ] -------------------------------------------------------------

[ ERROR ] COMPILATION ERROR :

[ INFO ] -------------------------------------------------------------

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/models/Comment.java:[88,18] cannot find symbol

symbol: method toHexString()

location: variable oid of type org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/models/Comment.java:[101,33] cannot find symbol

symbol: method toHexString()

location: variable movieObjectId of type org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/AbstractMFlixDao.java:[58,15] cannot find symbol

symbol: method getWTimeout(java.util.concurrent.TimeUnit)

location: class com.mongodb.WriteConcern

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[25,44] cannot find symbol

symbol: method toHexString()

location: class org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[35,46] cannot find symbol

symbol: method toHexString()

location: class org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[77,46] cannot find symbol

symbol: method toHexString()

location: class org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[81,56] cannot find symbol

symbol: method toHexString()

location: class org.bson.types.ObjectId

[ INFO ] 7 errors

[ INFO ] -------------------------------------------------------------

[ INFO ] ------------------------------------------------------------------------

[ INFO ] BUILD FAILURE

[ INFO ] ------------------------------------------------------------------------

[ INFO ] Total time: 15.582 s

[ INFO ] Finished at: 2019-02-17T00:18:58+05:00

[ INFO ] ------------------------------------------------------------------------

[ ERROR ] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project mflix: Compilation failure : Compilation failure:

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/models/Comment.java:[88,18] cannot find symbol

[ ERROR ] symbol: method toHexString()

[ ERROR ] location: variable oid of type org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/models/Comment.java:[101,33] cannot find symbol

[ ERROR ] symbol: method toHexString()

[ ERROR ] location: variable movieObjectId of type org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/AbstractMFlixDao.java:[58,15] cannot find symbol

[ ERROR ] symbol: method getWTimeout(java.util.concurrent.TimeUnit)

[ ERROR ] location: class com.mongodb.WriteConcern

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[25,44] cannot find symbol

[ ERROR ] symbol: method toHexString()

[ ERROR ] location: class org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[35,46] cannot find symbol

[ ERROR ] symbol: method toHexString()

[ ERROR ] location: class org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[77,46] cannot find symbol

[ ERROR ] symbol: method toHexString()

[ ERROR ] location: class org.bson.types.ObjectId

[ ERROR ] /Users/usman/M220J/mflix/src/main/java/mflix/api/daos/MovieDocumentMapper.java:[81,56] cannot find symbol

[ ERROR ] symbol: method toHexString()

[ ERROR ] location: class org.bson.types.ObjectId

[ ERROR ] -> [Help 1]

[ ERROR ]

[ ERROR ] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ ERROR ] Re-run Maven using the -X switch to enable full debug logging.

[ ERROR ]

[ ERROR ] For more information about the errors and possible solutions, please read the following articles:

[ ERROR ] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Can you check the Java version you are using and post here please?

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

The problem I am facing are

  1. org.bson.types.ObjectId has methods toHexString() but it is not recognized
  2. Another method like that in same package is failing
  3. the mav compile command fails thus whole application is not running

I have updated maven dependency of bson to 3.10.1 as it was the latest release yet this is not working

Did you try a mvn:clean and then a mvn:install before running the project? Are you trying to run from your command line or your ide??

It shows this error
image

I am using
image

please tell me the problem in the propperties file. Here is the image of the text present in the properties file.

Sorry… was my typo mvn clean and mvn install

Your property files doesn’t have line break between the properties?

I don’t know if this works but, I had an error when executing the command “spring-boot:run” and it was caused because in the file ‘application.properties’ I didn’t change the URI of my cluster. Make sure you have modified the file and restart the computer once the modification is done.

I also recommend to modify the ‘jwtSecret’.

1 Like