I have to create my own plugin to parse xml and do other stuff. I've created my own bundle plugin that will contain my parser class, pom.xml below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.mycompany.myproject</groupId>
<artifactId>core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>core</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>pl.mycompany.myproject.page.components.*;version=${pom.version}</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-api</artifactId>
<version>5.6.4</version>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-commons</artifactId>
<version>5.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.0.4-incubator</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.json</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
After that I want to create class that will parse xml and I want to use org.apache.xerces package.
I've also created other bundle that contains org.apache.xerces jar and I've installed it and it is active in http://myhost.com:4502/system/console/bundles.
When I want to declare DOMParser variable in Java class in core plugin (pom.xml above):
package pl.mycompany.myproject.page.components;
import java.util.Date;
import org.apache.sling.api.resource.Resource;
import org.apache.xerces.parsers.DOMParser;
enter code here
public class EqAndSpecParser {
private Resource resource;
public EqAndSpecParser(Resource resource) {
this.resource = resource;
}
public void checkIfNeedToUpdate(Date lastModifiedDate, String lastGenerationDate, String xmlCode) {
try {
DOMParser parser = new DOMParser();
parser.parse(xmlCode);
} catch (Exception e) {
e.printStackTrace();
}
}
public Resource getResource() {
return resource;
}
public void setResource(Resource resource) {
this.resource = resource;
}
}
Then I get error in /crx-quickstart/logs/:
FULL EXCEPTION:
org.apache.sling.api.scripting.ScriptEvaluationException: An exception occurred processing JSP page /apps/myproject/components/specifications-and-equipment/specifications-and-equipment.jsp at line 16
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:184)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:151)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:244)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:294)
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:216)
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:103)
at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:406)
at org.apache.sling.scripting.jsp.taglib.IncludeTagHandler.dispatch(IncludeTagHandler.java:49)
at org.apache.sling.scripting.jsp.taglib.AbstractDispatcherTagHandler.doEndTag(AbstractDispatcherTagHandler.java:129)
at org.apache.jsp.libs.foundation.components.parsys.parsys_jsp._jspService(parsys_jsp.java:313)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:184)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:151)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:244)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:294)
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:216)
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:103)
at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:406)
at com.day.cq.wcm.tags.IncludeTag.includeResource(IncludeTag.java:224)
at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:91)
at org.apache.jsp.apps.myproject.components.contentpage_002d100_002d20_002d60_002d20.content_jsp._jspx_meth_cq_005finclude_005f3(content_jsp.java:276)
at org.apache.jsp.apps.myproject.components.contentpage_002d100_002d20_002d60_002d20.content_jsp._jspService(content_jsp.java:174)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
at com.day.cq.wcm.tags.IncludeTag.includeScript(IncludeTag.java:167)
at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:87)
at org.apache.jsp.apps.myproject.components.page.body_jsp._jspx_meth_cq_005finclude_005f2(body_jsp.java:308)
at org.apache.jsp.apps.myproject.components.page.body_jsp._jspService(body_jsp.java:228)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
at com.day.cq.wcm.tags.IncludeTag.includeScript(IncludeTag.java:167)
at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:87)
at org.apache.jsp.libs.foundation.components.page.page_jsp._jspx_meth_cq_005finclude_005f1(page_jsp.java:207)
at org.apache.jsp.libs.foundation.components.page.page_jsp._jspService(page_jsp.java:161)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:184)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:151)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:244)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:294)
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:216)
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:103)
at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:406)
at org.apache.jsp.libs.foundation.components.primary.cq.Page.Page_jsp._jspService(Page_jsp.java:106)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:148)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:333)
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:160)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:254)
at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:64)
at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:106)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:290)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:59)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:220)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.theme.impl.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:76)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:74)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at com.day.cq.wcm.designimporter.CanvasPageDeleteRequestFilter.doFilter(CanvasPageDeleteRequestFilter.java:87)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:127)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServletStarterFilter.java:135)
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:60)
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processRequest(SlingRequestProcessorImpl.java:151)
at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:206)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:96)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:127)
at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:179)
at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:259)
at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:55)
at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)
at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:47)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:48)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.day.j2ee.servletengine.ServletRuntimeEnvironment.service(ServletRuntimeEnvironment.java:250)
at com.day.j2ee.servletengine.RequestDispatcherImpl.doFilter(RequestDispatcherImpl.java:321)
at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:340)
at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:383)
at com.day.j2ee.servletengine.ServletHandlerImpl.process(ServletHandlerImpl.java:360)
at com.day.j2ee.servletengine.HttpListener$Worker.run(HttpListener.java:644)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.sling.api.SlingException: An exception occurred processing JSP page /apps/myproject/components/specifications-and-equipment/specifications-and-equipment.jsp at line 16
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:683)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:525)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:241)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:86)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:441)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
... 183 more
Caused by: java.lang.NoClassDefFoundError: org/apache/xerces/parsers/DOMParser
at org.apache.jsp.apps.myproject.components.specifications_002dand_002dequipment.specifications_002dand_002dequipment_jsp._jspService(specifications_002dand_002dequipment_jsp.java:165)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
... 188 more
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.DOMParser not found by pl.mycompany.myproject.core [291]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1499)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1882)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 192 more
DOMParser is just example class that I want to use. In my project I will need to use external jars from the other providers, that is just POC. The main question is: How to use external jars in CQ5? How to install them into CQ that all custom plugins would use these jars?
When I changed xerces dependency to
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.0</version>
<scope>compile</scope>
</dependency>
and I added <Embed-Dependency>xercesImpl;scope=compile</Embed-Dependency>
now I get error like:
25.09.2013 11:15:49.206 *INFO* [JcrInstaller.1]
org.apache.sling.installer.provider.jcr.impl.JcrInstaller Registering resource with OSGi installer: [InstallableResource, priority=200, id=/apps/myproject/install/core-1.0.0-SNAPSHOT.jar]
25.09.2013 11:15:49.231 *INFO* [OsgiInstallerImpl] pl.mycompany.myproject.core BundleEvent UNRESOLVED
25.09.2013 11:15:49.231 *INFO* [OsgiInstallerImpl] pl.mycompany.myproject.core BundleEvent UPDATED
25.09.2013 11:15:49.233 *INFO* [OsgiInstallerImpl] org.apache.sling.audit.osgi.installer Updated bundle pl.mycompany.myproject.core [291] from resource TaskResource(url=jcrinstall:/apps/myproject/install/core-1.0.0-SNAPSHOT.jar, entity=bundle:pl.mycompany.myproject.core, state=INSTALL, attributes=[org.apache.sling.installer.api.tasks.ResourceTransformer=:50:16:, Bundle-SymbolicName=pl.mycompany.myproject.core, Bundle-Version=1.0.0.SNAPSHOT], digest=1380100548768)
25.09.2013 11:15:49.234 *INFO* [OsgiInstallerImpl] org.apache.sling.audit.osgi.installer Refreshing 1 bundles: [pl.mycompany.myproject.core [291]]
25.09.2013 11:15:49.234 *INFO* [OsgiInstallerImpl] org.apache.sling.audit.osgi.installer Waiting up to 90 seconds for bundles refresh
25.09.2013 11:15:49.234 *INFO* [OsgiInstallerImpl] org.apache.sling.audit.osgi.installer Done refreshing 1 bundles
25.09.2013 11:15:49.234 *INFO* [FelixDispatchQueue] org.apache.felix.framework FrameworkEvent PACKAGES REFRESHED
25.09.2013 11:15:49.235 *INFO* [FelixDispatchQueue] org.apache.felix.framework FrameworkEvent PACKAGES REFRESHED
25.09.2013 11:15:49.235 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle pl.mycompany.myproject.core [291]. Reason: org.osgi.framework.BundleException: Unresolved constraint in bundle pl.mycompany.myproject.core [291]: Unable to resolve 291.34: missing requirement [291.34] osgi.wiring.package; (osgi.wiring.package=org.apache.xml.resolver). Will retry.
25.09.2013 11:15:49.235 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.RestartActiveBundlesTask Unable to start bundle pl.mycompany.myproject.core [291] : Unresolved constraint in bundle pl.mycompany.myproject.core [291]: Unable to resolve 291.34: missing requirement [291.34] osgi.wiring.package; (osgi.wiring.package=org.apache.xml.resolver)
25.09.2013 11:15:49.248 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle pl.mycompany.myproject.core [291]. Reason: org.osgi.framework.BundleException: Unresolved constraint in bundle pl.mycompany.myproject.core [291]: Unable to resolve 291.34: missing requirement [291.34] osgi.wiring.package; (osgi.wiring.package=org.apache.xml.resolver). Will retry.
25.09.2013 11:15:49.249 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.RestartActiveBundlesTask Unable to start bundle pl.mycompany.myproject.core [291] : Unresolved constraint in bundle pl.mycompany.myproject.core [291]: Unable to resolve 291.34: missing requirement [291.34] osgi.wiring.package; (osgi.wiring.package=org.apache.xml.resolver)
Including external JARs to your bundle
This part of your pom.xml:
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
defines xerces as provided dependency, eg. one already existing in the CQ. If you'd like to embed this dependency, change it scope to compile and use <embed-dependency> option for the Maven bundle plugin, like:
<configuration>
<instructions>
<Export-Package>pl.mycompany.myproject.page.components.*;version=${pom.version}</Export-Package>
<Embed-Dependency>xercesImpl;scope=compile</Embed-Dependency>
</instructions>
</configuration>
Also, it's a good idea to add provided scope to all dependencies which are actually included within the CQ (like cq-wcm-api, etc).
Parsing XMLs in CQ5
Above is a direct answer to your question ("how to use external JAR"). However, in this particular case, I don't think you should include the xerces library, as it already exists in the JDK. Try to remove the xerces dependency and use javax.xml.parsers API:
import javax.xml.parsers.*;
...
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance()
DocumentBuilder builder = factory.newDocumentBuilder()
builder.parse(new ByteArrayInputStream(xmlCode.getBytes()));
Related
I was facing the following runtime error while using the library
I used the following dependencies in my project
<dependency>
<groupId>com.eatthepath</groupId>
<artifactId>pushy</artifactId>
<version>0.14.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.48.Final</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>com.eatthepath</groupId>
<artifactId>fast-uuid</artifactId>
<version>0.1</version>
</dependency>
My code implementation is very straight forward following the readme file in https://github.com/jchambers/pushy
final ApnsClient client = new ApnsClientBuilder()
.setApnsServer(ApnsClientBuilder.PRODUCTION_APNS_HOST)
.setClientCredentials(new File(certPath), apnsPassword)
.build();
for (String deviceToken : deviceTokensList) {
final ApnsPayloadBuilder payloadBuilder = new SimpleApnsPayloadBuilder();
payloadBuilder.setAlertBody(notificationMessage);
final String payload = payloadBuilder.build();
final String token = TokenUtil.sanitizeTokenString(deviceToken);
final SimpleApnsPushNotification pushNotification = new SimpleApnsPushNotification(token, #invalid_app_bundle#, payload);
final PushNotificationFuture<SimpleApnsPushNotification, PushNotificationResponse<SimpleApnsPushNotification>>
sendNotificationFuture = client.sendNotification(pushNotification);
try {
sendNotificationFuture.whenComplete((response, cause) -> {
if (response != null) {
ConsoleLog.print(isDebug, deviceToken + ", Handle the push notification response as before from here.");
insertIntoAPNSThirdPartyServiceLogs(new AppleNotificationEntity(deviceToken, true, source, "Success."));
} else {
String error = deviceToken + ", " + cause;
ConsoleLog.print(isDebug, error);
insertIntoAPNSThirdPartyServiceLogs(new AppleNotificationEntity(deviceToken, false, source, error));
cause.printStackTrace();
}
});
} catch (final Exception e) {
String error = "Failed to send push notification, reason: " + e.getMessage();
ConsoleLog.print(isDebug, error);
e.printStackTrace();
insertIntoAPNSThirdPartyServiceLogs(new AppleNotificationEntity(deviceToken, false, source, error));
}
} // close for loop
client.close();
Error Logs:
2021-03-26 16:18:31.933 WARN 27557 --- [ntLoopGroup-2-1] io.netty.util.concurrent.DefaultPromise : An exception was thrown by com.eatthepath.pushy.apns.ApnsChannelPool$$Lambda$2619/595971378.operationComplete()
java.lang.NoSuchMethodError: io.netty.util.concurrent.PromiseCombiner.<init>(Lio/netty/util/concurrent/EventExecutor;)V
at com.eatthepath.pushy.apns.ApnsChannelPool.lambda$close$6(ApnsChannelPool.java:247) ~[pushy-0.14.2.jar:na]
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:33) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:435) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) [netty-all-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.23.Final.jar:4.1.23.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
**java.lang.NoSuchMethodError: io.netty.util.concurrent.PromiseCombiner.<init>(Lio/netty/util/concurrent/EventExecutor;)V**
at com.eatthepath.pushy.apns.ApnsClientHandler.writePushNotification(ApnsClientHandler.java:217)
at com.eatthepath.pushy.apns.ApnsClientHandler.write(ApnsClientHandler.java:175)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:801)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:814)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:794)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:831)
at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1071)
at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:300)
at com.eatthepath.pushy.apns.ApnsClient.lambda$sendNotification$1(ApnsClient.java:205)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:103)
at com.eatthepath.pushy.apns.ApnsChannelPool.lambda$acquireWithinEventExecutor$2(ApnsChannelPool.java:156)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:504)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:483)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:103)
at com.eatthepath.pushy.apns.ApnsClientHandler.onSettingsRead(ApnsClientHandler.java:396)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onSettingsRead(DefaultHttp2ConnectionDecoder.java:423)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$PrefaceFrameListener.onSettingsRead(DefaultHttp2ConnectionDecoder.java:635)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readSettingsFrame(DefaultHttp2FrameReader.java:542)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:263)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:118)
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:390)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:254)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.flush.FlushConsolidationHandler.channelRead(FlushConsolidationHandler.java:147)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1407)
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1177)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1221)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
This problem is being produced in the whenComplete method and returning null response with the above cause
sendNotificationFuture.whenComplete((response, cause) -> {
if (response != null) {
} else {
// here
}
}
After checking the netty-common version, I noticed that the netty version is not 4.1.48.Final
And I am using Spring version 2.0.1.RELEASE which required 4.1.23.Final netty version in the main project that include the Jar file that contains the Pushy library.
So I added the following dependency that fixed the problem in the main project that override the existing netty version
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.48.Final</version>
</dependency>
Github ticket
Just created a quick and simple 'sandbox' application to test out Spring-boot.
I'm getting the following error when attempting to run it -regardless of the versioning (tried to drop down to 1.4.7.RELEASE as well).
Also, almost all of the answers I've read on other posts seems to indicate that there's a mismatch in the versions somewhere -but how is that possible in this case? I was attempting to use the parent to avoid versioning conflicts to begin with.
POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sandbox.springboot</groupId>
<artifactId>SpringBootSandbox</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootSandbox</name>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
ApplicationRunner
#SpringBootApplication//(scanBasePackages = "com.sandbox")
#ComponentScan("com.sandbox")
public class ApplicationRunner extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ApplicationRunner.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(ApplicationRunner.class, args);
}
}
Exception
2017-10-20 10:48:42.483 WARN 8828 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
2017-10-20 10:48:42.485 ERROR 8828 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2805c96b: startup date [Fri Oct 20 10:48:42 EDT 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at com.sandbox.configuration.ApplicationRunner.main(ApplicationRunner.java:31) [classes/:na]
After some playing around... and checking other Spring boot setups, I adjusted my ApplicationRunner as follows, and it seems to run without error now. I'm still looking into what the difference is between these approaches and why this one works.
#SpringBootApplication
#ComponentScan("com.sandbox")
public class BootApplicationRunner implements ApplicationRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(BootApplicationRunner.class, args);
}
public void run(ApplicationArguments args) throws Exception {
}
}
BACKGROUND:
I assembled a "relatively" compact JBossFuse, REST-DSL example (from disparate posts/articles) that routes to an ActiveMQ queue (see working example, further below).
PROBLEM: I want to route to an "IBM MQ" queue, instead.
QUESTION:
What has to change for me to route to "IBM MQ" instead of "ActiveMQ"?
I've tried the following...:
(A) building an IBM MQ "support bundle" and deploying it to Fuse and adding the dep. to the app's pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm</groupId>
<artifactId>ibm-mq-lib</artifactId>
<version>9.0.0.0</version>
<description>ibm-mq-lib</description>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>com.ibm.mq.osgi</groupId>
<artifactId>allclient</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/OSGi/com.ibm.mq.osgi.allclient_9.0.0.0.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq.osgi</groupId>
<artifactId>allclientprereqs</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/OSGi/com.ibm.mq.osgi.allclientprereqs_9.0.0.0.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>allclient</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/JavaSE/com.ibm.mq.allclient.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>traceControl</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/JavaSE/com.ibm.mq.traceControl.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>fscontext</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/JavaSE/fscontext.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>jms</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/JavaSE/jms.jar</systemPath>
<scope>system</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>providerutil</artifactId>
<version>9.0.0.0</version>
<systemPath>C:/tools/wmq/JavaSE/providerutil.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Description>description</Bundle-Description>
<Bundle-Vendor>IBM MQ 9.0.0.0</Bundle-Vendor>
<Import-Package></Import-Package>
<Export-Package>*</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<name>ibm-mq-lib</name>
</project>
(B) modified the "camel-route.xml" file (added the following)
...
<bean id="connectionFactory"
class="com.ibm.mq.jms.MQConnectionFactory">
<property name="transportType" value="1"/>
<property name="hostName" value="localhost"/>
<property name="port" value="1414"/>
<property name="queueManager" value="QM1"/>
<property name="channel" value="DEV.APP.SVRCONN" />
</bean>
<bean id="ibmMqConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="concurrentConsumers" value="10"/>
</bean>
<bean id="ibmMq"
class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="ibmMqConfig"/>
</bean>
</blueprint>
(C) modified "CamelRestRoutes.java" file to point to the IBM MQ queue (instead of the ActiveMQ queue)...
...
from("direct:thingZ")
.log("---------------------- (CCC) ----------------------> direct:thingZ...:" + body().toString())
.to("ibmMq:queue:bubblegum?jmsMessageType=Text&exchangePattern=InOnly");
Call the "getAll" method in the REST service results in an exception with the following log/exception output
...
WorkQueueMananger Contents
--------------------------
| Maintain ThreadPool size :- false
| Maximum ThreadPool size :- -1
| ThreadPool inactive timeout :- 0
| unavailable - :- com.ibm.msg.client.commonservices.CSIException: JMSCS0002
Runtime properties
------------------
| Available processors :- 4
| Free memory in bytes (now) :- 737153288
| Max memory in bytes :- 954728448
| Total memory in bytes (now) :- 875036672
Component Manager Contents
--------------------------
Common Services Components:
Messaging Provider Components:
| CMVC :- p900-L160512.4
| Class Name :- class com.ibm.msg.client.wmq.factories.WMQComponent
| Component Name :- com.ibm.msg.client.wmq
| Component Title :- IBM MQ JMS Provider
| Factory Class :- class com.ibm.msg.client.wmq.factories.WMQFactoryFactory
| Jar location :- bundle://530.0:1/com/ibm/msg/client/wmq/factories/WMQComponent.class
| Version :- 9.0.0.0
Provider Specific Information
-----------------------------
Overview of JMS System
Num. Contexts : 0
Num. Connections : 0
Num. Sessions : 0
Num. Consumers : 0
Num. Producers : 0
Detailed JMS System Information
Contexts :
Connections :
Sessions :
Consumers :
Producers :
2017-08-08 09:44:57,407 | ERROR | estlet-672518929 | DefaultErrorHandler | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Failed delivery for (MessageId: ID-AAXA22A747-53217-1502199741603-0-3 on ExchangeId: ID-AAXA22A747-53217-1502199741603-0-2). Exhausted after delivery attempt: 1 caught: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null; nested exception is com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2195, MQRC_UNEXPECTED_ERROR
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [http://localhost:8182/service/getAll?restletMethods=GET ] [ 4126]
[route1 ] [restBinding1 ] [ ] [ 4]
[route1 ] [route1 ] [direct:thingX ] [ 4119]
[route2 ] [to1 ] [bean:camelRestService?method=getAll ] [ 7]
[route2 ] [log1 ] [log ] [ 1]
[route2 ] [to2 ] [direct:thingY ] [ 4110]
[route3 ] [log2 ] [log ] [ 1]
[route3 ] [to3 ] [direct:thingZ ] [ 4109]
[route4 ] [log3 ] [log ] [ 0]
[route4 ] [to4 ] [ibmMq:queue:mylocalqueue?jmsMessageType=Text&exchangePattern=InOnly ] [ 4109]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null; nested exception is com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2195, MQRC_UNEXPECTED_ERROR
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:452)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:414)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:368)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:154)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
at org.apache.camel.component.restlet.RestletConsumer$1.handle(RestletConsumer.java:68)[304:org.apache.camel.camel-restlet:2.17.0.redhat-630187]
at org.apache.camel.component.restlet.MethodBasedRouter.handle(MethodBasedRouter.java:54)[304:org.apache.camel.camel-restlet:2.17.0.redhat-630187]
at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Router.doHandle(Router.java:422)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Router.handle(Router.java:639)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Router.doHandle(Router.java:422)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Router.handle(Router.java:639)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.Component.handle(Component.java:408)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.Server.handle(Server.java:507)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.engine.connector.ServerHelper.handle(ServerHelper.java:63)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:143)[303:org.restlet:2.3.6.v20160126-1627]
at org.restlet.engine.connector.HttpServerHelper$1.handle(HttpServerHelper.java:64)[303:org.restlet:2.3.6.v20160126-1627]
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)[:1.8.0_131]
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)[:1.8.0_131]
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)[:1.8.0_131]
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)[:1.8.0_131]
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)[:1.8.0_131]
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]
Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:422)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8475)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7814)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:299)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:236)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6024)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6049)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:456)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
... 67 more
Caused by: com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2195, MQRC_UNEXPECTED_ERROR
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
... 76 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2195],3=localhost(1414),5=JmqiDefaultThreadPool.enqueue]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2280)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1285)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:355)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
... 75 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195
at com.ibm.mq.jmqi.JmqiDefaultThreadPool.enqueue(JmqiDefaultThreadPool.java:97)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.setUpAsyncMode(RemoteConnection.java:1979)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1741)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:863)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1721)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
... 77 more
Caused by: com.ibm.msg.client.commonservices.CSIException: JMSCS0002
at com.ibm.msg.client.commonservices.workqueue.PIWorkQueueManager.enqueueItem(PIWorkQueueManager.java:55)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:232)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:200)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
at com.ibm.mq.jmqi.JmqiDefaultThreadPool.enqueue(JmqiDefaultThreadPool.java:79)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
... 84 more
2017-08-08 09:44:57,429 | INFO | estlet-672518929 | LogService | 303 - org.restlet - 2.3.6.v20160126-1627 | 2017-08-08 09:44:57 0:0:0:0:0:0:0:1 - - 8182 GET /service/getAll/ - 500 8856 0 4140 http://localhost:8182 Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0 -
For comparison/context, BELOW, is the working project that routes to an ActiveMQ queue...
Here is the project structure
aaa.bbb.ccc.CamelRestService.java
package aaa.bbb.ccc;
import aaa.bbb.ccc.model.CamelRestPojo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.MediaType;
#Path("/service/")
public class CamelRestService {
Map<Long, CamelRestPojo> itemMap = new HashMap<>();
public CamelRestService() {
init();
}
#GET
#Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
#Path("/getAll/")
public Collection<CamelRestPojo> getAll() {
return itemMap.values();
}
final void init() {
CamelRestPojo o = new CamelRestPojo();
o.setName("JOE BLOW");
o.setId(100);
itemMap.put(o.getId(), o);
}
}
aaa.bbb.ccc.CamelRestRoute.java
package aaa.bbb.ccc;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;
public class CamelRestRoutes extends RouteBuilder {
public CamelRestRoutes() {
}
#Override
public void configure() throws Exception {
restConfiguration().component("restlet")
.host("localhost")
.port(8182)
.bindingMode(RestBindingMode.json_xml);
rest("/service")
.bindingMode(RestBindingMode.json_xml)
.get("/getAll")
.produces("application/json")
.to("direct:thingX");
from("direct:thingX")
.to("bean:camelRestService?method=getAll")
.log("---------------------- (AAA) ----------------------> direct:thingX...:" + body().toString())
.to("direct:thingY");
from("direct:thingY")
.log("---------------------- (BBB) ----------------------> direct:thingY...:" + body().toString())
.to("direct:thingZ");
from("direct:thingZ")
.log("---------------------- (CCC) ----------------------> direct:thingZ...:" + body().toString())
.to("activemq:queue:bubblegum?jmsMessageType=Text&exchangePattern=InOnly");
}
}
aaa.bbb.ccc.model.CamelRestPojo.java
package aaa.bbb.ccc.model;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(name = "camelRestPojo")
public class CamelRestPojo implements Serializable {
#XmlElement
private long id;
#XmlElement
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
#Override
public String toString() {
return "CamelRestPojo{" + "id=" + id + ", name=" + name + '}';
}
}
camel-route.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
">
<camel:camelContext id="aaa.bbb.ccc.routing.poc" xmlns="http://camel.apache.org/schema/blueprint">
<packageScan>
<package>aaa.bbb.ccc</package>
</packageScan>
</camel:camelContext>
<bean id="camelRestService" class="aaa.bbb.ccc.CamelRestService"/>
<bean id = "activemq" class = "org.apache.activemq.camel.component.ActiveMQComponent">
<property name = "brokerURL" value = "tcp://localhost:61616"/>
<property name = "userName" value = "admin"/>
<property name = "password" value = "admin"/>
</bean>
</blueprint>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb.ccc</groupId>
<artifactId>camelRest</artifactId>
<version>1</version>
<packaging>bundle</packaging>
<name>camelRest</name>
<description>camelRest</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restlet</artifactId>
<version>2.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>5.11.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Export-Package>aaa.bbb.ccc*</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
test url/return value
URL:
http://localhost:8182/service/getAll/
RETURNS:
[{"id": 100,"name": "JOE BLOW"}]
Environment
IBM MQ server 9.0.3.0
IBM MQ client 8.0.0.7
jdk1.8.0_131
jboss-fuse-6.3.0.redhat-187
I've worked on a few Fuse/W-MQ integration exercises. Bundling the W-MQ client drivers into your application probably won't work on Fuse. You need to install the W-MQ client JARs into the Fuse run-time. IBM provides OSGi-compliant versions for that purpose.
My recollection is that there are nine in total, but not all are needed in all configurations. You can install them using osgi:install at the Karaf prompt, or just dump them in the deploy/ directory for testing purposes. Some configuration changes might need to be made in Fuse -- these depend on the specific version combination.
Your connection factory configuration looks broadly correct.
The "allcient" jars contain all of the other client bundles that Kevin was mentioning.
I'm a bit puzzled by what I am seeing, however. I downloaded the IBM MQ 9.0.3 client jars, and there is only the "com.ibm.mq.allclient.jar" in the zip.
For MQ 8, you would have the "com.ibm.mq.osgi.allclient.jar" and "com.ibm.mq.osgi.allclientprereqs.jar" bundles. The problem there is that the prereq bundle included the javax.jms interfaces. You would have to modify the prereq bundle to remove the JMS api jar in order to use it on Fuse. I do not know if this is still the case for MQ 9.
Specifically for Fuse 6.3:
My recollection is that Fuse 6.3 is tested against the client runtime for W-MQ 8, without needing modifications in Fuse. I can't remember whether that was with the individual 8-9 IBM bundles, or with the "allclient" bundle that Doug mentions. In any event, you need to avoid getting into a situation where you have a JMS 2.0 API JAR (that is, the bundle that includes the javax.jms.xxx classes) from both W-MQ and from Fuse -- they will clash. So if you install xxx_allclient.jar, you either need to not install xxx_allclientprereqs.jar, or uninstall the Fuse jms-api bundle from the Fuse runtime. If you go the route of using the heap of 8 or 9 bundles, you should install them all except one called something like xxx_jms.prereq_xxx.jar.
You can install using osgi:install or, for development, just copy them into the deploy/ directory on Fuse. In Fabric8 you'll need eventually to put the IBM JARs into some sort of repository and then create a profile that references them; but testing without Fabric8 in the first instance is probably worthwhile, to remove that additional source of complexity.
I haven't unpacked the W-MQ 9 allclient.jar, so I don't know what's inside it. If it contains javax.jms.xxx classes, either directly or in another internal JAR, then I guess you'll either need to unpack and repack the JAR without these classes, or uninstall the Fuse jms-api bundle.
In any event, Fuse 6.3 with W-MQ 8 client runtime is a good combination, and probably the easiest Fuse/W-MQ combination to get working. You don't necessarily have to use the W-MQ client runtime whose version that matches the W-MQ broker version, if a different client is easier to install on Fuse. However, you should check IBM's compatibility statement before going this way. My recollection is that the W-MQ 8 client runtime is certified by IBM to work with any 7.5.x broker, but I'm not sure whether compatibility works in the opposite direction.
FWIW my recommendation is that you shouldn't be afraid to use a bit of trial-and-error. I've been working with Fuse and W-MQ for a couple of years, and I still find I have to fiddle. Exceptions will help with troubleshooting.
(Posted solution on behalf of the question author, to move it to the answer space).
Thanks to help/postings from generous forum contributors, below, I arrived at a working solution, below.
I included relatively full code/context, i.e., to enable others to arrive at the solution more quickly than I did.
aaa.bbb.ccc.CamelRestRoutes.java
package aaa.bbb.ccc;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;
public class CamelRestRoutes extends RouteBuilder {
public CamelRestRoutes() {
}
#Override
public void configure() throws Exception {
restConfiguration().component("restlet")
.host("localhost")
.port(8182)
//.bindingMode(RestBindingMode.json_xml);
.bindingMode(RestBindingMode.json);
rest("/service")
//.bindingMode(RestBindingMode.json_xml)
.bindingMode(RestBindingMode.json)
.get("/getAll")
.produces("application/json")
.to("direct:thingX");
from("direct:thingX")
.to("bean:camelRestService?method=getAll")
.log("---------------------- (AAA) ----------------------> direct:thingX...:" + body().toString())
.to("direct:thingY");
from("direct:thingY")
.log("---------------------- (BBB) ----------------------> direct:thingY...:" + body().toString())
.to("direct:thingZ");
from("direct:thingZ")
.log("---------------------- (CCC) ----------------------> direct:thingZ...:" + body().toString())
.to("wmq:queue:mylocalqueue?jmsMessageType=Text&exchangePattern=InOnly");
}
}
aaa.bbb.ccc.CamelRestService.java
package aaa.bbb.ccc;
import aaa.bbb.ccc.model.CamelRestPojo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.MediaType;
#Path("/service/")
public class CamelRestService {
Map<Long, CamelRestPojo> itemMap = new HashMap<>();
public CamelRestService() {
init();
}
#GET
//#Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
#Produces({MediaType.APPLICATION_JSON})
#Path("/getAll/")
public Collection<CamelRestPojo> getAll() {
System.out.println("====================== (getAll) ---------------------->");
return itemMap.values();
}
final void init() {
System.out.println("---------------------- (init) ---------------------->");
CamelRestPojo o = new CamelRestPojo();
o.setName("JOE BLOW");
o.setId(100);
itemMap.put(o.getId(), o);
}
}
aaa.bbb.ccc.model.CamelRestPojo
package aaa.bbb.ccc.model;
import java.io.Serializable;
public class CamelRestPojo implements Serializable {
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
#Override
public String toString() {
return "CamelRestPojo{" + "id=" + id + ", name=" + name + '}';
}
}
camel-route.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
">
<camel:camelContext id="aaa.bbb.ccc.routing.poc" xmlns="http://camel.apache.org/schema/blueprint">
<packageScan>
<package>aaa.bbb.ccc</package>
</packageScan>
</camel:camelContext>
<bean id="camelRestService" class="aaa.bbb.ccc.CamelRestService"/>
<bean id="wmqcf" class="com.ibm.mq.jms.MQConnectionFactory">
<property name="hostName" value="localhost"/>
<property name="port" value="1414"/>
<property name="queueManager" value="QM1"/>
<property name="channel" value="DEV.ADMIN.SVRCONN"/>
<property name="transportType" value="1"/>
</bean>
<bean id="wmqcfw" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="wmqcf" />
<property name="username" value="admin" />
<property name="password" value="passw0rd" />
</bean>
<bean id="wmqcfg" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="wmqcfw"/>
<property name="concurrentConsumers" value="10"/>
</bean>
<bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="wmqcfg"/>
</bean>
</blueprint>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb.ccc</groupId>
<artifactId>camelRest</artifactId>
<version>1</version>
<packaging>bundle</packaging>
<name>camelRest</name>
<description>camelRest</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<mq.version>8.0.0.7</mq.version>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restlet</artifactId>
<version>2.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>allclient</artifactId>
<version>${mq.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>jms</artifactId>
<version>${mq.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Export-Package>aaa.bbb.ccc*</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
here is the contents of the jboss fuse "deploy" folder
C:\tools\jboss-fuse-6.3.0.redhat-187\deploy>dir
Volume in drive C is OSDisk
Volume Serial Number is D89B-75DE
Directory of C:\tools\jboss-fuse-6.3.0.redhat-187\deploy
08/17/2017 01:49 PM <DIR> .
08/17/2017 01:49 PM <DIR> ..
08/17/2017 01:49 PM 7,975 camelRest-1.jar
06/29/2017 01:00 AM 159,649 com.ibm.mq.osgi.allclientprereqs_8.0.0.7.jar
06/29/2017 01:00 AM 8,011,749 com.ibm.mq.osgi.allclient_8.0.0.7.jar
06/29/2017 01:00 AM 4,088,715 com.ibm.mq.osgi.java_8.0.0.7.jar
06/29/2017 01:00 AM 171,064 com.ibm.msg.client.osgi.commonservices.j2se_8.0.0.7.jar
06/29/2017 01:00 AM 48,715 com.ibm.msg.client.osgi.jms.prereq_8.0.0.7.jar.DISABLE
06/29/2017 01:00 AM 639,807 com.ibm.msg.client.osgi.jms_8.0.0.7.jar
06/29/2017 01:00 AM 216,218 com.ibm.msg.client.osgi.nls_8.0.0.7.jar
06/29/2017 01:00 AM 279,861 com.ibm.msg.client.osgi.wmq.nls_8.0.0.7.jar
06/29/2017 01:00 AM 92,406 com.ibm.msg.client.osgi.wmq.prereq_8.0.0.7.jar
06/29/2017 01:00 AM 7,963,226 com.ibm.msg.client.osgi.wmq_8.0.0.7.jar
09/15/2016 04:19 AM 873 README
12 File(s) 21,680,258 bytes
2 Dir(s) 143,871,660,032 bytes free
C:\tools\jboss-fuse-6.3.0.redhat-187\deploy>
Other notes
For what it is worth, I had add following features:
-camel-jackson
-camel-restlet
(I'm sure your "mileage will vary" as you tinker to make your IBM MQ app work, etc).
Also, fwiw, running:
features:list | grep "jms"
yields:
JBossFuse:karaf#root> features:list | grep "jms"
[installed ] [2.4.0.redhat-630187 ] jms karaf-enterprise-2.4.0.redhat-630187 JMS service and commands
[installed ] [2.17.0.redhat-630187 ] camel-jms camel-2.17.0.redhat-630187
[uninstalled] [2.17.0.redhat-630187 ] camel-sjms camel-2.17.0.redhat-630187
[uninstalled] [3.1.5.redhat-630187 ] cxf-transports-jms cxf-3.1.5.redhat-630187
[uninstalled] [2.1.0.redhat-630187 ] switchyard-jms switchyard-2.1.0.redhat-630187
[uninstalled] [2.1.0.redhat-630187 ] switchyard-quickstart-bpel-jms-binding switchyard-2.1.0.redhat-630187
[uninstalled] [2.1.0.redhat-630187 ] switchyard-quickstart-camel-jms-binding switchyard-2.1.0.redhat-630187
[uninstalled] [2.1.0.redhat-630187 ] switchyard-demo-security-propagation-jms switchyard-2.1.0.redhat-630187
[uninstalled] [1.1 ] jms-spec activemq-core-5.11.0.redhat-630187 JMS spec 1.1 libraries
[installed ] [2.0 ] jms-spec activemq-core-5.11.0.redhat-630187 JMS spec 2.0 libraries
[uninstalled] [1.1 ] jms-spec-dep activemq-core-5.11.0.redhat-630187 JMS spec 1.1 dependency
[installed ] [2.0 ] jms-spec-dep activemq-core-5.11.0.redhat-630187 JMS spec 2.0 dependency
[uninstalled] [5.11.0.redhat-630187 ] activemq-jms-spec-dep activemq-core-5.11.0.redhat-630187 ActiveMQ broker libraries
[installed ] [3.2.16.RELEASE_1 ] spring-jms spring-2.4.0.redhat-630187 Spring 3.2.x JMS support
I'm trying the spring-data-neo4j in a project. I defined my domain object but I've got problems with the repository usage.
Below the code of my repository interface:
public interface UserRepository extends GraphRepository<User> {
public User findByEmail(String email);
}
Easy, isn't it ? :)
But when I launch my spring project (a REST service), I got those exceptions:
23:13:23.833 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at hello.Hello2Kt.main(Hello2.kt:18)
Caused by: java.lang.AbstractMethodError: org.springframework.data.neo4j.repository.query.GraphQueryLookupStrategy.resolveQuery(Ljava/lang/reflect/Method;Lorg/springframework/data/repository/core/RepositoryMetadata;Lorg/springframework/data/repository/core/NamedQueries;)Lorg/springframework/data/repository/query/RepositoryQuery;
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:416)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:206)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237)
at org.springframework.data.neo4j.repository.support.GraphRepositoryFactoryBean.afterPropertiesSet(GraphRepositoryFactoryBean.java:43)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 16 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:52143', transport: 'socket'
23:13:23.836 [main] INFO o.s.b.l.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/charsets.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/deploy.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/cldrdata.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/dnsns.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/jaccess.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/jfxrt.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/localedata.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/nashorn.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/sunec.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/ext/zipfs.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/javaws.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/jce.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/jfr.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/jfxswt.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/jsse.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/management-agent.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/plugin.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/resources.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/rt.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/ant-javafx.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/dt.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/javafx-mx.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/jconsole.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/packager.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/sa-jdi.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/lib/tools.jar, file:/Users/batman/IdeaProjects/Sphynx/target/classes/, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-actuator/1.3.4.RELEASE/spring-boot-actuator-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot/1.3.4.RELEASE/spring-boot-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.4.RELEASE/spring-boot-autoconfigure-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.6.6/jackson-databind-2.6.6.jar, file:/Users/batman/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.6.6/jackson-annotations-2.6.6.jar, file:/Users/batman/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.6.6/jackson-core-2.6.6.jar, file:/Users/batman/.m2/repository/org/springframework/spring-core/4.2.6.RELEASE/spring-core-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/spring-context/4.2.6.RELEASE/spring-context-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/spring-beans/4.2.6.RELEASE/spring-beans-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/spring-expression/4.2.6.RELEASE/spring-expression-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.0.1-2/kotlin-stdlib-1.0.1-2.jar, file:/Users/batman/.m2/repository/org/jetbrains/kotlin/kotlin-runtime/1.0.1-2/kotlin-runtime-1.0.1-2.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.3.4.RELEASE/spring-boot-starter-web-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.4.RELEASE/spring-boot-starter-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.4.RELEASE/spring-boot-starter-logging-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/slf4j/jul-to-slf4j/1.7.21/jul-to-slf4j-1.7.21.jar, file:/Users/batman/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.21/log4j-over-slf4j-1.7.21.jar, file:/Users/batman/.m2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.3.4.RELEASE/spring-boot-starter-tomcat-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.33/tomcat-embed-core-8.0.33.jar, file:/Users/batman/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.33/tomcat-embed-el-8.0.33.jar, file:/Users/batman/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.33/tomcat-embed-logging-juli-8.0.33.jar, file:/Users/batman/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.33/tomcat-embed-websocket-8.0.33.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter-validation/1.3.4.RELEASE/spring-boot-starter-validation-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar, file:/Users/batman/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/Users/batman/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar, file:/Users/batman/.m2/repository/com/fasterxml/classmate/1.1.0/classmate-1.1.0.jar, file:/Users/batman/.m2/repository/org/springframework/spring-web/4.2.6.RELEASE/spring-web-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/spring-webmvc/4.2.6.RELEASE/spring-webmvc-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter-security/1.3.4.RELEASE/spring-boot-starter-security-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/spring-aop/4.2.6.RELEASE/spring-aop-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/Users/batman/.m2/repository/org/springframework/security/spring-security-config/4.0.4.RELEASE/spring-security-config-4.0.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/security/spring-security-core/4.0.4.RELEASE/spring-security-core-4.0.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/security/spring-security-web/4.0.4.RELEASE/spring-security-web-4.0.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/1.3.4.RELEASE/spring-boot-starter-actuator-1.3.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/data/spring-data-neo4j/4.1.1.RELEASE/spring-data-neo4j-4.1.1.RELEASE.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-ogm-core/2.0.1/neo4j-ogm-core-2.0.1.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-ogm-api/2.0.1/neo4j-ogm-api-2.0.1.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-ogm-compiler/2.0.1/neo4j-ogm-compiler-2.0.1.jar, file:/Users/batman/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-ogm-http-driver/2.0.1/neo4j-ogm-http-driver-2.0.1.jar, file:/Users/batman/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar, file:/Users/batman/.m2/repository/org/springframework/data/spring-data-commons/1.11.4.RELEASE/spring-data-commons-1.11.4.RELEASE.jar, file:/Users/batman/.m2/repository/org/springframework/spring-tx/4.2.6.RELEASE/spring-tx-4.2.6.RELEASE.jar, file:/Users/batman/.m2/repository/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar, file:/Users/batman/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-ogm/1.1.0/neo4j-ogm-1.1.0.jar, file:/Users/batman/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar, file:/Users/batman/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar, file:/Users/batman/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j/2.2.2/neo4j-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-kernel/2.2.2/neo4j-kernel-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-primitive-collections/2.2.2/neo4j-primitive-collections-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-unsafe/2.2.2/neo4j-unsafe-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-io/2.2.2/neo4j-io-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-csv/2.2.2/neo4j-csv-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-lucene-index/2.2.2/neo4j-lucene-index-2.2.2.jar, file:/Users/batman/.m2/repository/org/apache/lucene/lucene-core/3.6.2/lucene-core-3.6.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-graph-algo/2.2.2/neo4j-graph-algo-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-udc/2.2.2/neo4j-udc-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-graph-matching/2.2.2/neo4j-graph-matching-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-cypher/2.2.2/neo4j-cypher-2.2.2.jar, file:/Users/batman/.m2/repository/org/scala-lang/scala-library/2.10.5/scala-library-2.10.5.jar, file:/Users/batman/.m2/repository/org/scala-lang/scala-reflect/2.10.5/scala-reflect-2.10.5.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-cypher-compiler-1.9/2.0.4/neo4j-cypher-compiler-1.9-2.0.4.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-cypher-compiler-2.0/2.0.4/neo4j-cypher-compiler-2.0-2.0.4.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-cypher-compiler-2.1/2.1.8/neo4j-cypher-compiler-2.1-2.1.8.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-cypher-compiler-2.2/2.2.2/neo4j-cypher-compiler-2.2-2.2.2.jar, file:/Users/batman/.m2/repository/org/parboiled/parboiled-scala_2.10/1.1.7/parboiled-scala_2.10-1.1.7.jar, file:/Users/batman/.m2/repository/org/parboiled/parboiled-core/1.1.7/parboiled-core-1.1.7.jar, file:/Users/batman/.m2/repository/net/sf/opencsv/opencsv/2.3/opencsv-2.3.jar, file:/Users/batman/.m2/repository/com/googlecode/concurrentlinkedhashmap/concurrentlinkedhashmap-lru/1.4/concurrentlinkedhashmap-lru-1.4.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-jmx/2.2.2/neo4j-jmx-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-consistency-check/2.2.2/neo4j-consistency-check-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/app/neo4j-server/2.2.2/neo4j-server-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/server-api/2.2.2/server-api-2.2.2.jar, file:/Users/batman/.m2/repository/org/neo4j/3rdparty/javax/ws/rs/jsr311-api/1.1.2.r612/jsr311-api-1.1.2.r612.jar, file:/Users/batman/.m2/repository/org/neo4j/app/neo4j-browser/2.2.2/neo4j-browser-2.2.2.jar, file:/Users/batman/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar, file:/Users/batman/.m2/repository/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar, file:/Users/batman/.m2/repository/ch/qos/logback/logback-access/1.1.7/logback-access-1.1.7.jar, file:/Users/batman/.m2/repository/org/codehaus/janino/janino/2.7.8/janino-2.7.8.jar, file:/Users/batman/.m2/repository/org/codehaus/janino/commons-compiler/2.7.8/commons-compiler-2.7.8.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-server/9.2.16.v20160414/jetty-server-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-http/9.2.16.v20160414/jetty-http-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-util/9.2.16.v20160414/jetty-util-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-io/9.2.16.v20160414/jetty-io-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-webapp/9.2.16.v20160414/jetty-webapp-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-xml/9.2.16.v20160414/jetty-xml-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-servlet/9.2.16.v20160414/jetty-servlet-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/org/eclipse/jetty/jetty-security/9.2.16.v20160414/jetty-security-9.2.16.v20160414.jar, file:/Users/batman/.m2/repository/com/sun/jersey/jersey-server/1.18.1/jersey-server-1.18.1.jar, file:/Users/batman/.m2/repository/com/sun/jersey/jersey-core/1.18.1/jersey-core-1.18.1.jar, file:/Users/batman/.m2/repository/com/sun/jersey/jersey-servlet/1.18.1/jersey-servlet-1.18.1.jar, file:/Users/batman/.m2/repository/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar, file:/Users/batman/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, file:/Users/batman/.m2/repository/commons-digester/commons-digester/2.1/commons-digester-2.1.jar, file:/Users/batman/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar, file:/Users/batman/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar, file:/Users/batman/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.13/jackson-jaxrs-1.9.13.jar, file:/Users/batman/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.jar, file:/Users/batman/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar, file:/Users/batman/.m2/repository/org/rrd4j/rrd4j/2.2/rrd4j-2.2.jar, file:/Users/batman/.m2/repository/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar, file:/Users/batman/.m2/repository/bouncycastle/bcprov-jdk16/140/bcprov-jdk16-140.jar, file:/Users/batman/.m2/repository/com/sun/jersey/contribs/jersey-multipart/1.18.1/jersey-multipart-1.18.1.jar, file:/Users/batman/.m2/repository/org/jvnet/mimepull/mimepull/1.9.3/mimepull-1.9.3.jar, file:/Users/batman/.m2/repository/org/neo4j/neo4j-shell/2.2.2/neo4j-shell-2.2.2.jar, file:/Users/batman/.m2/repository/org/apache/servicemix/bundles/org.apache.servicemix.bundles.jline/0.9.94_1/org.apache.servicemix.bundles.jline-0.9.94_1.jar, file:/Users/batman/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/Applications/IntelliJ%20IDEA.app/Contents/lib/idea_rt.jar]
That is my dependencies (from pom.xml):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>4.1.1.RELEASE</version>
</dependency>
As you can see, I'm using a release version of the neo4j spring data integration (4.1.1.RELEASE).
For your information, if I don't declare any query function in the repository interface, the spring application starts without error.
could possibly be caused by a version conflict. could you try using the spring data without the version tags.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
</dependency>
Look at this answer
Thanks to austin and the link he provided me, I've succeeded to launch my application with a repository.
I've added those lines below in my pom:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Hopper-SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I'm trying to implement a hibernate clustered 2nd level cache with ehcache, using JMS replication.
Hibernate version is 3.6.10.final, spring version is 3.2.2.
When the servlet is starting, I get the following error:
Caused by: org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Failure cloning default cache. Initial cause was not supported
at net.sf.ehcache.hibernate.AbstractEhcacheProvider.buildCache(AbstractEhcacheProvider.java:73)
at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.buildEntityRegion(RegionFactoryCacheProviderBridge.java:104)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:280)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at com.targa.fleetGateway.HibernateUtil.<init>(HibernateUtil.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
... 73 more
Caused by: net.sf.ehcache.CacheException: Failure cloning default cache. Initial cause was not supported
at net.sf.ehcache.CacheManager.cloneDefaultCache(CacheManager.java:1877)
at net.sf.ehcache.CacheManager.addCache(CacheManager.java:1173)
at net.sf.ehcache.hibernate.AbstractEhcacheProvider.buildCache(AbstractEhcacheProvider.java:66)
... 82 more
Caused by: java.lang.CloneNotSupportedException: not supported
at net.sf.ehcache.distribution.jms.JMSCacheLoader.clone(JMSCacheLoader.java:269)
at net.sf.ehcache.Cache.clone(Cache.java:2846)
at net.sf.ehcache.Cache.clone(Cache.java:163)
at net.sf.ehcache.CacheManager.cloneDefaultCache(CacheManager.java:1875)
... 84 more
My ehcache.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory"
properties="initialContextFactoryName=com.targa.fleetGateway.ExampleActiveMQInitialContextFactory,
providerURL=tcp://127.0.0.1:61616, replicationTopicConnectionFactoryBindingName=topicConnectionFactory,
replicationTopicBindingName=ehcache, getQueueConnectionFactoryBindingName=queueConnectionFactory, getQueueBindingName=ehcacheGetQueue, topicConnectionFactoryBindingName=topicConnectionFactory, topicBindingName=ehcache"
propertySeparator="," />
<defaultCache
maxElementsInMemory="100"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="false">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jms.JMSCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
replicateUpdatesViaCopy=true, replicateRemovals=true, asynchronousReplicationIntervalMillis=1000"
propertySeparator="," />
<cacheLoaderFactory class="net.sf.ehcache.distribution.jms.JMSCacheLoaderFactory"
properties="initialContextFactoryName=com.targa.fleetGateway.ExampleActiveMQInitialContextFactory,
providerURL=tcp://127.0.0.1:61616, replicationTopicConnectionFactoryBindingName=topicConnectionFactory,
getQueueConnectionFactoryBindingName=queueConnectionFactory, replicationTopicBindingName=ehcache,
getQueueBindingName=ehcacheGetQueue, timeoutMillis=10000" />
</defaultCache>
</ehcache>
If I comment out the cacheLoaderFactory section, things start working again.
The same configuration works in another application where I'm using hibernate 4.2, but I can't upgrade to 4.2 on this one.
Has anybody got any clue about this?
Below are the other relevant pieces of my configuration. Please tell me if anything is missing.
POM.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.6.10.Final</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.8</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-jmsreplication</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>16.0.1</version>
</dependency>
Hibernate properties:
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">
net.sf.ehcache.hibernate.SingletonEhCacheProvider</property>
ExampleActiveMQInitialContextFactory.java
public class ExampleActiveMQInitialContextFactory extends
ActiveMQInitialContextFactory {
/**
* {#inheritDoc}
*/
#Override
public Context getInitialContext(Hashtable environment) throws NamingException {
Map<String, Object> data = new ConcurrentHashMap<String, Object>();
String replicationTopicConnectionFactoryBindingName = (String) environment
.get(JMSUtil.TOPIC_CONNECTION_FACTORY_BINDING_NAME);
if (replicationTopicConnectionFactoryBindingName != null) {
try {
data.put(replicationTopicConnectionFactoryBindingName,
createConnectionFactory(environment));
} catch (URISyntaxException e) {
throw new NamingException(
"Error initialisating TopicConnectionFactory with message "
+ e.getMessage());
}
}
String getQueueConnectionfactoryBindingName = (String) environment
.get(JMSUtil.GET_QUEUE_CONNECTION_FACTORY_BINDING_NAME);
try {
data.put(getQueueConnectionfactoryBindingName,
createConnectionFactory(environment));
} catch (URISyntaxException e) {
throw new NamingException(
"Error initialisating TopicConnectionFactory with message "
+ e.getMessage());
}
String replicationTopicBindingName = (String) environment
.get(JMSUtil.REPLICATION_TOPIC_BINDING_NAME);
String getQueueBindingName = (String) environment
.get(JMSUtil.GET_QUEUE_BINDING_NAME);
if (replicationTopicBindingName != null) {
data.put(replicationTopicBindingName,
createTopic(replicationTopicBindingName));
}
data.put(getQueueBindingName, createQueue(getQueueBindingName));
return createContext(environment, data);
}
}
I faced this problem today: the reason is that defaultCache should not have: cacheLoaderFactory.
Strange that it does not mentioned in the documentation(
So I removed cacheLoaderFactory from defaultCache - and everything works fine;