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

NoSuchMethodError while hot reload #408

Closed
c0nscience opened this issue Jun 28, 2014 · 6 comments
Closed

NoSuchMethodError while hot reload #408

c0nscience opened this issue Jun 28, 2014 · 6 comments
Milestone

Comments

@c0nscience
Copy link

Hello,

I updated to the last generator version and rerun it on my project. I also updated the jvm agent.
Now I got this exception while reloading:

Exception in thread "Thread-7" java.lang.NoSuchMethodError: liquibase.structure.core.Schema.setDefault(Ljava/lang/Boolean;)Lliquibase/structure/core/Schema;
    at liquibase.ext.hibernate.snapshot.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:21)
    at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:69)
    at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
    at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:72)
    at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
    at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:72)
    at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
    at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:72)
    at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
    at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:89)
    at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:34)
    at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:21)
    at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:125)
    at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:121)
    at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:109)
    at liquibase.diff.DiffGeneratorFactory.compare(DiffGeneratorFactory.java:71)
    at liquibase.Liquibase.diff(Liquibase.java:851)
    at io.github.jhipster.loaded.reloader.LiquibaseReloader.reload(LiquibaseReloader.java:152)
    at io.github.jhipster.loaded.JHipsterReloaderThread.batchReload(JHipsterReloaderThread.java:206)
    at io.github.jhipster.loaded.JHipsterReloaderThread.run(JHipsterReloaderThread.java:153)
    at java.lang.Thread.run(Thread.java:745)

I actually don't know how to solve this.

@c0nscience
Copy link
Author

hmm ok for some reason there was a pretty old version of the liquibase-core used, where the method was not present. now I force via the liquibase.version property to use the latest version, so the method is present.

@c0nscience
Copy link
Author

Nope that does not work ... now I got another exception -.-

Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.webapp.WebAppContext
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 21 more

@c0nscience
Copy link
Author

I got the NoSuchMethodError also in a fresh created jhipster project. Something is messed up with the dependencies ...

@cagreek
Copy link

cagreek commented Jul 6, 2014

First of all I want to thank the team that has brought JHIPSTER to life. Fantastic!!!!

I am having the same issue with the latest version generated using the yeoman generator:

Environment: Latest Version of SPRING STS (Version: 3.6.0.M1), Windows 7, Java 8 JDK

Scenario: So I'm basically following the example creating a yeomen generated-jhipster application using mysql database for dev and prod. everything generates perfectly and i am able to run the application line using mvn spring-boot:run and from the spring sts. The following log is from STS. STS is configured to use the start up VM Arguments for the Application.java class for hot reload functionality.

-javaagent:spring_loaded/springloaded-jhipster.jar
-noverify
-Dspringloaded=plugins=io.github.jhipster.loaded.instrument.JHipsterLoadtimeInstrumentationPlugin

entered the following commnad in windows CMD window:
yo jhipster:entity foo

all the classes: domain, repository, rest was created but no database table in the mysql database schema called jhipster05.

ran another command line for

yo jhipster:entity food and that is what the following log:

Looking for some help, to figure out if its my set up or if its a bug somewhere with liquibase?

The following snippet is the error I see in STS when I attempt to refresh the project. Running the command line above creates the classes but for some reason the java agent for the file watcher that is looking at the class changes doesn't do anything unless you right click the project and select REFRESH. once you do that I get the following error.

Exception in thread "Thread-7" java.lang.NoSuchMethodError: liquibase.structure.core.Schema.setDefault(Ljava/lang/Boolean;)Lliquibase/structure/core/Schema

Full LOG:

