Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error #6

Open
rahulsharma1987 opened this issue Sep 7, 2022 · 9 comments
Open

Compilation Error #6

rahulsharma1987 opened this issue Sep 7, 2022 · 9 comments

Comments

@rahulsharma1987
Copy link

rahulsharma1987 commented Sep 7, 2022

Implementaion of addPhoto(photo) missing in service class PhoneImageService. Please look into this below snippet from controller call PhoneImageController

@PostMapping("/add")
public String addPhoto(@RequestParam("name") String name, @RequestParam("file") MultipartFile file)
throws IOException {

	Collection<Photo> _photo = getPhotoByName(name);
	Photo photo = null;
	if (_photo.isEmpty()) {
		photo = new Photo();
		photo.setName(name);
		photo.setImage(new Binary(BsonBinarySubType.BINARY, file.getBytes()));
		photo = service.addPhoto(photo);
	} else {
		photo = _photo.stream().findAny().get();
	}
	return photo.getId();
}

@GetMapping
public Collection<Photo> getPhotoByName(@RequestParam String name) {
	return service.getPhotoByName(name);
}
@Sivasankaramalan
Copy link

@sarathpharmeasy is there any update on the issue? Facing similar issue

@shashanks293
Copy link

@sarathpharmeasy I am also facing this issue, do we have a fix for this?

@shashanks293
Copy link

@rahulsharma1987 were you able to resolve this issue?

@sarathpharmeasy
Copy link
Collaborator

sarathpharmeasy commented Dec 1, 2022

@shashanks293 @rahulsharma1987 @Sivasankaramalan apologies for the delay. Kindly take a pull and retry.

@shashanks293
Copy link

@sarathpharmeasy now HomeController.getPhoneImage() has compilation issue in
return phoneImageService.getPhotoByName(name).stream().findFirst().orElseGet("default");

also if I somehow fix this compilation issue then build fails because of a test

DeviceLabMasterApplicationTests > contextLoads() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at InitDestroyAnnotationBeanPostProcessor.java:160
Caused by: org.springframework.amqp.AmqpConnectException at RabbitExceptionTranslator.java:61
Caused by: java.net.ConnectException at PlainSocketImpl.java:-2

@sarathpharmeasy
Copy link
Collaborator

@shashanks293 you can skip the test using ./gradlew clean build -x test

@avinashawast
Copy link

avinashawast commented Dec 23, 2022

@sarathpharmeasy @shashanks293 Can you push the fix you did for typecasting problem?

@sarathpharmeasy
Copy link
Collaborator

@avinashawast @Sivasankaramalan @rahulsharma1987
can you please pull from master branch and try now?

@rahulsharma1987
Copy link
Author

rahulsharma1987 commented Dec 24, 2022

hi @sarathpharmeasy

Tried with latest master branch and getting below error .Find the below output from the ./gradlew clean build bootWar executed on terminal

rahulsharma@197NODMB40704 master % ./gradlew clean build bootWar

Task :test

DeviceLabMasterApplicationTests > contextLoads() FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at InitDestroyAnnotationBeanPostProcessor.java:160
Caused by: org.springframework.amqp.AmqpConnectException at RabbitExceptionTranslator.java:61
Caused by: java.net.ConnectException at PlainSocketImpl.java:-2

1 test completed, 1 failed

Task :test FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':test'.

There were failing tests. See the report at: file:///Users/rahulsharma/eclipse-workspace/lampo/master/build/reports/tests/test/index.html

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 36s
8 actionable tasks: 8 executed


2.) Tried to execute this ./gradlew clean build -x test and build created successfully but after running java -jar build/libs/master.war getting below message
no main manifest attribute, in build/libs/master.war

@sarathpharmeasy - Can you look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants