これを診断するために使用できる戦略を誰かが提案してくれることを願っています。spring-boot maven プラグインのバグである可能性があると思います。
永続化のために neo4j-ogm を使用するアプリケーションに取り組んでいます。
Eclipse で起動するか、実行可能な jar として起動すると、アプリケーションが起動して問題なく動作します。
それを使用して起動するmvn spring-boot:run
と、機能せず、次のスタック トレースがスローされます。
spring-boot maven プラグインが誤って実行している可能性があることについての指針はありますか?
21:05:56.553 [nz.co.********.console.main.Application.main()] INFO o.s.b.a.l.AutoConfigurationReportLoggingInitializer -
Error starting ApplicationContext. To display the auto-configuration report enable debug logging (start with --debug)
21:05:56.602 [nz.co.********.console.main.Application.main()] ERROR o.s.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:676) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:691) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at nz.co.********.console.main.Application.main(Application.java:15) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418) [spring-boot-maven-plugin-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
Caused by: java.lang.NullPointerException: null
at org.neo4j.ogm.session.response.SessionResponseHandler.lookup(SessionResponseHandler.java:158) ~[neo4j-ogm-1.1.2.jar:na]
at org.neo4j.ogm.session.response.SessionResponseHandler.loadById(SessionResponseHandler.java:152) ~[neo4j-ogm-1.1.2.jar:na]
at org.neo4j.ogm.session.delegates.LoadOneDelegate.load(LoadOneDelegate.java:45) ~[neo4j-ogm-1.1.2.jar:na]
at org.neo4j.ogm.session.Neo4jSession.load(Neo4jSession.java:104) ~[neo4j-ogm-1.1.2.jar:na]
at nz.co.********.core.MemberAccountService.loadMemberByEmailAddressPasswordAccount(MemberAccountService.java:126) ~[********-core-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
at nz.co.********.console.menu.Menu.login(Menu.java:33) ~[classes/:na]
at nz.co.********.console.menu.Menu.login(Menu.java:95) ~[classes/:na]
at nz.co.********.console.menu.MainMenu.processUserInput(MainMenu.java:110) ~[classes/:na]
at nz.co.********.console.menu.Menu.processUserInput(Menu.java:79) ~[classes/:na]
at nz.co.********.console.main.ConsoleUI.run(ConsoleUI.java:65) ~[classes/:na]
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:673) ~[spring-boot-1.2.6.RELEASE.jar:1.2.6.RELEASE]
... 9 common frames omitted
21:05:56.604 [nz.co.********.console.main.Application.main()] INFO o.s.c.a.AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@327b0992: startup date [Thu Sep 24 21:05:40 CEST 2015]; root of context hierarchy
21:05:56.642 [nz.co.********.console.main.Application.main()] INFO o.s.j.e.a.AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:676)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
at nz.co.********.console.main.Application.main(Application.java:15)
... 6 more
Caused by: java.lang.NullPointerException
at org.neo4j.ogm.session.response.SessionResponseHandler.lookup(SessionResponseHandler.java:158)
at org.neo4j.ogm.session.response.SessionResponseHandler.loadById(SessionResponseHandler.java:152)
at org.neo4j.ogm.session.delegates.LoadOneDelegate.load(LoadOneDelegate.java:45)
at org.neo4j.ogm.session.Neo4jSession.load(Neo4jSession.java:104)
at nz.co.********.core.MemberAccountService.loadMemberByEmailAddressPasswordAccount(MemberAccountService.java:126)
at nz.co.********.console.menu.Menu.login(Menu.java:33)
at nz.co.********.console.menu.Menu.login(Menu.java:95)
at nz.co.********.console.menu.MainMenu.processUserInput(MainMenu.java:110)
at nz.co.********.console.menu.Menu.processUserInput(Menu.java:79)
at nz.co.********.console.main.ConsoleUI.run(ConsoleUI.java:65)
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:673)
... 9 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.938 s
[INFO] Finished at: 2015-09-24T21:05:56+01:00
[INFO] Final Memory: 34M/594M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.6.RELEASE:run (default-cli) on project ********-console: An exception occured while running. null: InvocationTargetException: Failed to execute CommandLineRunner: NullPointerException -> [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/MojoExecutionException
追加情報
実行可能なjarとして開始すると、次のように出力されます。
16:50:54.854 [main] INFO o.n.o.m.info.ClassFileProcessor - 34 classes loaded in 1927 milliseconds
mvn spring-boot:run
プリントアウトから始めます:
17:02:02.250 [nz.co.********.console.main.Application.main()] INFO o.n.o.m.info.ClassFileProcessor - 0 classes loaded in 3 milliseconds
セッション ファクトリ コード
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;
@Component
public class Neo4jSessionFactory implements FactoryBean<Session> {
private final static SessionFactory sessionFactory = new SessionFactory("nz.co.*****.pojos");
@Inject private CoreProperties config;
private Logger logger = Logger.getLogger(this.getClass);
@Override
public Session getObject() {
return sessionFactory.openSession(config.getHost(), config.getUsername(), config.getPassword());
}
@Override
public Class<?> getObjectType() {
return Session.class;
}
@Override
public boolean isSingleton() {
return false;
}
@PostConstruct
public void printInfo() {
logger.info("DbLocation: " + config.getHost());
}
}