[INFO] com.jhipster05.myapp.Application - Starting Application on a-HP with PID 2864 (C:\Users\a\Documents\workspace-sts-3.3.0.RELEASE\test02$GeneratedCodeTests\jhipster_05\target\classes started by a in C:\Users\a\Documents\workspace-sts-3.3.0.RELEASE\test02$GeneratedCodeTests\jhipster_05)
[DEBUG] com.jhipster05.myapp.Application - Running with Spring Boot v1.1.3.RELEASE, Spring v4.0.5.RELEASE
[DEBUG] org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
[DEBUG] com.jhipster05.myapp.config.AsyncConfiguration - Creating Async Task Executor
[DEBUG] com.jhipster05.myapp.config.DatabaseConfiguration - Configuring Liquibase
[DEBUG] com.jhipster05.myapp.config.DatabaseConfiguration - Configuring Datasource
[WARN] org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [com.jhipster05.myapp.domain.Foo]; using defaults.
[WARN] org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory - HHH020003: Could not find a specific ehcache configuration for cache named [com.jhipster05.myapp.domain.Thedoors]; using defaults.
[DEBUG] com.jhipster05.myapp.config.MetricsConfiguration - Registring JVM gauges
[INFO] com.jhipster05.myapp.config.MetricsConfiguration - Initializing Metrics JMX reporting
[DEBUG] com.jhipster05.myapp.config.CacheConfiguration - Starting Ehcache
[DEBUG] com.jhipster05.myapp.config.CacheConfiguration - Registring Ehcache Metrics gauges
[INFO] com.jhipster05.myapp.config.ThymeleafConfiguration - loading non-reloadable mail messages resources
[DEBUG] com.jhipster05.myapp.config.MailConfiguration - Configuring mail server
[INFO] com.jhipster05.myapp.config.WebConfigurer - Web application configuration, using profiles: [dev]
[DEBUG] com.jhipster05.myapp.config.WebConfigurer - Initializing Metrics registries
[DEBUG] com.jhipster05.myapp.config.WebConfigurer - Registering Metrics Filter
[DEBUG] com.jhipster05.myapp.config.WebConfigurer - Registering Metrics Servlet
[DEBUG] com.jhipster05.myapp.config.WebConfigurer - Registering GZip Filter
[INFO] com.jhipster05.myapp.config.WebConfigurer - Web application fully configured
[INFO] com.jhipster05.myapp.Application - Running with Spring profile(s) : [dev]
[DEBUG] com.jhipster05.myapp.aop.logging.LoggingAspect - Enter: com.jhipster05.myapp.repository.CustomAuditEventRepository.auditEventRepository() with argument[s] = []
[DEBUG] com.jhipster05.myapp.aop.logging.LoggingAspect - Exit: com.jhipster05.myapp.repository.CustomAuditEventRepository.auditEventRepository() with result = com.jhipster05.myapp.repository.CustomAuditEventRepository$1@71b9b035
[INFO] io.github.jhipster.loaded.JHipsterReloaderAutoConfiguration - Spring Loaded is running, registering hot reloading features
[DEBUG] io.github.jhipster.loaded.reloader.JacksonReloader - Hot reloading Jackson enabled
[DEBUG] io.github.jhipster.loaded.reloader.LiquibaseReloader - Hot reloading JPA & Liquibase enabled
[DEBUG] io.github.jhipster.loaded.reloader.SpringReloader - Hot reloading Spring Beans enabled
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'src\main\java\com\jhipster05\myapp\domain' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'src\main\java\com\jhipster05\myapp\domain\util' will be monitored for changes
[ERROR] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Failed to register the directory 'src\main\java\com\jhipster05\myapp\dto'
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'src\main\java\com\jhipster05\myapp\repository' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'src\main\java\com\jhipster05\myapp\web\rest' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'src\main\java\com\jhipster05\myapp\web\rest\dto' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\aop' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\aop\logging' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\async' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\config' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\config\apidoc' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\config\audit' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\config\locale' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\config\metrics' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\domain' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\domain\util' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\repository' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\security' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\service' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\service\util' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\web' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\web\filter' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\web\filter\gzip' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\web\propertyeditors' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\web\rest' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\com\jhipster05\myapp\web\rest\dto' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\config' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\config\liquibase' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\config\liquibase\changelog' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\i18n' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\mails' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\mails\messages' will be monitored for changes
[DEBUG] io.github.jhipster.loaded.JHipsterFileSystemWatcher - Directory : 'target\classes\templates' will be monitored for changes
[INFO] com.jhipster05.myapp.Application - Started Application in 45.264 seconds (JVM running for 47.743)
[DEBUG] io.github.jhipster.loaded.listener.filewatcher.NewClassLoaderListener - JHipster reload - Start to reload the new class 'C:\Users\a\Documents\workspace-sts-3.3.0.RELEASE\test02$GeneratedCodeTests\jhipster_05\target\classes\com\jhipster05\myapp\domain\Food.class'
[DEBUG] io.github.jhipster.loaded.listener.filewatcher.NewClassLoaderListener - JHipster reload - Start to reload the new class 'C:\Users\a\Documents\workspace-sts-3.3.0.RELEASE\test02$GeneratedCodeTests\jhipster_05\target\classes\com\jhipster05\myapp\repository\FoodRepository.class'
[DEBUG] io.github.jhipster.loaded.listener.filewatcher.NewClassLoaderListener - JHipster reload - Start to reload the new class 'C:\Users\a\Documents\workspace-sts-3.3.0.RELEASE\test02$GeneratedCodeTests\jhipster_05\target\classes\com\jhipster05\myapp\web\rest\FoodResource.class'
[INFO] io.github.jhipster.loaded.JHipsterReloaderThread - Batch reload has been triggered, waiting for new classes for 250 ms
[INFO] io.github.jhipster.loaded.JHipsterReloaderThread - Batch reload in progress...
[DEBUG] io.github.jhipster.loaded.JHipsterReloaderThread - There are 1 Spring entities updated, adding them to be reloaded
[DEBUG] io.github.jhipster.loaded.reloader.JacksonReloader - Hot reloading Jackson classes
[DEBUG] io.github.jhipster.loaded.JHipsterReloaderThread - There are 1 Spring entities updated, adding them to be reloaded
[DEBUG] io.github.jhipster.loaded.reloader.LiquibaseReloader - Hot reloading JPA & Liquibase classes
[INFO] liquibase-hibernate - Reading hibernate configuration hibernate:spring:com.jhipster05.myapp.domain?dialect=org.hibernate.dialect.MySQLInnoDBDialect
[INFO] io.github.jhipster.loaded.reloader.LiquibaseReloader - Found package com.jhipster05.myapp.domain
[INFO] io.github.jhipster.loaded.reloader.LiquibaseReloader - Found dialect org.hibernate.dialect.MySQLInnoDBDialect
[INFO] liquibase-hibernate - Using dialect org.hibernate.dialect.MySQLInnoDBDialect
Exception in thread "Thread-7" java.lang.NoSuchMethodError: liquibase.structure.core.Schema.setDefault(Ljava/lang/Boolean;)Lliquibase/structure/core/Schema;
at liquibase.ext.hibernate.snapshot.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:21)
at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:69)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:72)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:72)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
at liquibase.ext.hibernate.snapshot.HibernateSnapshotGenerator.snapshot(HibernateSnapshotGenerator.java:72)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:89)
at liquibase.snapshot.DatabaseSnapshot.(DatabaseSnapshot.java:34)
at liquibase.snapshot.JdbcDatabaseSnapshot.(JdbcDatabaseSnapshot.java:21)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:125)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:121)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:109)
at liquibase.diff.DiffGeneratorFactory.compare(DiffGeneratorFactory.java:71)
at liquibase.Liquibase.diff(Liquibase.java:851)
at io.github.jhipster.loaded.reloader.LiquibaseReloader.reload(LiquibaseReloader.java:152)
at io.github.jhipster.loaded.JHipsterReloaderThread.batchReload(JHipsterReloaderThread.java:206)
at io.github.jhipster.loaded.JHipsterReloaderThread.run(JHipsterReloaderThread.java:153)
at java.lang.Thread.run(Unknown Source)


