FIXED: Unable to get REST sample to work [message #1764321] |
Sun, 28 May 2017 09:57 |
|
Hi,
I am at a loss as to how to get the REST service example working with Virgo for Tomcat 3.7.0.RELEASE.
When I try to install the bundle I'm getting the following error:
[2017-05-28 11:32:31.470] ERROR deployer-recovery org.eclipse.virgo.medic.eventlog.default DE0002E Installation of bundle 'org.eclipse.virgo.samples.recipe.restservice' version '0.0.1.SNAPSHOT' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'org.eclipse.virgo.samples.recipe.restservice' at version '0.0.1.SNAPSHOT': Cannot resolve: org.eclipse.virgo.samples.recipe.restservice
Resolver report:
An Import-Package could not be resolved. Resolver error data <Import-Package: com.fasterxml.jackson.annotation; version="0.0.0">. Caused by missing constraint in bundle <org.eclipse.virgo.samples.recipe.restservice_0.0.1.SNAPSHOT>
constraint: <Import-Package: com.fasterxml.jackson.annotation; version="0.0.0">
at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:46)
at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessGraph(StandardPipeline.java:62)
at org.eclipse.virgo.kernel.install.pipeline.internal.CompensatingPipeline.doProcessGraph(CompensatingPipeline.java:73)
at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessGraph(StandardPipeline.java:62)
at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.driveInstallPipeline(PipelinedApplicationDeployer.java:359)
at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.recoverDeployment(PipelinedApplicationDeployer.java:329)
at org.eclipse.virgo.kernel.deployer.core.internal.recovery.RecoveryAgent$1.run(RecoveryAgent.java:71)
at java.lang.Thread.run(Thread.java:745)
This is what my manifest look like:
Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.virgo.samples.recipe.restservice
Built-By: bm
Bundle-ManifestVersion: 2
Bnd-LastModified: 1495953527073
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Import-Package: org.springframework.stereotype,org.springframework.web
.bind.annotation,org.eclipse.virgo.web.dm,com.fasterxml.jackson.annot
ation,com.fasterxml.jackson.core
Import-Bundle: org.springframework.beans,org.springframework.context,o
rg.springframework.core,org.springframework.web,org.springframework.w
ebmvc
Tool: Bnd-3.0.0.201509101326
Export-Package: org.eclipse.virgo.samples.recipe.restservice;version="
0.0.1.SNAPSHOT";uses:="org.springframework.stereotype,org.springframe
work.web.bind.annotation"
Bundle-Version: 0.0.1.SNAPSHOT
Bundle-Name: org.eclipse.virgo.samples.recipe.restservice
Web-ContextPath: /restservice-guide
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_121
I have copied the following files from the gradle cache to "repository/ext":
jackson-core-2.1.2.jar
jackson-annotations-2.1.1.jar
jackson-databind-2.1.2.jar
I first tried them in "repository/usr" but spring was complaining about a missing class:
[2017-05-28 11:48:11.024] INFO start-signalling-2 o.e.v.k.i.artifact.internal.bundle.BundleThreadContextManager Thread context class loader 'KernelBundleClassLoader: [bundle=org.eclipse.virgo.apps.splash_3.7.0.RELEASE]' popped and set to 'org.eclipse.core.runtime.internal.adaptor.ContextFinder@3eb74e9c'
[2017-05-28 11:48:11.967] INFO start-signalling-3 o.a.c.c.C.[Catalina].[localhost].[/restservice-guide] No Spring WebApplicationInitializer types detected on classpath
[2017-05-28 11:48:11.972] INFO start-signalling-3 o.a.c.c.C.[Catalina].[localhost].[/restservice-guide] Initializing Spring root WebApplicationContext
[2017-05-28 11:48:11.972] INFO start-signalling-3 org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization started
[2017-05-28 11:48:11.985] INFO start-signalling-3 o.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext Refreshing ServerOsgiBundleXmlWebApplicationContext(bundle=org.eclipse.virgo.samples.recipe.restservice, config=/WEB-INF/applicationContext.xml): startup date [Sun May 28 11:48:11 CEST 2017]; root of context hierarchy
[2017-05-28 11:48:11.985] INFO start-signalling-3 o.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext Application Context service already unpublished
[2017-05-28 11:48:11.990] INFO start-signalling-3 org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
[2017-05-28 11:48:12.006] INFO start-signalling-3 o.e.virgo.kernel.dmfragment.internal.LoadTimeWeaverPostProcessor Load-time weaving not enabled for bundle 'org.eclipse.virgo.samples.recipe.restservice_0.0.1.SNAPSHOT [135]',
[2017-05-28 11:48:12.007] INFO start-signalling-3 o.e.virgo.kernel.dmfragment.internal.MBeanExporterPostProcessor MBean exporting not enabled for bundle 'org.eclipse.virgo.samples.recipe.restservice_0.0.1.SNAPSHOT [135]',
[2017-05-28 11:48:12.014] INFO start-signalling-3 o.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext Publishing application context as OSGi service with properties {org.eclipse.gemini.blueprint.context.service.name=org.eclipse.virgo.samples.recipe.restservice, org.springframework.context.service.name=org.eclipse.virgo.samples.recipe.restservice, Bundle-SymbolicName=org.eclipse.virgo.samples.recipe.restservice, Bundle-Version=0.0.1.SNAPSHOT}
[2017-05-28 11:48:12.016] INFO iLogServiceListener@55ac6fd2 org.osgi.service.log.LogService Bundle org.eclipse.virgo.samples.recipe.restservice_0.0.1.SNAPSHOT, Service 255, ServiceEvent REGISTERED
[2017-05-28 11:48:12.016] INFO start-signalling-3 org.springframework.web.context.ContextLoader Root WebApplicationContext: initialization completed in 44 ms
[2017-05-28 11:48:12.039] INFO start-signalling-3 o.a.c.c.C.[Catalina].[localhost].[/restservice-guide] Initializing Spring FrameworkServlet 'appServlet'
[2017-05-28 11:48:12.039] INFO start-signalling-3 org.springframework.web.servlet.DispatcherServlet FrameworkServlet 'appServlet': initialization started
[2017-05-28 11:48:12.046] INFO start-signalling-3 org.springframework.web.context.support.XmlWebApplicationContext Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Sun May 28 11:48:12 CEST 2017]; parent: ServerOsgiBundleXmlWebApplicationContext(bundle=org.eclipse.virgo.samples.recipe.restservice, config=/WEB-INF/applicationContext.xml)
[2017-05-28 11:48:12.048] INFO start-signalling-3 org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
[2017-05-28 11:48:12.329] INFO start-signalling-3 o.s.w.servlet.mvc.method.annotation.RequestMappingHandlerMapping Mapped "{[/greeting],methods=[GET],produces=[application/json]}" onto public org.eclipse.virgo.samples.recipe.restservice.Greeting org.eclipse.virgo.samples.recipe.restservice.GreetingController.greeting(java.lang.String)
[2017-05-28 11:48:12.388] WARN start-signalling-3 org.springframework.web.context.support.XmlWebApplicationContext 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': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
[2017-05-28 11:48:12.391] ERROR start-signalling-3 org.springframework.web.servlet.DispatcherServlet Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
I have the feeling that I am missing something pretty basic but this is the first time that I have tried using REST.
[Updated on: Sun, 28 May 2017 19:19] Report message to a moderator
|
|
|
FIXED: Unable to get REST sample to work [message #1764345 is a reply to message #1764321] |
Sun, 28 May 2017 19:18 |
|
I have it working now, and the reason it wasn't working is because the version of the fasterxml bundles has to be in the range [2.6.4,3) .
I downloaded the 2.8.8, copied that into "repository/usr" and everything worked.
So when it was in "repository/ext" the range exception "0.0.0", basically it's existence wasn't correct.
And when it was in "repository/usr" the class not found exception was also incorrect, the optional version dependency in "org.springframework.webmvc" was unresolved.
|
|
|
|
Re: FIXED: Unable to get REST sample to work [message #1765337 is a reply to message #1764363] |
Thu, 08 June 2017 14:21 |
|
Hi Florian,
essentially everything worked out of the box as it was. The only difficulty was finding out what was causing the version issue.
I think that the framework should report a different error other than ClassNotFoundException, especially when the class is available. It would be reasonable to expect that equinox or virgo report that a bundle supplying the "optional" dependency in required version range " [2.6.4,3)" couldn't be resolved.
I'm not sure if that is an equinox based or a virgo based class loader/resolver issue.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03768 seconds