java.lang.IllegalArgumentException: Could not locate 'Pizza' in compilation unit

Spring JIRA | Andrew Swan | 5 years ago
  1. 0

    To recreate this issue, run these commands in development mode: {code}project --topLevelPackage com.example persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY{code} Then with the shell still running, create a new Java class as follows: {code}package com.example.domain; public class Pizza { }{code} The shell throws this error: {code}Parsing failure for '/Users/aswan/projects/bugs/jpa/src/main/java/com/example/domain/Pizza.java' (development mode diagnostics) java.lang.IllegalArgumentException: Could not locate 'Pizza' in compilation unit at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.classpath.javaparser.JavaParserClassMetadata.<init>(JavaParserClassMetadata.java:67) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.get(JavaParserMetadataProvider.java:152) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:216) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:268) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:149) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:236) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:214) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:330) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:304) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:178) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:125) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:240) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:68) at java.lang.Thread.run(Thread.java:680) {code}

    Spring JIRA | 5 years ago | Andrew Swan
    java.lang.IllegalArgumentException: Could not locate 'Pizza' in compilation unit
  2. 0

    To recreate this issue, run these commands in development mode: {code}project --topLevelPackage com.example persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY{code} Then with the shell still running, create a new Java class as follows: {code}package com.example.domain; public class Pizza { }{code} The shell throws this error: {code}Parsing failure for '/Users/aswan/projects/bugs/jpa/src/main/java/com/example/domain/Pizza.java' (development mode diagnostics) java.lang.IllegalArgumentException: Could not locate 'Pizza' in compilation unit at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.classpath.javaparser.JavaParserClassMetadata.<init>(JavaParserClassMetadata.java:67) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.get(JavaParserMetadataProvider.java:152) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:216) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:268) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:149) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:236) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:214) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:330) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:304) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:178) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:125) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:240) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:68) at java.lang.Thread.run(Thread.java:680) {code}

    Spring JIRA | 5 years ago | Andrew Swan
    java.lang.IllegalArgumentException: Could not locate 'Pizza' in compilation unit
  3. 0

    *There are valid Java packages not accepted by Roo* For example: {quote} org.gvnix._2009_03_31 {quote} Underscores and numbers are valid Java identifiers for package, however Roo throws an error when classes on this package are managed. {code} java.lang.IllegalArgumentException: The first letter of the type name portion must be uppercase (attempted 'org.gvnix._2009_03_31') at org.springframework.roo.model.JavaType.<init>(JavaType.java:120) at org.springframework.roo.model.JavaType.<init>(JavaType.java:91) at org.springframework.roo.model.JavaType.getEnclosingType(JavaType.java:293) at org.springframework.roo.model.JavaType.getPackage(JavaType.java:260) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.<init>(JavaParserMutableClassOrInterfaceTypeDetails.java:125) at org.springframework.roo.classpath.javaparser.JavaParserClassMetadata.<init>(JavaParserClassMetadata.java:70) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.get(JavaParserMetadataProvider.java:146) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:133) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:151) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:209) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:126) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:170) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:262) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:124) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:354) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:327) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:167) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:114) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:225) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:75) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) {code} *There are valid Java types not accepted by Roo* For example: {quote} JAXB data binding library generates a package-info.java class. {quote} Java classes starting with lowercase letter are discouraged but accepted.

    Spring JIRA | 6 years ago | Mario Martínez Sánchez - gvNIX - DISID
    java.lang.IllegalArgumentException: The first letter of the type name portion must be uppercase (attempted 'org.gvnix._2009_03_31')
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    refined from ROO-1900; upgrade to Roo-1.1.1 creates new failure: The problem is caused by 'complex' String literal, as used in RequestMapping static final String URLPATH="myService"; @RequestMapping("/"+URLPATH) To reproduce: > cd rootest > roo-dev roo> project --topLevelPackage mypkg Then save this file in rootest/src/main/java/mypkg/MyService.java package mypkg; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; public interface MyService { final static String URLPATH = "myService"; @Controller @RequestMapping("/"+URLPATH) public static class Cont implements MyService {} } [Timer-0] Parsing failure for 'C:\Data\Programs\java\rootest\src\main\java\mypkg\MyService.java' (development mode diagnostics) java.lang.IllegalArgumentException: Object of class [japa.parser.ast.expr.NameExpr] must be an instance of class japa.parser.ast.expr.StringLiteralExpr at org.springframework.roo.support.util.Assert.isInstanceOf(Assert.java:337) at org.springframework.roo.support.util.Assert.isInstanceOf(Assert.java:319) at org.springframework.roo.classpath.javaparser.details.JavaParserAnnotationMetadata.convert(JavaParserAnnotationMetadata.java:159) at org.springframework.roo.classpath.javaparser.details.JavaParserAnnotationMetadata.<init>(JavaParserAnnotationMetadata.java:98) at org.springframework.roo.classpath.javaparser.JavaParserClassOrInterfaceTypeDetails.<init>(JavaParserClassOrInterfaceTypeDetails.java:258) at org.springframework.roo.classpath.javaparser.JavaParserClassOrInterfaceTypeDetails.<init>(JavaParserClassOrInterfaceTypeDetails.java:297) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.<init>(JavaParserMutableClassOrInterfaceTypeDetails.java:55) at org.springframework.roo.classpath.javaparser.JavaParserClassMetadata.<init>(JavaParserClassMetadata.java:69) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.get(JavaParserMetadataProvider.java:163) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:136) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:179) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:183) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:136) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:112) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:199) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:262) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:141) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:344) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:318) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:175) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:122) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:233) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:75) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) roo> Possible Workaround: static final String URLPATH="myService"; static final String URLPATH2="/"+URLPATH; @RequestMapping(URLPATH2) ... amazingly parse shows no error for this computed string: @RequestMapping("/"+"myService")

    Spring JIRA | 6 years ago | Jack Punt
    java.lang.IllegalArgumentException: Object of class [japa.parser.ast.expr.NameExpr] must be an instance of class japa.parser.ast.expr.StringLiteralExpr
  6. 0

    To replicate: # create a simple project with at least one "leaf" entity, i.e. no references to other entities # scaffold the MVC layer in the normal way, e.g. using "{{web mvc all --package ~.web}}" # delete the above entity's {{.java}} file (e.g. {{Foo.java}} in the attached demo project) # the MVC addon throws this stack trace (instead of quietly adjusting the MVC layer): {code}[Spring Roo Process Manager Background Polling Thread] Deleted SRC_MAIN_JAVA/com/foo/bar/domain/Foo_Roo_ToString.aj [Spring Roo Process Manager Background Polling Thread] Deleted SRC_MAIN_JAVA/com/foo/bar/domain/Foo_Roo_Jpa_Entity.aj [Spring Roo Process Manager Background Polling Thread] Deleted SRC_MAIN_JAVA/com/foo/bar/domain/Foo_Roo_Entity.aj [Spring Roo Process Manager Background Polling Thread] Deleted SRC_MAIN_JAVA/com/foo/bar/domain/Foo_Roo_Configurable.aj [Spring Roo Process Manager Background Polling Thread] Unable to obtain physical type metadata for type com.foo.bar.domain.Foo java.lang.IllegalArgumentException: Unable to obtain physical type metadata for type com.foo.bar.domain.Foo at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.addon.web.mvc.controller.scaffold.finder.WebFinderMetadataProviderImpl.getMetadata(WebFinderMetadataProviderImpl.java:59) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:318) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147) at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:149) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:236) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:191) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:330) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:304) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:178) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:125) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:240) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:68) at java.lang.Thread.run(Thread.java:680){code}

    Spring JIRA | 5 years ago | Andrew Swan
    java.lang.IllegalArgumentException: Unable to obtain physical type metadata for type com.foo.bar.domain.Foo

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Could not locate 'Pizza' in compilation unit

      at org.springframework.roo.support.util.Assert.notNull()
    2. org.springframework.roo
      DefaultProcessManager$2.run
      1. org.springframework.roo.support.util.Assert.notNull(Assert.java:112)
      2. org.springframework.roo.classpath.javaparser.JavaParserClassMetadata.<init>(JavaParserClassMetadata.java:67)
      3. org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.get(JavaParserMetadataProvider.java:152)
      4. org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147)
      5. org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81)
      6. org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:216)
      7. org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:268)
      8. org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:147)
      9. org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:81)
      10. org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:149)
      11. org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:236)
      12. org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:214)
      13. org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131)
      14. org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:330)
      15. org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:304)
      16. org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:178)
      17. org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:125)
      18. org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:240)
      19. org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:68)
      19 frames
    3. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:680)
      1 frame