-- application-dev.yml

server:
port: 8080

spring:
profiles: dev

datasource:
    dataSourceClassName: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
    url: jdbc:mysql://localhost:3306/jhipster05
    databaseName: 
    serverName: 
    username: root
    password: ********

jpa:
    database-platform: org.hibernate.dialect.MySQLInnoDBDialect
    database: MYSQL
    openInView: false
    show_sql: true
    generate-ddl: false
    hibernate:
        ddl-auto: none
        naming-strategy: org.hibernate.cfg.EJB3NamingStrategy
    properties:
        hibernate.cache.use_second_level_cache: true
        hibernate.cache.use_query_cache: false
        hibernate.generate_statistics: true
        hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory

mail:
    baseUrl: http://localhost:8080

thymeleaf:
    mode: XHTML
    cache: false

metrics:
jmx.enabled: true
graphite:
enabled: false
host: localhost
port: 2003

cache:
timeToLiveSeconds: 3600
ehcache:
maxBytesLocalHeap: 16M

You can add as many as folders to watch

You just need to add a dash + the directory to watch

hotReload:
enabled: true
package:
project: com.jhipster05.myapp
domain: com.jhipster05.myapp.domain
restdto: com.jhipster05.myapp.web.rest.dto
liquibase:
defaultCatalogName: jhipster05
defaultSchema: jhipster05
excludeTables:
watchdir:
- src/main/java/com/jhipster05/myapp/domain
- src/main/java/com/jhipster05/myapp/dto
- src/main/java/com/jhipster05/myapp/repository
- src/main/java/com/jhipster05/myapp/web/rest
- target/classes

@jmirc
Copy link
Member

jmirc commented Jul 9, 2014

I am closing this issue because it is a duplicate of the bug #413

@jftsaraiva
Copy link

Hi,

I'm having the same problem with a fresh project created with version 1.0.0

I verified the pom.xml and application-dev.yml as it was as suggested in #413

What could be wrong?

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