TERASOLUNA Server Framework for Java (5.x)のTutorialをやってみる 〜3.3. 環境構築〜
遅まきながら触ってみた。
意味もなくnetbeans + glassfish環境でやってみた。
環境を変えると手順通りではできない(当然かw)。
デプロイ時にjackson周りの依存性解決のエラーが出たので、WEB-INF配下にglassfish-web.xmlを追加し、以下の記載を足してみたところ起動した。*1,*2
情報: date:2016-05-03 17:34:34 thread:admin-listener(2) X-Track: level:WARN logger:o.s.web.context.support.XmlWebApplicationContext message:Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoSuchFieldError: WRITE_DURATIONS_AS_TIMESTAMPS
情報: date:2016-05-03 17:34:34 thread:admin-listener(2) X-Track: level:ERROR logger:o.springframework.web.servlet.DispatcherServlet message:Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoSuchFieldError: WRITE_DURATIONS_AS_TIMESTAMPS
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]中略
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoSuchFieldError: WRITE_DURATIONS_AS_TIMESTAMPS
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 70 common frames omitted
Caused by: java.lang.NoSuchFieldError: WRITE_DURATIONS_AS_TIMESTAMPS
at com.fasterxml.jackson.datatype.joda.ser.DurationSerializer.(DurationSerializer.java:28) ~[jackson-datatype-joda-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.datatype.joda.ser.DurationSerializer.(DurationSerializer.java:25) ~[jackson-datatype-joda-2.6.4.jar:2.6.4]
at com.fasterxml.jackson.datatype.joda.JodaModule.(JodaModule.java:45) ~[jackson-datatype-joda-2.6.4.jar:2.6.4]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_51]後略
以下の記載があるが、helloメソッドではなく、homeメソッドが正しいか。
"/"というパスに対してtodo.app.welcome.HomeControllerのhelloメソッドがマッピングされていることが分かる。