0

I am working on a jhipster application.Upon compilation time, I get a series of errors relating to symbol not found.

I have tried looking at the stack trace and re ran the code after commenting out some lines. Here is the piece of code resulting in an error:

@RequestMapping("/api")
public class PhotoResource {

    private final Logger log = LoggerFactory.getLogger(PhotoResource.class);

    private static final String ENTITY_NAME = "photo";

    private final PhotoRepository photoRepository;

    public PhotoResource(PhotoRepository photoRepository) {
        this.photoRepository = photoRepository;
    }

    /**
     * POST  /photos : Create a new photo.
     *
     * @param photo the photo to create
     * @return the ResponseEntity with status 201 (Created) and with body the new photo, or with status 400 (Bad Request) if the photo has already an ID
     * @throws URISyntaxException if the Location URI syntax is incorrect
     */
    @PostMapping("/photos")
    @Timed
    public ResponseEntity<Photo> createPhoto(@Valid @RequestBody Photo photo) throws Exception {
        log.debug("REST request to save Photo : {}", photo);
        if (photo.getId() != null) {
            throw new BadRequestAlertException("A new photo cannot already have an ID", ENTITY_NAME, "idexists");
        }

        try {
            photo = setMetadata(photo);
        } catch (ImageProcessingException ipe) {
            log.error(ipe.getMessage());
        }

        Photo result = photoRepository.save(photo);
        return ResponseEntity.created(new URI("/api/photos/" + result.getId()))
            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
            .body(result);
    }

The error I get is as follows:


[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[50,19] cannot find symbol
[ERROR]   symbol:   class PhotoRepository
[ERROR]   location: class com.okta.developer.web.rest.PhotoResource
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[52,26] cannot find symbol
[ERROR]   symbol:   class PhotoRepository
[ERROR]   location: class com.okta.developer.web.rest.PhotoResource
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[65,66] cannot find symbol
[ERROR]   symbol:   class Photo
[ERROR]   location: class com.okta.developer.web.rest.PhotoResource
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[65,27] cannot find symbol
[ERROR]   symbol:   class Photo
[ERROR]   location: class com.okta.developer.web.rest.PhotoResource
Nompumelelo
  • 929
  • 3
  • 17
  • 28
  • How did you generate the app ? How did you build it ? – Gaël Marziou Aug 10 '19 at 16:40
  • @GaëlMarziou - I used the Yoeman app generator option. Then followed the configuration options from this blog [https://developer.okta.com/blog/2018/06/25/react-spring-boot-photo-gallery-pwa]. Right now I am going to start afresh and instead of Yoeman - just use the online Jhipster generator – Nompumelelo Aug 10 '19 at 16:55
  • Disclaimer: I'm a member of the JHipster team. If you don't give more details, I can't help you. The blog you're referring too is for JHipster 5, the online generator uses current version which is 6. Reading the docs https://www.jhipster.tech to check that your environment works might help, the online generator will work but the generated project may not run on your PC, this is why I always recommend the CLI – Gaël Marziou Aug 10 '19 at 17:31
  • @GaëlMarziou - Thanks for your valuable input. So, I have read the doc and tried the walkthrough tuts in the Google cloud shell where the following was said: " JHipster 5.8.1 is using Java 8 and is not compatible with other versions, JHipster 6 will be updated with Java 11." Is this only for the cloud setup or it's universal to every machine? – Nompumelelo Aug 25 '19 at 22:30
  • 1
    It's for all setups and JHipster 6 is not yet fully ready for Java 11+ – Gaël Marziou Aug 26 '19 at 04:27

0 Answers0