I have tried to deploy an simple JAX-WS web service on Karaf as an OSGi bundle.
After export the web service as a War file and deploy it into the /deploy folder in Karaf, I found it can not be reached by http://localhost:8181/HelloWebService/helloWebService
My code is easy and I just use this https://github.com/yngwietiger/HelloWebService.git .
The web.xml is like this below:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>jaxwsExample</display-name>
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>helloWebService</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>helloWebService</servlet-name>
<url-pattern>/helloWebService</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>com.webservices.demo.MyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/myservlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
And the log is :
2015-09-17 14:59:59,712 | INFO | raf-4.0.1/deploy | fileinstall | 4 - org.apache.felix.fileinstall - 3.5.0 | Updating bundle HelloWebService / 0.0.0
2015-09-17 14:59:59,712 | INFO | raf-4.0.1/deploy | Activator | 89 - org.ops4j.pax.web.pax-web-extender-war - 4.2.0 | Destroying extension for bundle HelloWebService
2015-09-17 14:59:59,716 | INFO | raf-4.0.1/deploy | HttpServiceFactoryImpl | 93 - org.ops4j.pax.web.pax-web-runtime - 4.2.0 | Unbinding bundle: [HelloWebService [231]]
2015-09-17 15:00:02,251 | INFO | raf-4.0.1/deploy | HttpServiceFactoryImpl | 93 - org.ops4j.pax.web.pax-web-runtime - 4.2.0 | Binding bundle: [HelloWebService [231]] to http service
2015-09-17 15:00:02,254 | INFO | raf-4.0.1/deploy | fileinstall | 4 - org.apache.felix.fileinstall - 3.5.0 | Started bundle: webbundle:file:/E:/Software/apache-karaf-4.0.1/deploy/HelloWebService.war?Web-ContextPath=HelloWebService&Bundle-SymbolicName=HelloWebService&Bundle-Version=0.0.0
2015-09-17 15:00:02,258 | INFO | pool-24-thread-3 | JettyServerWrapper | 91 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | will add org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer to ServletContainerInitializers
2015-09-17 15:00:09,800 | INFO | pool-24-thread-3 | JettyServerWrapper | 91 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | added ServletContainerInitializer: org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer
2015-09-17 15:00:09,800 | INFO | pool-24-thread-3 | JettyServerWrapper | 91 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | will add org.apache.jasper.servlet.JasperInitializer to ServletContainerInitializers
2015-09-17 15:00:09,801 | INFO | pool-24-thread-3 | JettyServerWrapper | 91 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | Skipt org.apache.jasper.servlet.JasperInitializer, because specialized handler will be present
2015-09-17 15:00:09,806 | INFO | pool-24-thread-3 | HttpServiceContext | 91 - org.ops4j.pax.web.pax-web-jetty - 4.2.0 | registering context WebAppHttpContext{HelloWebService - 231}, with context-name: HelloWebService
And by using web:list, it shows the 231 bundle is active and keep deploying all the time.
======================================================================
how to deploy a standard JAX-WS web service(not JXC, just simple JAX-WS web service) with OSGi?
By using Karaf or bulid an Jetty OSGi enviroment or something else...
The example you are mentioned uses maven. It builds generic WAR file that contains no correct OSGi manifest and generates nothing JaxWS-related.
In order to create OSGi WAB (web archive bundle) that exposes Web Services you have to use appropriate maven plugins, for example:
jaxws-maven-plugin for WSDL generation;
maven-war-plugin along with with maven-bundle-plugin to build WAB.
Actually, maven-bundle-plugin can build WABs by itself.
Related
I have an existing application deployed to Apache Karaf OSGi container.
The application bundles implement SOAP and REST web services using Apache CXF, configured by blueprint.xml files that look like this:
<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.1.0"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0"
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/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0 http://aries.apache.org/schemas/blueprint-ext/blueprint-ext.xsd">
<jaxws:endpoint id="bundle1-server" implementor="com.myapp.Bundle1ServiceImpl" endpointName="s:Bundle1Port"
serviceName="s:Bundle1Service" address="http://0.0.0.0:9080/SoapContext/Bundle1Port" wsdlLocation="wsdl/Bundle1Service.wsdl" xmlns:s="http://com.myapp/services/bundle1service">
</jaxws:endpoint>
</blueprint>
When the endpoint starts, I can see this in the log:
INFO | org.apache.cxf.endpoint.ServerImpl | | org.apache.cxf.endpoint.ServerImpl - initDestination - 85 | 109 - org.apache.cxf.cxf-core - 3.1.9 | Setting the server's publish address to be http://0.0.0.0:9080/SoapContext/Bundle1Port
INFO | org.eclipse.jetty.server.ServerConnector | | org.eclipse.jetty.server.AbstractConnector - doStart - 266 | 204 - org.eclipse.jetty.util - 9.2.15.v20160210 | Started ServerConnector#30394ac6{HTTP/1.1}{0.0.0.0:9080}
The CXF uses Jetty to receive the incoming HTTP requests (there is a cxf-rt-transports-http-jetty dependency in the pom.xml).
I want to switch the web services from http to https.
When I change the port number in the blueprint.xml, the web service is indeed reachable at the new port.
However, changing the URL scheme from http to https (http://:9080 to https://:9443) results in an error:
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean bundle1-server
...
Caused by: java.io.IOException: Protocol mismatch for port 9443: engine's protocol is http, the url protocol is https
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory.createJettyHTTPServerEngine(JettyHTTPServerEngineFactory.java:277)
Obviously, I also need to specify the server certificate and the CA certificate. I have tried to add the following:
<httpj:engine-factory bus="cxf">
<httpj:engine port="9443">
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="changeit">
<sec:keyStore type="JKS" password="changeit"
file="/path-to-certificates/keystore.ks"/>
</sec:keyManagers>
<sec:trustManagers>
<sec:keyStore type="JKS" password="password"
file="/path-to-certificates/truststore.ks"/>
</sec:trustManagers>
<sec:clientAuthentication want="false" required="false"/>
</httpj:tlsServerParameters>
</httpj:engine>
</httpj:engine-factory>
But now I get:
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to load class org.eclipse.jetty.server.Connector from recipe MapRecipe[name='#recipe-85']
...
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Connector not found by Bundle1 [255]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)[org.apache.felix.framework-5.4.0.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)[:1.8.0_262]
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:467)[13:org.apache.aries.blueprint.core:1.6.1]
at org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:419)[13:org.apache.aries.blueprint.core:1.6.1]
at org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:135)[13:org.apache.aries.blueprint.core:1.6.1]
at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)[13:org.apache.aries.blueprint.core:1.6.1]
What am I missing here?
Update: I also tried to configure SSL globally for the whole Karaf server by editing etc/org.ops4j.pax.web.cfg to include
org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=/path-to-keystore.ks
org.ops4j.pax.web.ssl.password=changeit
org.ops4j.pax.web.ssl.keypassword=changeit
org.osgi.service.http.port.secure=8443
Then I can see in the logs
INFO | org.ops4j.pax.web.service.jetty.internal.JettyServerImpl | | org.ops4j.pax.web.service.jetty.internal.JettyServerImpl - addConnector - 226 | 222 - org.ops4j.pax.web.pax-web-jetty - 4.2.6 | Pax Web available at [0.0.0.0]:[8443]
INFO | org.eclipse.jetty.server.ServerConnector | | org.eclipse.jetty.server.AbstractConnector - doStart - 266 | 204 - org.eclipse.jetty.util - 9.2.15.v20160210 | Started secureDefault#3bae4ef2{SSL-http/1.1}{0.0.0.0:8443}
..
Caused by: java.io.IOException: Protocol mismatch for port 8443: engine's protocol is http, the url protocol is https
Which is really confusing...
I have fixed the ClassNotFoundException by adding org.eclipse.jetty.server to Import-Package in META-INF/MANIFEST.MF
However, I have read this: "I strongly discourage people from configuring the jetty servers in their blueprint files" http://servicemix.396122.n5.nabble.com/servicemix-5-4-0-cxf-jetty-blueprint-issue-td5722268.html
So maybe I should still try to fix the latter (global) config if possible.
I am having issues with karaf/osgi and when i try to start karaf some of my features loop through starting and closing. Here is a log example:
2017-09-05 15:46:03,344 | INFO | rint Extender: 1 | L3vpnProvider | 224 - l3vpn-feature-impl - 0.1.0.SNAPSHOT | L3vpnProvider Session Initiated
2017-09-05 15:46:03,346 | INFO | rint Extender: 2 | L3vpnDataChangeListenerSR | 171 - org.temp.l3vpn-impl - 0.1.0.SNAPSHOT | Service Request Data Listener created
2017-09-05 15:46:03,349 | INFO | ntAdminThread #7 | BlueprintBundleTracker | 144 - org.opendaylight.controller.blueprint - 0.5.3.Boron-SR3 | Blueprint container for bundle org.temp.l3vpn-feature-impl_0.1.0.SNAPSHOT [224] was successfully created
2017-09-05 15:46:03,353 | INFO | Thread-193 | L3vpnProvider | 224 -l3vpn-feature-impl - 0.1.0.SNAPSHOT | L3vpnProvider Closed
And it literally loops and does not stop. The only solution i've found is constant rebuilding until it starts without complications.
Here is the feature in the feature.xml file to show you how its setup.
<feature name='odl-l3vpn-feature-impl' version='${project.version}' description='OpenDaylight :: l3vpn :: Network Model :: Impl'>
<feature version='${mdsal.version}'>odl-mdsal-broker</feature>
<feature version='${project.version}'>odl-l3vpn-network-model</feature>
<feature version='${project.version}'>odl-l3vpn</feature>
<bundle>mvn:org.temp/l3vpn-nc-impl/{{VERSION}}</bundle>
<lots of other bundles being wrapped>
</feature>
There is an additional feature but it has a very similiar structure so i will not put that up unless it is needed.
I am just a loss for what could be causing this to occur. Are there any ideas?
What i've already tried to do is make the odl-mdsal-broker have a prerequisite or dependency element set as true to make sure there wasn't problems starting the bundle too early but there was no luck with that. Any help would be appreciated.
For anyone that may be having the same issue. This was because of a startup error where both features in the blueprint xml had the same config file, so on startup they were getting confused which caused a loop of booting. After renaming one of the config files and updating that in the blueprint.xml this solved the issue.
I've downloaded Karaf 3.0.8 and tried to enable spring 3.2 and gemini blueprint - without success
karaf#root()> feature:install spring/3.2.17.RELEASE_1
karaf#root()> feature:install gemini-blueprint
Exception in thread "EclipseGeminiBlueprintExtenderThread-25" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 22 in XML document from URL [bundle://55.0:0/OSGI-INF/blueprint/kar-deployer.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:
The matching wildcard is strict, but no declaration can be found for element 'ext:property-placeholder'.
....
karaf#root()> feature:list -i
Name | Version | Installed | Repository | Description
---------------------------------------------------------------------------------------------------------------------
spring | 3.2.17.RELEASE_1 | x | spring-3.0.8 | Spring 3.2.x support
gemini-blueprint | 1.0.0.RELEASE | x | spring-3.0.8 | Gemini Blueprint Extender
standard | 3.0.8 | x | standard-3.0.8 | Karaf standard feature
config | 3.0.8 | x | standard-3.0.8 | Provide OSGi ConfigAdmin support
region | 3.0.8 | x | standard-3.0.8 | Provide Region Support
package | 3.0.8 | x | standard-3.0.8 | Package commands and mbeans
kar | 3.0.8 | x | standard-3.0.8 | Provide KAR (KARaf archive) support
ssh | 3.0.8 | x | standard-3.0.8 | Provide a SSHd server on Karaf
management | 3.0.8 | x | standard-3.0.8 | Provide a JMX MBeanServer and a set of MBeans in K
karaf#root()> list -t 0
START LEVEL 100 , List Threshold: 0
ID | State | Lvl | Version | Name
------------------------------------------------------------------------------------------------------------
0 | Active | 0 | 4.2.1 | System Bundle
1 | Active | 5 | 2.4.7 | OPS4J Pax Url - aether:
2 | Active | 5 | 2.4.7 | OPS4J Pax Url - wrap:
3 | Active | 8 | 1.8.4 | OPS4J Pax Logging - API
4 | Active | 8 | 1.8.4 | OPS4J Pax Logging - Service
5 | Active | 10 | 3.0.8 | Apache Karaf :: Service :: Guard
6 | Active | 10 | 1.8.4 | Apache Felix Configuration Admin Service
7 | Active | 11 | 3.5.2 | Apache Felix File Install
8 | Active | 12 | 5.0.3 | ASM all classes with debug info
9 | Active | 20 | 1.1.1 | Apache Aries Util
10 | Active | 20 | 1.0.1 | Apache Aries Proxy API
11 | Active | 20 | 1.0.8 | Apache Aries Blueprint CM
12 | Active | 20 | 1.0.4 | Apache Aries Proxy Service
13 | Active | 20 | 1.0.1 | Apache Aries Blueprint API
14 | Resolved | 20 | 1.0.0 | Apache Aries Blueprint Core Compatiblity Fragment Bundle, Hosts: 15
15 | Active | 20 | 1.6.1 | Apache Aries Blueprint Core, Fragments: 14
16 | Active | 24 | 3.0.8 | Apache Karaf :: Deployer :: Spring
17 | Active | 24 | 3.0.8 | Apache Karaf :: Deployer :: Blueprint
18 | Active | 24 | 3.0.8 | Apache Karaf :: Deployer :: Wrap Non OSGi Jar
19 | Active | 25 | 3.0.8 | Apache Karaf :: Region :: Core
20 | Active | 25 | 3.0.8 | Apache Karaf :: Features :: Core
21 | Active | 26 | 3.0.8 | Apache Karaf :: Deployer :: Features
22 | Active | 30 | 2.13.0 | JLine
23 | Active | 30 | 0.2.1 | JLEdit :: Core
24 | Active | 30 | 3.0.8 | Apache Karaf :: Features :: Command
25 | Active | 30 | 3.0.8 | Apache Karaf :: Bundle :: Core
26 | Active | 30 | 3.0.8 | Apache Karaf :: Bundle :: Commands
27 | Active | 30 | 3.0.8 | Apache Karaf :: Shell :: Console
28 | Active | 30 | 3.0.8 | Apache Karaf :: JAAS :: Modules
29 | Active | 30 | 3.0.8 | Apache Karaf :: JAAS :: Config
30 | Active | 30 | 0.14.0 | Apache Mina SSHD :: Core
31 | Active | 30 | 3.0.8 | Apache Karaf :: Shell :: Help System
32 | Active | 30 | 3.0.8 | Apache Karaf :: Shell :: Table
33 | Active | 30 | 3.0.8 | Apache Karaf :: System :: Core
34 | Active | 30 | 3.0.8 | Apache Karaf :: System :: Shell Commands
35 | Active | 30 | 3.0.8 | Apache Karaf :: Shell :: Various Commands
36 | Active | 30 | 1.0.0 | Apache Aries Quiesce API
37 | Active | 30 | 3.0.8 | Apache Karaf :: ConfigAdmin :: Core
38 | Active | 30 | 3.0.8 | Apache Karaf :: ConfigAdmin :: Commands
39 | Active | 30 | 3.0.8 | Apache Karaf :: Instance :: Core
40 | Active | 30 | 3.0.8 | Apache Karaf :: Instance :: Command
41 | Active | 30 | 3.0.8 | Apache Karaf :: JAAS :: Command
42 | Active | 30 | 3.0.8 | Apache Karaf :: Diagnostic :: Core
43 | Active | 30 | 3.0.8 | Apache Karaf :: Diagnostic :: Command
44 | Active | 30 | 3.0.8 | Apache Karaf :: Log :: Core
45 | Active | 30 | 3.0.8 | Apache Karaf :: Log :: Command
46 | Active | 30 | 3.0.8 | Apache Karaf :: Service :: Core
47 | Active | 30 | 3.0.8 | Apache Karaf :: Service :: Command
48 | Active | 30 | 1.0.0.v20110524 | Region Digraph
49 | Active | 30 | 3.0.8 | Apache Karaf :: Region :: Persistence
50 | Active | 30 | 3.0.8 | Apache Karaf :: Region :: Shell Commands
51 | Active | 30 | 3.0.8 | Apache Karaf :: Package :: Core
52 | Active | 30 | 3.0.8 | Apache Karaf :: Package :: Commands
53 | Active | 30 | 3.0.8 | Apache Karaf :: KAR :: Core
54 | Active | 30 | 3.0.8 | Apache Karaf :: KAR :: Command
55 | Active | 30 | 3.0.8 | Apache Karaf :: Deployer :: Karaf Archive (.kar)
56 | Active | 30 | 2.0.7 | Apache MINA Core
57 | Active | 30 | 3.0.8 | Apache Karaf :: Shell :: SSH
58 | Active | 30 | 3.0.8 | Apache Karaf :: Management
59 | Active | 30 | 1.1.1 | Apache Aries JMX API
60 | Active | 30 | 1.1.6 | Apache Aries JMX Core
61 | Active | 30 | 1.1.0 | Apache Aries JMX Blueprint API
62 | Active | 30 | 1.1.0 | Apache Aries JMX Blueprint Core
63 | Active | 30 | 1.0.0 | Apache Aries JMX Whiteboard
64 | Active | 30 | 1.0.0.6 | Apache ServiceMix :: Bundles :: aopalliance
65 | Active | 30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-core
66 | Active | 30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-expression
67 | Active | 30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-beans
68 | Active | 30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-aop
69 | Active | 30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-context
70 | Active | 30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-context-support
71 | Active | 30 | 1.0.0.RELEASE | gemini-blueprint-io
72 | Active | 30 | 1.0.0.RELEASE | gemini-blueprint-core
73 | Active | 30 | 1.0.0.RELEASE | gemini-blueprint-extender
After restart I've got following exception printed for almost every bundle
73 - org.eclipse.gemini.blueprint.extender - 1.0.0.RELEASE | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=org.apache.karaf.config.command, config=OSGI-INF/blueprint/shell-config.xml))
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 25 in XML document from URL [bundle://38.0:0/OSGI-INF/blueprint/shell-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'command-bundle'.
For some bundles there's a problem with command-bundle element and for others with ext:property-placeholder
So it looks like Karaf core bundles have invalid blueprint xml? Is it a bug?
The Apache Karaf 2.x and 3.x versions use blueprint internally.
Blueprint specification is somewhat limited and does not cover any extension mechanism through namespaces. This is supported by both Aries Blueprint and Gemini Blueprint, but in different ways.
Those Karaf versions rely on Aries Blueprint, so it's a bit hard to get Gemini Blueprint working.
Karaf 4.x does not use Blueprint internally anymore, so it should be much easier to install Gemini Blueprint there.
That said, Gemini Blueprint isn't much active, so you should have a look at the Aries Blueprint implementation instead. Fwiw, Aries Blueprint also provides a full Spring compatibility layer if you need.
I am attempting to get JMX Console working on a Vagrant VM box with ActiveMQ 5.12.0 manually installed. I've followed the guide on
http://activemq.apache.org/jmx.html
and numerous Stackoverflow troubleshooting questions:
Apache ActiveMQ browser can't connect to JMX console
How do I turn on JMX in ActiveMQ 5.2
configure JMX for ActiveMQ for remoting access
but I am still not able to access the console from the host machine.
I've done the following steps:
added useJmx="true" onto the <broker> tag in the activemq.xml file
set the following management context in the activemq.xml file:
<managementContext createConnector="true" rmiServerPort="1098" connectorPort="1099"/>
set ACTIVEMQ_SUNJMX_START environment variable to
"\
-Dcom.sun.management.jmxremote.ssl=false\
-Dcom.sun.management.jmxremote.password.file=/usr/share/activemq/conf/jmx.password\
-Dcom.sun.management.jmxremote.access.file=/usr/share/activemq/conf/jmx.access\
"
attempting to connect on
service:jmx:rmi://192.168.150.117:1098/jndi/rmi://192.168.150.117:1099/jmxrmi
using admin:activemq as username:password (specified in jmx.access and jmx.password)
This is the activemq.log file:
2015-11-20 12:24:39,710 | INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1#190c4838: startup date [Fri Nov 20 12:24:39 GMT 2015]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2015-11-20 12:24:42,094 | INFO | PListStore:[/usr/share/activemq/data/localhost/tmp_storage] started | org.apache.activemq.store.kahadb.plist.PListStoreImpl | main
2015-11-20 12:24:42,191 | INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[/usr/share/activemq/data/kahadb] | org.apache.activemq.broker.BrokerService | main
2015-11-20 12:24:42,232 | INFO | JMX consoles can connect to service:jmx:rmi://localhost:1098/jndi/rmi://localhost:1099/jmxrmi | org.apache.activemq.broker.jmx.ManagementContext | JMX connector
2015-11-20 12:24:42,464 | INFO | Apache ActiveMQ 5.12.0 (localhost, ID:activemq.cdl.vm-56262-1448022282329-0:1) is starting | org.apache.activemq.broker.BrokerService | main
2015-11-20 12:24:42,492 | INFO | Listening for connections at: tcp://activemq.cdl.vm:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-11-20 12:24:42,498 | INFO | Connector openwire started | org.apache.activemq.broker.TransportConnector | main
2015-11-20 12:24:42,505 | INFO | Listening for connections at: amqp://activemq.cdl.vm:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-11-20 12:24:42,510 | INFO | Connector amqp started | org.apache.activemq.broker.TransportConnector | main
2015-11-20 12:24:42,525 | INFO | Listening for connections at: stomp://activemq.cdl.vm:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-11-20 12:24:42,532 | INFO | Connector stomp started | org.apache.activemq.broker.TransportConnector | main
2015-11-20 12:24:42,542 | INFO | Listening for connections at: mqtt://activemq.cdl.vm:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
2015-11-20 12:24:42,550 | INFO | Connector mqtt started | org.apache.activemq.broker.TransportConnector | main
2015-11-20 12:24:42,693 | INFO | Listening for connections at ws://activemq.cdl.vm:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.ws.WSTransportServer | main
2015-11-20 12:24:42,698 | INFO | Connector ws started | org.apache.activemq.broker.TransportConnector | main
2015-11-20 12:24:42,706 | INFO | Apache ActiveMQ 5.12.0 (localhost, ID:activemq.cdl.vm-56262-1448022282329-0:1) started | org.apache.activemq.broker.BrokerService | main
2015-11-20 12:24:42,720 | INFO | For help or more information please see: http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
2015-11-20 12:24:42,730 | WARN | Store limit is 102400 mb (current store usage is 0 mb). The data directory: /usr/share/activemq/data/kahadb only has 10221 mb of usable space - resetting to maximum available disk space: 10221 mb | org.apache.activemq.broker.BrokerService | main
2015-11-20 12:24:42,737 | WARN | Temporary Store limit is 51200 mb, whilst the temporary data directory: /usr/share/activemq/data/localhost/tmp_storage only has 10221 mb of usable space - resetting to maximum available 10221 mb. | org.apache.activemq.broker.BrokerService | main
2015-11-20 12:24:43,444 | INFO | ActiveMQ WebConsole available at http://0.0.0.0:8161/ | org.apache.activemq.web.WebConsoleStarter | main
2015-11-20 12:24:43,444 | INFO | ActiveMQ Jolokia REST API available at http://0.0.0.0:8161/api/jolokia/ | org.apache.activemq.web.WebConsoleStarter | main
2015-11-20 12:24:43,538 | INFO | Initializing Spring FrameworkServlet 'dispatcher' | /admin | main
2015-11-20 12:24:43,950 | INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed | /api | main
When I try to connect it just says "Secure Connection Failed. Retry insecurely?". It then tries and fails again with "Connection Failed: Retry?"
I set the following options on the ACTIVEMQ_SUNJMX_START environment variable:
export ACTIVEMQ_SUNJMX_START="\
-Dcom.sun.management.jmxremote\
-Dcom.sun.management.jmxremote.ssl=false\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.local.only=false\
"
And it now works.
I am having trouble forcing ActiveMQ 5.10.1 on CentOS 6 (64bit) with Oracle JDK 8 to use JNI driver for LevelDB. When I set indexFactory="org.fusesource.leveldbjni.JniDBFactory" - my broker fails to start. When I omit it, it does start, but it uses Pure Java driver.
<persistenceAdapter>
<levelDB directory="${activemq.data}/leveldb" indexFactory="org.fusesource.leveldbjni.JniDBFactory"/>
</persistenceAdapter>
I did install LevelDB rpm on my OS, but after the AMQ start, its log file indicates that it uses the pure java driver:
2015-01-27 05:44:48,172 | INFO | Using Persistence Adapter: LevelDB[/home/roman/amq/DISK1/broker1/data/leveldb] | org.apache.activemq.broker.BrokerService | main
2015-01-27 05:44:48,233 | INFO | Using the pure java LevelDB implementation. | org.apache.activemq.leveldb.LevelDBClient | main
2
I try adding the level-db jni jar file to the classpath, but AMQ fails to find the classes. Here is running broker (note classpath with the leveldbjni-1.8.jar - AMQ docs does not really explain if those optional libs are loaded or not by default?, so I added it by hand):
/home/roman/jdk1.8.0_31/bin/java -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/home/roman/amq/DISK1/broker1/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/home/roman/amq/DISK1/broker1/tmp -Dactivemq.classpath=;/home/roman/amq/DISK1/broker1/conf;/home/roman/apache-activemq-5.10.1/lib/optional/leveldbjni-1.8.jar -Dactivemq.home=/home/roman/apache-activemq-5.10.1 -Dactivemq.base=/home/roman/amq/DISK1/broker1 -Dactivemq.conf=/home/roman/amq/DISK1/broker1/conf -Dactivemq.data=/home/roman/amq/DISK1/broker1/data -jar /home/roman/apache-activemq-5.10.1/bin/activemq.jar start
Here is the error I get in the log file when forcing JNI to be used for LevelDB:
2015-01-28 05:07:34,904 | INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1#6276ae34: startup date [Wed Jan 28 05:07:34 PST 2015]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2015-01-28 05:07:36,139 | INFO | Using Persistence Adapter: LevelDB[/home/roman/amq/DISK1/broker1/data/leveldb] | org.apache.activemq.broker.BrokerService | main
2015-01-28 05:07:36,193 | ERROR | Failed to start Apache ActiveMQ ([broker1, null], java.lang.Exception: Could not load any of the index factory classes: org.fusesource.leveldbjni.JniDBFactory) | org.apache.activemq.broker.BrokerService | main
2015-01-28 05:07:36,198 | INFO | Apache ActiveMQ 5.10.1 (broker1, null) is shutting down | org.apache.activemq.broker.BrokerService | main
2015-01-28 05:07:36,201 | INFO | Connector openwire stopped | org.apache.activemq.broker.TransportConnector | main
2015-01-28 05:07:36,205 | INFO | Connector amqp stopped | org.apache.activemq.broker.TransportConnector | main
2015-01-28 05:07:36,208 | INFO | Connector stomp stopped | org.apache.activemq.broker.TransportConnector | main
2015-01-28 05:07:36,212 | INFO | Connector mqtt stopped | org.apache.activemq.broker.TransportConnector | main
2015-01-28 05:07:36,215 | INFO | Connector ws stopped | org.apache.activemq.broker.TransportConnector | main
2015-01-28 05:07:36,229 | INFO | Stopped LevelDB[/home/roman/amq/DISK1/broker1/data/leveldb] | org.apache.activemq.leveldb.LevelDBStore | main
2015-01-28 05:07:36,240 | INFO | Apache ActiveMQ 5.10.1 (broker1, null) uptime 0.135 seconds | org.apache.activemq.broker.BrokerService | main
2015-01-28 05:07:36,243 | INFO | Apache ActiveMQ 5.10.1 (broker1, null) is shutdown | org.apache.activemq.broker.BrokerService | main
2015-01-28 05:07:36,246 | INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1#6276ae34: startup date [Wed Jan 28 05:07:34 PST 2015]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
2015-01-28 05:07:36,252 | WARN | Exception thrown from LifecycleProcessor on context close | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.apache.activemq.xbean.XBeanBrokerFactory$1#6276ae34: startup date [Wed Jan 28 05:07:34 PST 2015]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30)[activemq-spring-5.10.1.jar:5.10.1]
at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:809)[activemq-broker-5.10.1.jar:5.10.1]
at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122)[activemq-spring-5.10.1.jar:5.10.1]
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:601)[activemq-broker-5.10.1.jar:5.10.1]
at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.10.1.jar:5.10.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483)[:1.8.0_31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1638)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1579)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)[spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)[xbean-spring-3.16.jar:3.16]
at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)[xbean-spring-3.16.jar:3.16]
at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)[activemq-spring-5.10.1.jar:5.10.1]
at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring-5.10.1.jar:5.10.1]
at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring-5.10.1.jar:5.10.1]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker-5.10.1.jar:5.10.1]
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker-5.10.1.jar:5.10.1]
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console-5.10.1.jar:5.10.1]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.10.1.jar:5.10.1]
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)[activemq-console-5.10.1.jar:5.10.1]
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)[activemq-console-5.10.1.jar:5.10.1]
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.10.1.jar:5.10.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483)[:1.8.0_31]
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.10.1]
at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.10.1]
The AMQ doc does not explain on how to configure LevelDB for JNI to work. Any suggestions?
The reason I want to use JNI driver is because with pure Java driver my AMQ broker performs about ~20% slower than KahaDB in 80 concurrent user / 20 queues test. I am hoping JNI with LevelDB can make AMQ go faster than KahaDB configuration.
I know this is old, but I couldn't find the answer really documented anywhere else. All I needed to do was download the appropriate JNI library to the ActiveMQ lib directory. For example:
wget -O /etc/activemq/apache-activemq-5.13.0/lib/optional/leveldbjni-linux64-1.8.jar http://central.maven.org/maven2/org/fusesource/leveldbjni/leveldbjni-linux64/1.8/leveldbjni-linux64-1.8.jar