I'm part of a team writing a web app that uses Hibernate Search, and we've recently tried to start to implement the use of JGroups to keep Lucene indexes on different nodes in sync with each other.
However, I've been unable to get past the most basic first steps in getting this set up, and documentation seems quite sparse.
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="myFactory">
<property name="dataSource" ref="myDataSource"/>
<property name="persistenceXmlLocation" value="/WEB-INF/persistence.xml"/>
<property name="persistenceUnitName" value="persistenceUnit"/>
<property name="jpaVendorAdapter" ref="vendorAdapter"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.search.worker.backend.jgroups.configurationFile">jgroups-config.xml</prop>
<prop key="hibernate.search.default.directory_provider">infinispan</prop>
<prop key="hibernate.search.default.indexBase">indexes</prop>
<prop key="hibernate.search.default.worker.backend">jgroups</prop>
<prop key="hibernate.search.services.jgroups.clusterName">MyCluster</prop>
<prop key="hibernate.search.error_handler">log</prop>
<prop key="hibernate.search.lucene_version">LUCENE_36</prop>
<prop key="hibernate.search.generate_statistics">true</prop>
<prop key="hibernate.search.jmx_enabled">true</prop>
</props>
</property>
The key property here is hibernate.search.worker.backend.jgroups.configurationFile which gives the name of the configuration file for jgroups, which we will eventually need. I've tried putting this file in WEB-INF and in with the props files in the JBoss modules directory structure (in which other files are located and successfully loaded), but it just is not getting picked up.
In the logs I can see:
16:34:57,609 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000005: Starting JGroups Channel
16:34:57,609 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000011: Unable to use any JGroups configuration mechanisms provided in properties { hibernate.search.default.worker.backend=jgroups, hibernate.search.default.directory_provider=infinispan, hibernate.search.worker.backend.jgroups.configurationFile=jgroups-config.xml}. Using default JGroups configuration file!
16:34:59,427 INFO [stdout] (MSC service thread 1-1)
16:34:59,427 INFO [stdout] (MSC service thread 1-1) -------------------------------------------------------------------
16:34:59,428 INFO [stdout] (MSC service thread 1-1) GMS: address=LDNLPT1271-PC-17149, cluster=CrisisHubCluster, physical address=172.26.10.169:58147
16:34:59,428 INFO [stdout] (MSC service thread 1-1) -------------------------------------------------------------------
16:35:02,448 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsMasterMessageListener] (MSC service thread 1-1) HSEARCH000015: Received new cluster view: [LDNLPT1271-PC-17149|0] [LDNLPT1271-PC-17149]
16:35:02,450 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000006: Connected to cluster [ MyCluster ]. The node address is LDNLPT1271-PC-17149
16:35:02,513 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (CacheStartThread,HibernateSearch-Infinispan-cluster,LuceneIndexesMetadata) ISPN000078: Starting JGroups Channel
16:35:02,514 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (CacheStartThread,HibernateSearch-Infinispan-cluster,LuceneIndexesMetadata) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
I've truncated the list of properties in Unable to use any JGroups configuration mechanisms provided in properties as it would take up several pages, but if you look at the line, you can see it lists the property at the same time that it says it can't find it.
So, it's not picking up the config file location, and it's using a default.
Has anyone here used jgroups with Hibernate Search? Did you manage to supply a custom jgroups configuration file? How did you do it?
Right. I had to download the Hibernate Search source and step through the server start up in order to find this. I was using Hibernate 4.2, and the documentation version I was referring to was mostly for 3.2.
In between the two versions, someone renamed the property from hibernate.search.worker.backend.jgroups.configurationFile to hibernate.search.services.jgroups.configurationFile.
Related
I have tried to install NiFi toolkit to enable TLS. I followed instructions given here.
I followed the steps,using localhost and host as sachith but when I try to start NiFi again, I get following error.
Bootstrap Config File: /home/sachith/nifi-1.9.2/conf/bootstrap.conf
16:59:23,949 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
Could NOT find resource [logback-test.xml] 16:59:23,950 |-INFO in
ch.qos.logback.classic.LoggerContext[default] - Could NOT find
resource [logback.groovy] 16:59:23,950 |-INFO in
ch.qos.logback.classic.LoggerContext[default] - Found resource
[logback.xml] at
[file:/home/sachith/Documents/Projects/nifi-1.9.2-bin/nifi-1.9.2/conf/logback.xml]
16:59:24,032 |-INFO in
ch.qos.logback.classic.joran.action.ConfigurationAction - debug
attribute not set 16:59:24,046 |-INFO in
ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan
for changes in
[file:/home/sachith/Documents/Projects/nifi-1.9.2-bin/nifi-1.9.2/conf/logback.xml]
16:59:24,046 |-INFO in
ch.qos.logback.classic.joran.action.ConfigurationAction - Setting
ReconfigureOnChangeTask scanning period to 30 seconds 16:59:24,049
|-INFO in
ch.qos.logback.classic.joran.action.LoggerContextListenerAction -
Adding LoggerContextListener of type
[ch.qos.logback.classic.jul.LevelChangePropagator] to the object stack
16:59:24,062 |-INFO in
ch.qos.logback.classic.jul.LevelChangePropagator#48140564 -
Propagating DEBUG level on Logger[ROOT] onto the JUL framework
16:59:24,062 |-INFO in
ch.qos.logback.classic.joran.action.LoggerContextListenerAction -
Starting LoggerContextListener 16:59:24,062 |-INFO in
ch.qos.logback.core.joran.action.AppenderAction - About to instantiate
appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
16:59:24,067 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
Naming appender as [APP_FILE] 16:59:24,084 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy#93122545 - Archive
files will be limited to [100 MB] each. 16:59:24,127 |-INFO in
c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy#93122545 - No
compression will be used 16:59:24,128 |-INFO in
c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy#93122545 - Will use
the pattern
/home/sachith/Documents/Projects/nifi-1.9.2-bin/nifi-1.9.2/logs/nifi-app_%d{yyyy-MM-dd_HH}.%i.log
for the active file 16:59:24,131 |-INFO in
ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP#7c30a502 - The date
pattern is 'yyyy-MM-dd_HH' from file name pattern
'/home/sachith/Documents/Projects/nifi-1.9.2-bin/nifi-1.9.2/logs/nifi-app_%d{yyyy-MM-dd_HH}.%i.log'.
nifi-app.log
2020-06-26 09:27:50,296 INFO [main] org.eclipse.jetty.server.Server Started #186210ms
2020-06-26 09:27:50,297 WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Unsatisfied dependency expressed through method 'setFilterChainProxySecurityConfigurer' parameter 1; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.nifi.web.NiFiWebApiSecurityConfiguration': Unsatisfied dependency expressed through method 'setJwtAuthenticationProvider' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAuthenticationProvider' defined in class path resource [nifi-web-security-context.xml]: Cannot resolve reference to bean 'authorizer' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorizer': FactoryBean threw exception on object creation; nested exception is org.apache.nifi.authorization.exception.AuthorizerCreationException: Unable to locate configured Access Policy Provider: file-access-policy-provider
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:666)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1269)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
Edit : After Andy's initial answer.
My authorizers.xml
<accessPolicyProvider>
<identifier>file-access-policy-provider</identifier>
<class>org.apache.nifi.authorization.FileAccessPolicyProvider</class>
<property name="User Group Provider">file-user-group-provider</property>
<property name="Authorizations File">./conf/authorizations.xml</property>
<property name="Initial Admin Identity">CN=sachith, OU=NiFi</property>
<property name="Legacy Authorized Users File"></property>
<property name="Node Identity 1"></property>
<property name="Node Group"></property>
</accessPolicyProvider>
<userGroupProvider>
<identifier>file-user-group-provider</identifier>
<class>org.apache.nifi.authorization.FileUserGroupProvider</class>
<property name="Users File">./conf/users.xml</property>
<property name="Legacy Authorized Users File"></property>
<property name="Initial User Identity 1">CN=sachith, OU=NiFi</property>
</userGroupProvider>
You haven't provided the complete log output, so there may be other issues here, but it looks like the problem is nested exception is org.apache.nifi.authorization.exception.AuthorizerCreationException: Unable to locate configured Access Policy Provider: file-access-policy-provider. Did you provide an authorizers.xml file which defines a FileAccessPolicyProvider?
Look specifically at Step 7 of the walkthrough guide you linked to.
I am trying to establish a security domain using wildfly 18.0.1. These are the settings I use:
standalone.xml:
<security-domain name="my-security-domain" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required">
<module-option name="usersProperties" value="users.properties"/>
<module-option name="rolesProperties" value="roles.properties"/>
</login-module>
</authentication>
</security-domain>
I created user with add-user.bat and created files: users.properties and roles.properties filled with created user data.
IntelliJ doesnt's seem to recognize security annotations and I can't import them:
#Stateless
#WebService(name = "HelloWorldType", portName = "HelloWorldPort", targetNamespace = "https://soap.soa.pl/lab1/ws")
#SecurityDomain("my-security-domain") // in standalone.xml
#DeclareRoles({"MyRole"})
#WebContext(contextRoot="lab1", urlPattern="/HelloWorld", authMethod="BASIC", transportGuarantee="NONE")
#SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL)
public class HelloWorld {
#WebMethod()
#RolesAllowed("MyRole")
public String sayHello(#WebParam(name = "message") String message) {
return "Here is the message: '" + message + "'";
}
}
Also, now I'm not able to start wildfly serwer:
18:49:25,854 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) starting
18:49:26,643 INFO [org.wildfly.security] (ServerService Thread Pool -- 25) ELY00001: WildFly Elytron version 1.10.4.Final
18:49:27,227 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
18:49:27,256 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 13) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
18:49:27,321 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "lab1-ear.ear")]) - failure description: "WFLYSRV0137: No deployment content with hash 5cddb572897ba715135a11fe8d8c7c56f30099b5 is available in the deployment content repository for deployment 'lab1-ear.ear'. This is a fatal boot error. To correct the problem, either restart with the --admin-only switch set and use the CLI to install the missing content or remove it from the configuration, or remove the deployment from the xml configuration file and restart."
18:49:27,326 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
18:49:27,337 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0050: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) stopped in 7ms
I have no idea why, especially the annotations, don't work.. please help.
You need to locate the jar file providing these annotation classes and add it to the Module Dependencies.
If your project is Gradle or Maven managed, add the dependency to build.gradle/pom.xml instead.
I have a client app that is consuming from a queue in an activemq cluster. The app is running in tomcat 7 and uses camel (v2.10.3) and spring 3.1.2. I use a PooledConnectionFactory to connect.
Everything works for a while (sometimes days), but then all of the connections go away in the pool (the activemq broker web console shows no consumers. I figured it was the idletimeout issue, but adding the suggested config didn't help. I also upgraded to activemq-pool-5.10.0.jar, but also no luck.
SO, I'm trying to find out what is going on and was hoping to use JMX, but I can not find any related mbeans (via jconsole) that the pool registers. Is there a way to monitor/control the pool via JMX (or another/better way)?
My config fyi:
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMWSslConnectionFactory">
<property name="brokerURL" value="failover://ssl://...."/>
</bean>
<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
<property name="idleTimeout" value="0"/>
</bean>
As simple as it sounds, I don't see any other option other than to turn on TRACE level logging for that class. Check out the logs of this question.
I am trying to create a JMS Client and Producer under JBoss. I am able to startup a standalone version of HornetQ 2.3.0.Final, connect to it, and send messages back and forth. However, I am running my client through eclipse WTP as a war (but I'm eventually going to run it from the same JBoss instance). I am now trying to use the built in JBoss7-as hornetq, but I'm running into problems. I've modified the standalone-full.xml and added to the hornetq-server section
<security-enabled>false</security-enabled>`
and run it with
./standalone.sh -b 0.0.0.0 -server-config=standalone-full.xml`
and then try to run my webservice (with no changes to the code that will connect to the standalone hornetq instance), but I get a
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jms.listener.SimpleMessageListenerContainer#0' defined in ServletContext resource [/META-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hornetq.api.core.HornetQException.<init>(ILjava/lang/String;Ljava/lang/Throwable;)V
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
my JBoss output looks like:
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: C:\codebase\jboss-as-7.1.1.Final
JAVA: C:\Java\jdk1.6.0_43/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml
=========================================================================
Listening for transport dt_socket at address: 4242
15:29:08,505 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
15:29:08,672 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
15:29:08,713 INFO [org.jboss.as] JBAS0 15899: JBoss AS 7.1.1.Final "Brontes" starting
15:29:09,632 INFO [org.xnio] XNIO Version 3.0.3.GA
15:29:09,637 INFO [org.jboss.as.server] JBAS0 15888: Creating http management service using socket-binding (management-http)
15:29:09,646 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
15:29:09,654 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
15:29:09,693 INFO [org.jboss.as.configadmin] JBAS016200: Activating ConfigAdmin Subsystem
15:29:09,721 INFO [org.jboss.as.connector.subsystems.datasources] JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
15:29:09,735 INFO [org.jboss.as.clustering.infinispan] JBAS010280: Activating Infinispan subsystem.
15:29:09,771 INFO [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem
15:29:09,785 INFO [org.jboss.as.security] JBAS013101: Activating Security Subsystem
15:29:09,789 INFO [org.jboss.as.webservices] JBAS0 15537: Activating WebServices Extension
15:29:09,811 INFO [org.jboss.as.logging] JBAS01 1502: Removing bootstrap log handlers
15:29:09,810 INFO [org.jboss.as.connector] JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
15:29:09,834 INFO [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.7.Final
15:29:09,860 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS0 15400: Bound mail session [java:jboss/mail/Default]
15:29:09,874 INFO [org.jboss.as.jacorb] (ServerService Thread Pool -- 38) JBAS016300: Activating JacORB Subsystem
15:29:09,943 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 49) JBAS011940: Activating OSGi Subsystem
15:29:10,073 INFO [org.jboss.jaxr] (MSC service thread 1-5) JBAS014000: Started JAXR subsystem, binding JAXR connection factory into JNDI as: java:jboss/jaxr/ConnectionFactory
15:29:10,075 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.2.GA
15:29:10,378 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS0 15012: Started FileSystemDeploymentService for directory C:\codebase\jboss-as-7.1.1.Final\standalone\deployments
15:29:10,482 WARN [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011600: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal
15:29:10,486 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /0.0.0.0:4447
15:29:10,492 INFO [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:9999
15:29:10,512 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-7) Starting Coyote HTTP/1.1 on http-0.0.0.0-0.0.0.0-8080
15:29:10,572 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messagingjournal,bindingsDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messagingbindings,largeMessagesDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messaginglargemessages,pagingDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messagingpaging)
15:29:10,577 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) Waiting to obtain live lock
15:29:10,606 INFO [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-2) Using NIO Journal
15:29:10,672 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
15:29:10,679 WARN [jacorb.codeset] (MSC service thread 1-4) Warning - unknown codeset (Cp1252) - defaulting to ISO-8859-1
15:29:10,682 INFO [org.hornetq.core.server.impl.FileLockNodeManager] (MSC service thread 1-2) Waiting to obtain live lock
15:29:10,683 INFO [org.hornetq.core.server.impl.FileLockNodeManager] (MSC service thread 1-2) Live Server Obtained live lock
15:29:10,712 INFO [org.jboss.as.jacorb] (MSC service thread 1-4) JBAS016330: CORBA ORB Service started
15:29:10,783 INFO [org.jboss.as.jacorb] (MSC service thread 1-4) JBAS016328: CORBA Naming Service started
15:29:11,635 INFO [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-2) Deleting unreferenced message id=30064771066 from the journal
15:29:11,705 INFO [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-2) Started Netty Acceptor version 3.2.5.Final-a96d88c 0.0.0.0:5455 for CORE protocol
15:29:11,708 INFO [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-2) Started Netty Acceptor version 3.2.5.Final-a96d88c 0.0.0.0:5445 for CORE protocol
15:29:11,717 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) Server is now live
15:29:11,719 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) HornetQ Server version 2.2.13.Final (HQ_2_2_13_FINAL_AS7, 122) [337187b6-ed9e-11e2-a678-549304ffc20f]) started
15:29:11,724 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.queue.DemoQueue
15:29:11,754 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/DemoQueue
15:29:11,756 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/queue/DemoQueue
15:29:11,759 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.queue.testQueue
15:29:11,767 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/queue/test
15:29:11,771 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test
15:29:11,789 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
15:29:11,791 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory
15:29:11,793 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.topic.testTopic
15:29:11,816 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/topic/test
15:29:11,818 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/test
15:29:11,825 INFO [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
15:29:11,898 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010406: Registered connection factory java:/JmsXA
15:29:11,910 INFO [org.hornetq.ra.HornetQResourceAdapter] (MSC service thread 1-7) HornetQ resource adaptor started
15:29:11,912 INFO [org.jboss.as.connector.services.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-7) IJ020002: Deployed: file://RaActivatorhornetq-ra
15:29:11,917 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
15:29:12,005 INFO [org.jboss.as] (Controller Boot Thread) JBAS0 15951: Admin console listening on http://127.0.0.1:9990
15:29:12,007 INFO [org.jboss.as] (Controller Boot Thread) JBAS0 15874: JBoss AS 7.1.1.Final "Brontes" started in 3707ms - Started 170 of 249 services (78 services are passive or on-demand)
15:29:53,048 ERROR [org.hornetq.core.protocol.core.impl.HornetQPacketHandler] (Old I/O server worker (parentId: 2006673595, [id: 0x779b68bb, /0.0.0.0:5445])) Failed to create session : HornetQException[errorCode=105 message=Unable to validate user: null]
at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:147) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:807) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handleCreateSession(HornetQPacketHandler.java:187) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handlePacket(HornetQPacketHandler.java:85) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:508) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:556) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:517) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:533) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73) [hornetq-core-2.2.13.Final.jar:]
at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline$StaticChannelHandlerContext.sendUpstream(StaticChannelPipeline.java:534) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:287) [netty-3.2.6.Final.jar:]
at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134) [hornetq-core-2.2.13.Final.jar:]
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:367) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:100) [netty-3.2.6.Final.jar:]
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.2.6.Final.jar:]
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44) [netty-3.2.6.Final.jar:]
at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181) [netty-3.2.6.Final.jar:]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_43]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_43]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_43]`
and my client application-context.xml looks like:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p" xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd
http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring
http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd">
<bean id="hornetConnectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">
<constructor-arg name="ha" value="false" />
<constructor-arg>
<bean class="org.hornetq.api.core.TransportConfiguration">
<constructor-arg
value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />
<constructor-arg>
<map key-type="java.lang.String" value-type="java.lang.Object">
<!-- HornetQ standalone instance details -->
<entry key="host" value="127.0.0.1"></entry>
<entry key="port" value="5445"></entry>
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<!-- ConnectionFactory Definition -->
<bean id="connectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<constructor-arg ref="hornetConnectionFactory" />
</bean>
<!-- Definition of the JMS queue -->
<bean id="defaultDestination" class="org.hornetq.jms.client.HornetQQueue">
<constructor-arg index="0" value="DemoQueue" />
</bean>
<bean id="producerTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestination" ref="defaultDestination" />
</bean>
<bean class="com.example.Sender" id="messageSenderService"
p:jmsTemplate-ref="producerTemplate"></bean>
<bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="defaultDestination" />
<property name="messageListener" ref="messageListener" />
</bean>
<bean id="taskExecutor"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="5" />
<property name="maxPoolSize" value="10" />
<property name="queueCapacity" value="25" />
</bean>
<bean class="com.example.Receiver" id="messageListener">
<property name="taskExecutor" ref="taskExecutor" />
</bean>
and finally, I have
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-jms-client-bom</artifactId>
<version>7.1.1.Final</version>
<type>pom</type>
</dependency>
in my pom
What am I missing? How is it that I can connect to a standalone hornetq, but not one embedded into jboss? Is it a dependency/classpath issue? Or is it a user/security issue?
It's an issue with JBoss, you have to first configure JMS (Hornet) on the server:
org.jboss.as.messaging subsystem (including hornetq-server)
related sockets/ports in socket-binding-group
both in standalone.xml.
How did you define hornetq-server in standalone.xml?
Update:
Here's my configuration for JBoss 7.1.0:
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>5000</redelivery-delay>
<max-delivery-attempts>10</max-delivery-attempts>
<max-size-bytes>10485760</max-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="ConnectionFactory"/>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="myQueue">
<entry name="queue/my"/>
<entry name="java:jboss/queue/my"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
</subsystem>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
.......
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>
.......
</socket-binding-group>
Turns out I needed to remove my dependencies on hornetq in my client, and only have the jboss-as-jms-client-bom dependency. It was probably using the wrong classes which weren't compatible
I've set out on an endeavour to implement support for a feature similar to mod_xsendfile on torquebox (www.torquebox.org). Torquebox is basically a bunch of code on top of JBoss AS 7, which makes my effort kinda equivalent to making sendfile work on JBoss AS 7.
The main problem here is probably my confusion over JBoss, but after wasting way too many hours exhausting all my googling resources, I have to beleive that there's someone out there who actually know how this thing works in AS 7.
As I understand this, sendfile is supported in JBoss by using the JBoss Web native connectors (http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10), namely the APR http connector.
After spending hours failing to install these on AS 7, which seems works like a charm for others (https://community.jboss.org/message/614790), grep'ing my local JBoss dir tells me, that these native connectors are appearently bundled with AS 7. In my case, the dll needed is placed in
%JBOSS_HOME%\modules\org\jboss\as\web\main\lib\win-x86_64
So epic fail, trying to install something that's already there.
Inspecting my standalone.xml configuration file also reveal this native connector is being used
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
Switching all logging levels to debug and inspecting the log shows the log message
standalone/log/server.log.2012-02-10:324:23:12:17,964 INFO [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-5) Starting Coyote HTTP/1.1 on http-127.0.0.1-127.0.0.1-8080
Where Http11AprProtocol indicates that the APR http connector is used. However, many posts on the web mention that the following line should also be shown:
org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
No matter the logging level, the AprLifecycleListener line never shows.
When I review this, is seems that the APR http connector is now in use.
According to the docs, I can get the following servlet to work
public class Sendfile extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
if(Boolean.TRUE == request.getAttribute("org.apache.tomcat.sendfile.support")){
// Send all the files!!
}
else{
throw new ServletException("BOOM!");
}
}
}
But no. The org.apache.tomcat.sendfile.support attribute is null and if try attempt to set http headers for sending a file (ignoring the support attribute) and set the rest of the required sendfile attributes, my browser thinks that it's receiving a file, but no data is transferred... and the connection is left hanging.
To conclude the question, it seems the required APR native connector is in use, sendfile should be enabled by default, but the server has no clue what Im trying to make it do.
How to proceed?
I was also lost hours trying to learn how it works. You did everything right. Just missed putting the Web System as native=true:
<subsystem xmlns="urn:jboss:domain:web:1.1"
default-virtual-server="default-host" native="true">
Startup with it:
11:00:26,018 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: apr-1
11:00:26,039 DEBUG [org.jboss.modules] (ServerService Thread Pool -- 58) Module org.jboss.xb:main defined by local module loader #d8d9850 (roots: /home/mmagnani/Development/jboss-eap/jboss-eap-6.0/modules)
11:00:26,070 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: z
11:00:26,071 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: crypto
11:00:26,072 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: ssl
11:00:26,079 DEBUG [org.jboss.as.ejb3] (ServerService Thread Pool -- 36) Adding EJB #Asynchronous support
11:00:26,082 DEBUG [org.jboss.as.ejb3] (ServerService Thread Pool -- 36) Configuring timers
11:00:26,092 DEBUG [org.jboss.as.ejb3] (ServerService Thread Pool -- 36) Adding EJB IIOP support
11:00:26,101 FINE [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-6) Starting server HornetQServerImpl::
11:00:26,120 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: tcnative-1
11:00:26,141 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded Apache Tomcat Native library 1.1.23.
11:00:26,141 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) APR capabilities: IPv6 [true], sendfile [true], random [true].
Good Luck :)