I have an embedded neo4j database (2.1.3) that I am using with Jython 2.7b3. I would like to be able to use the web admin provided by WrappingNeoServerBootstrapper.
My current code is:
from org.neo4j.server import WrappingNeoServerBootstrapper
from org.neo4j.server.configuration import ServerConfigurator
from org.neo4j.graphdb.factory import GraphDatabaseFactory
graphDb = GraphDatabaseFactory().newEmbeddedDatabase('data/')
config = ServerConfigurator(graphDb)
WrappingNeoServerBootstrapper(graphDb, config).start()
However when I try to start WrappingNeoServerBootstrapper I get a very long stack trace which ends on:
Caused by: java.lang.ClassNotFoundException: org.neo4j.server.webadmin.rest.JmxService
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_67]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_67]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_67]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_67]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_67]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_67]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_67]
at com.sun.jersey.api.core.ClassNamesResourceConfig.convertToSet(ClassNamesResourceConfig.java:118) ~[na:na]
... 51 common frames omitted
01:25:32.485 [main] WARN o.e.j.u.component.AbstractLifeCycle - FAILED org.eclipse.jetty.server.Server#53f6812e: javax.servlet.ServletException: org.neo4j.server.web.NeoServletContainer-1365105063#3cbbb0ac==org.neo4j.server.web.NeoServletContainer,-1,false
javax.servlet.ServletException: org.neo4j.server.web.NeoServletContainer-1365105063#3cbbb0ac==org.neo4j.server.web.NeoServletContainer,-1,false
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:563) ~[na:na]
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:351) ~[na:na]
Thankful for any ideas on what I missing?
WrappingNeoServerBootstrapper is deprecated, according to this link. You won't find a word about NeoServerBootstrapper in recent manuals...
the solution should be writing extensions or plugins for neoserver.
You'll need to include these dependencies if you haven't already -
<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<version>${neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<version>${neo4j.version}</version>
<type>jar</type>
<classifier>static-web</classifier>
<scope>compile</scope>
</dependency>
Related
I am trying to implement Swagger for documentation, so that it picks both JSR 303 validation annotations and Spring Webflux based classes.
In Spring Boot project, I am currently using:
Spring Webflux framework for some classes
JSR 303 annotations on domain classes for Bean Validations and Constraints
Swagger integration with Spring Fox framework for generating OpenAPI documentation.
In build.gradle, following dependencies are used and I am able to make Spring Webflux + SpringFox work but only JSR 303 is giving issues:
springBootVersion = '2.0.2.RELEASE'
//JavaX-validation
'javax.validation:validation-api:2.0.0.Final',
'javax.el:javax.el-api:3.0.0',
'org.glassfish.web:javax.el:2.2.6'
//SpringFox-Swagger
'io.springfox:springfox-swagger2:2.9.2',
'io.springfox:springfox-spring-webflux:3.0.0-SNAPSHOT',
'io.github.swagger2markup:swagger2markup-gradle-plugin:1.3.3'
Here is the issue :
When below dependency is added to achieve "Spring Webflux + SpringFox + JSR 303",
**'io.springfox:springfox-bean-validators:2.9.2'**
I am getting the following error,
[WARN ] 2018-11-01 10:16:50.535 [main] SpringApplication - Unable to close ApplicationContext
java.lang.IllegalStateException: Failed to introspect Class
springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader#764c12b6]
at
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at
org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556 ) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.ge tTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:724) ~[spring- beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at
org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:861) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at
org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:810) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
Caused by: java.lang.NoClassDefFoundError:
org/springframework/web/servlet/HandlerMapping
at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:1.8.0_92]
at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[?:1.8.0_92]
at java.lang.Class.getDeclaredMethods(Unknown Source) ~[?:1.8.0_92]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
... 20 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.HandlerMapping
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_92]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_92]
Several blogs say that,SpringBoot version 2x doesn't support JSR 303. I am not sure but I tried to see it doesn't work.
Please advise.
Also, If JSR 303 is not supported currently, what other Validation annotations can be used apart from JSR 303 ?
I don't want to use Swagger core annotations, only because it is messing up code readability.
Add in your pom.xml:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
<scope>compile</compile>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webflux</artifactId>
<version>3.0.0</version>
</dependency>
And use the annotation:
#EnableSwagger2
In you swagger configuration.
Officially springfox doesn't support spring webflux(more informations you can read here: springfox issues).
But you can try SNAPSHOT version like this: webflux-swagger.
As I can see version greater than 2.3.2, support for bean validation annotations:pringfox-support-for-jsr-303.
I exported DataFlow application to Runnable JAR file from Eclipse.
I get below exception when I run the command Desktop$java -jar mariadevconn.jar
Why is the current working directory of command line added to the Google Storage path? Thank you for your help.
org.apache.beam.runners.dataflow.options.DataflowPipelineOptions$StagingLocationFactory create
INFO: No stagingLocation provided, falling back to gcpTempLocation
java.lang.RuntimeException: Failed to construct instance from factory method DataflowRunner#fromOptions(interface org.apache.beam.sdk.options.PipelineOptions)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:233)
at org.apache.beam.sdk.util.InstanceBuilder.build(InstanceBuilder.java:162)
at org.apache.beam.sdk.PipelineRunner.fromOptions(PipelineRunner.java:52)
at org.apache.beam.sdk.Pipeline.create(Pipeline.java:142)
at com.masterconcept.cloud.dataflow.connector.MariaDBConnector.main(MariaDBConnector.java:98)
Caused by: 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:498)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:222)
... 4 more
Caused by: java.lang.IllegalArgumentException: Expected a valid 'gs://' path but was given '/Users/henry/Desktop/gs:/hellodataflowfromhenry/temp/staging/'
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.getGcsPath(GcsPathValidator.java:101)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.verifyPath(GcsPathValidator.java:75)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.validateOutputFilePrefixSupported(GcsPathValidator.java:60)
at org.apache.beam.runners.dataflow.DataflowRunner.fromOptions(DataflowRunner.java:237)
... 9 more
Caused by: java.lang.IllegalArgumentException: Invalid GCS URI: /Users/henry/Desktop/gs:/hellodataflowfromhenry/temp/staging/
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:191)
at org.apache.beam.sdk.util.gcsfs.GcsPath.fromUri(GcsPath.java:116)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.getGcsPath(GcsPathValidator.java:99)
... 12 more
Part of the code:
DataflowPipelineOptions options = PipelineOptionsFactory.fromArgs(argv).withValidation().as(DataflowPipelineOptions.class);
options.setGcpTempLocation("gs://hellodataflowfromhenry/temp");
options.setRunner(DataflowRunner.class);
....
pom.xml:
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-runners-google-cloud-dataflow-java</artifactId>
<version>2.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.cloud.dataflow</groupId>
<artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
<version>2.2.0</version>
</dependency>
work directory:
Desktop$pwd
/Users/henry/Desktop
I have a spring boot application which has rest call to the neo4j. I am using following maven dependency -
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>3.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>3.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.10.2.RELEASE</version>
</dependency>
With Neo4j 2.2.3, Rest App was working fine. After i upgraded Neo4j to 2.3.3, Rest App is not woking. I am getting dependency issue. Maven is not able to download Neo4j 2.3.3 jars, even though i tried with latest version of artifacts for spring-data-neo4j-rest (3.4.4.RELEASE) and spring-data-neo4j(4.0.0.RELEASE).
Please let me know which artifact version of spring-data-neo4j-rest and spring-data-neo4j to use for Neo4j 2.3.3.
Here is the errors which i am getting -
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at com.tpgsi.marvin.graph.neo4j.SampleGraphApp.main(SampleGraphApp.java:37)
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:497)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
at java.lang.Thread.run(Thread.java:745)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.neo4j.core.TypeRepresentationStrategy]: Factory method 'nodeTypeRepresentationStrategy' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeRepresentationStrategyFactory' defined in class com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory]: Factory method 'typeRepresentationStrategyFactory' threw exception; nested exception is java.lang.RuntimeException: Error reading as JSON ''
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeRepresentationStrategyFactory' defined in class com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory]: Factory method 'typeRepresentationStrategyFactory' threw exception; nested exception is java.lang.RuntimeException: Error reading as JSON ''
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:322)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0.typeRepresentationStrategyFactory(<generated>)
at org.springframework.data.neo4j.config.Neo4jConfiguration.nodeTypeRepresentationStrategy(Neo4jConfiguration.java:146)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0.CGLIB$nodeTypeRepresentationStrategy$8(<generated>)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0$$FastClassBySpringCGLIB$$f1f67914.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0.nodeTypeRepresentationStrategy(<generated>)
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:497)
Caused by: java.lang.RuntimeException: Error reading as JSON ''
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:104)
at org.neo4j.rest.graphdb.RequestResult.toMap(RequestResult.java:113)
at org.neo4j.rest.graphdb.query.CypherRestResult.<init>(CypherRestResult.java:36)
at org.neo4j.rest.graphdb.RestAPIImpl.query(RestAPIImpl.java:756)
at org.neo4j.rest.graphdb.RestAPIImpl.query(RestAPIImpl.java:796)
at org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query(RestCypherQueryEngine.java:50)
at org.springframework.data.neo4j.rest.SpringRestCypherQueryEngine.query(SpringRestCypherQueryEngine.java:48)
at org.springframework.data.neo4j.support.ReferenceNodes.executeQuery(ReferenceNodes.java:75)
at org.springframework.data.neo4j.support.ReferenceNodes.getReferenceNode(ReferenceNodes.java:79)
at org.springframework.data.neo4j.support.typerepresentation.SubReferenceNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(SubReferenceNodeTypeRepresentationStrategy.java:95)
at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.chooseStrategy(TypeRepresentationStrategyFactory.java:52)
at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.<init>(TypeRepresentationStrategyFactory.java:35)
at org.springframework.data.neo4j.config.Neo4jConfiguration.typeRepresentationStrategyFactory(Neo4jConfiguration.java:151)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0.CGLIB$typeRepresentationStrategyFactory$2(<generated>)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0$$FastClassBySpringCGLIB$$f1f67914.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at com.tpgsi.marvin.graph.neo4j.Neo4jAppConfiguration$$EnhancerBySpringCGLIB$$41e66ef0.typeRepresentationStrategyFactory(<generated>)
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:497)
Caused by: java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
I just tried to compile a simple hello java program on eclipse ide. An here is the stack trace. I added all the required libraries for struts 2.
java.lang.NoClassDefFoundError: ognl/PropertyAccessor
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:342)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:235)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
<dependency>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>3.1.12</version>
</dependency>
Add this in pom file. While using the thymeleaf starter in spring boot.
You are missing Apache Commons OGNL framework libraries. You can download it from Apache Commons OGNL page.
Dependency Tree:
org.apache.commons:commons-ognl:jar:4.0-SNAPSHOT Information
junit:junit:jar:4.10 (test) Information
org.hamcrest:hamcrest-core:jar:1.1 (test) Information
org.easymock:easymock:jar:2.3 (test) Information
org.javassist:javassist:jar:3.16.1-GA (compile) Information
com.carrotsearch:junit-benchmarks:jar:jdk15:0.3.0 (test) Information
ognl:ognl:jar:3.0.2 (test) Information
javassist:javassist:jar:3.11.0.GA (test) Information
org.slf4j:slf4j-api:jar:1.6.1 (test) Information
com.h2database:h2:jar:1.3.158 (test) Information
I'm trying to migrate an app to JBoss 7.1.1 Final. I was using mojarra 2.0.2 version, as can be seen in pom.xml:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
Using JBoss 7.1.1 Final jsf embedded version (jsf-impl-2.1.7-jbossorg-2), the AS show this Exception:
09:21:16,456 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."Projeto316Aplicacao.ear"."Projeto316Apresentacao-1.0.0-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Projeto316Aplicacao.ear"."Projeto316Apresentacao-1.0.0-SNAPSHOT.war".POST_MODULE: Failed to process phase POST_MODULE of subdeployment "Projeto316Apresentacao-1.0.0-SNAPSHOT.war" of deployment "Projeto316Aplicacao.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [rt.jar:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [rt.jar:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
Caused by: java.lang.NoClassDefFoundError: javax/faces/model/DataModel
at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.6.0_07]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [rt.jar:1.6.0_07]
at java.lang.Class.getConstructor0(Class.java:2699) [rt.jar:1.6.0_07]
at java.lang.Class.getConstructor(Class.java:1657) [rt.jar:1.6.0_07]
at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:108)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.ClassNotFoundException: javax.faces.model.DataModel from [Module "deployment.Projeto316Aplicacao.ear:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [rt.jar:1.6.0_07]
... 11 more
Someone, please, knows why this occours and how to solve it?
Thanks
The solution for the java.lang.NoClassDefFoundError: javax/faces/model/DataModel exception in JBoss AS 7.1.1.Final is exactly what #BalusC said before:
Look like a bug in JBoss classloading:
community.jboss.org/thread/177061 If you provide JSF API/impl in
EAR/lib (which is actually the wrong place), then it's solved. –
BalusC Jan 24 at 12:09
If you are using maven, just put
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<scope>compile</scope>
</dependency>
....
<defaultLibBundleDir>lib</defaultLibBundleDir>
An another solution (It is not a good practice) is replace the jar in jboss-as-7.1.1.Final\modules\com\sun\jsf-impl\main to another implementation of jsf specification.