EJB's not being injected in JAX-RS - jboss

I am using JBoss 6.2.0 EAP, I am trying to get my EJB's injected into my JAX-RS classes but I am getting a NullPointerEXception. It's definitely the CUstomerDAO class, because the error at line 29 is the printOut method being called on a null object. I added beans.xml to my WEB-INF. I am wondering if the servlet I added, or the web.xml configuration I added is giving me an error. I declared a datasource on the jboss server and its working fine. It's just the new stuff I added seems to throw the error. If anyone wants the project I can put it up.
Here are my files
Error stack trace
10:11:32,834 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "mysql-connector-java-5.1.29-bin.jar" (runtime-name: "mysql-connector-java-5.1.29-bin.jar")
10:11:32,835 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss-eap-6.2/standalone/deployments
10:11:33,508 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
10:11:33,536 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:/tutorial]
10:11:33,769 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "mysql-connector-java-5.1.29-bin.jar" (runtime-name : "mysql-connector-java-5.1.29-bin.jar")
10:11:33,852 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
10:11:33,852 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
10:11:33,853 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) started in 6615ms - Started 160 of 220 services (58 services are passive or on-demand)
10:12:44,006 INFO [org.jboss.as.repository] (HttpManagementService-threads - 2) JBAS014900: Content added at location /opt/jboss-eap-6.2/standalone/data/content/bc/c99f85aabe406819b2f1f6d5c660b3fcb0d231/content
10:12:51,778 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "webproject.war" (runtime-name: "webproject.war")
10:12:52,031 WARN [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016010: Warning while parsing vfs:/content/webproject.war/WEB-INF/beans.xml:6 SchemaLocation: schemaLocation value = ' http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd' must have even number of URI's.
10:12:52,103 INFO [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for tutorial
10:12:52,239 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment webproject.war
10:12:52,267 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named WebProject in deployment unit deployment "webproject.war" are as follows:
java:global/webproject/WebProject!com.example.ejbrest.WebProject
java:app/webproject/WebProject!com.example.ejbrest.WebProject
java:module/WebProject!com.example.ejbrest.WebProject
java:global/webproject/WebProject
java:app/webproject/WebProject
java:module/WebProject
10:12:52,268 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CustomerDAO in deployment unit deployment "webproject.war" are as follows:
java:global/webproject/CustomerDAO!com.example.ejbrest.CustomerDAO
java:app/webproject/CustomerDAO!com.example.ejbrest.CustomerDAO
java:module/CustomerDAO!com.example.ejbrest.CustomerDAO
java:global/webproject/CustomerDAO
java:app/webproject/CustomerDAO
java:module/CustomerDAO
10:12:52,270 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CustomerWS in deployment unit deployment "webproject.war" are as follows:
java:global/webproject/CustomerWS!com.example.ejbrest.CustomerWS
java:app/webproject/CustomerWS!com.example.ejbrest.CustomerWS
java:module/CustomerWS!com.example.ejbrest.CustomerWS
java:global/webproject/CustomerWS
java:app/webproject/CustomerWS
java:module/CustomerWS
10:12:52,514 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: webproject.war
10:12:52,598 INFO [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900 1.1.16 (redhat)
10:12:52,657 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016008: Starting weld service for deployment webproject.war
10:12:52,658 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 48) JBAS011402: Starting Persistence Unit Service 'webproject.war#tutorial'
10:12:52,879 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 48) HCANN000001: Hibernate Commons Annotations {4.0.1.Final-redhat-2}
10:12:52,897 INFO [org.hibernate.Version] (ServerService Thread Pool -- 48) HHH000412: Hibernate Core {4.2.7.SP1-redhat-3}
10:12:52,900 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 48) HHH000206: hibernate.properties not found
10:12:52,912 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 48) HHH000021: Bytecode provider name : javassist
10:12:52,937 INFO [org.hibernate.ejb.Ejb3Configuration] (ServerService Thread Pool -- 48) HHH000204: Processing PersistenceUnitInfo [
name: tutorial
...]
10:12:53,042 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 48) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
10:12:53,377 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 48) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
10:12:53,496 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (ServerService Thread Pool -- 48) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
10:12:53,502 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 48) HHH000397: Using ASTQueryTranslatorFactory
10:12:53,563 INFO [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 48) HV000001: Hibernate Validator 4.3.1.Final-redhat-1
10:12:54,400 INFO [org.jboss.web] (ServerService Thread Pool -- 49) JBAS018210: Register web context: /webproject
10:12:54,476 INFO [org.jboss.resteasy.cdi.CdiInjectorFactory] (ServerService Thread Pool -- 49) Found BeanManager at java:comp/BeanManager
10:12:55,057 INFO [org.jboss.as.server] (HttpManagementService-threads - 2) JBAS018559: Deployed "webproject.war" (runtime-name : "webproject.war")
10:13:08,430 INFO [org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher] (http-localhost/127.0.0.1:8080-1) Deploying javax.ws.rs.core.Application: class com.example.ejbrest.RestApplication$Proxy$_$$_WeldClientProxy
10:13:08,441 INFO [org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher] (http-localhost/127.0.0.1:8080-1) Adding singleton resource com.example.ejbrest.CustomerWS from Application javax.ws.rs.core.Application
10:13:08,649 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/webproject].[Resteasy]] (http-localhost/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.NullPointerException
at com.example.ejbrest.CustomerWS.getCustomer(CustomerWS.java:29) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.7.Final-redhat-2.jar:2.3.7.Final-redhat-2]
... 21 more
web.xml
<?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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<display-name>RestEasy sample Web Application</display-name>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.example.ejbrest.RestApplication</param-value>
</init-param>
<!-- <load-on-startup>1</load-on-startup>-->
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/customers/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ControllerServlet</servlet-name>
<servlet-class>com.example.ejbrest.ControllerServlet</servlet-class>
<!-- <load-on-startup>0</load-on-startup>-->
</servlet>
<servlet-mapping>
<servlet-name>ControllerServlet</servlet-name>
<!-- <url-pattern>/tutorial/*</url-pattern>-->
<url-pattern>/application/*</url-pattern>
</servlet-mapping>
</web-app>
beans.xml
<!-- Marker file indicating CDI should be enabled -->
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd">
</beans>
<!-- http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"
http://java.sun.com/xml/ns/javaee -->
persistence.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="tutorial">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/tutorial</jta-data-source>
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
Java classes:
package com.example.ejbrest;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import org.jboss.resteasy.plugins.providers.html.View;
#Path("/customers")
#Stateless
#LocalBean
public class CustomerWS {
#EJB
private CustomerDAO customersDao;
#GET
#Path("/first/{id}")
public Customer getCustomer(#PathParam("id") int id) {
customersDao.printOut();
return customersDao.getCustomer(id);
}
#GET
#Path("/second/{id}")
public View getCustomer() {
System.out.println("Got in here! ! ! ");
View v = new View("/application");
//v.render(arg0, arg1);
//System.out.println("path " + v.getPath());
return v;
}
#POST
public void addCustomers(List<Customer> customers) {
customersDao.addCustomers(customers);
}
}
CustomerDAO:
package com.example.ejbrest;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
#Stateless
#LocalBean
public class CustomerDAO {
#PersistenceContext
private EntityManager em;
public Customer getCustomer(int id) {
return em.find(Customer.class, id);
}
public void printOut(){
System.out.println("AGGGGGH!");
}
#TransactionAttribute(TransactionAttributeType.REQUIRED)
public void addCustomers(List<Customer> customers) {
for (Customer customer : customers) {
em.persist(customer);
}
}
}
CustomerWS
package com.example.ejbrest;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import org.jboss.resteasy.plugins.providers.html.View;
#Path("/customers")
#Stateless
#LocalBean
public class CustomerWS {
#EJB
private CustomerDAO customersDao;
#GET
#Path("/first/{id}")
public Customer getCustomer(#PathParam("id") int id) {
customersDao.printOut();
return customersDao.getCustomer(id);
}
#GET
#Path("/second/{id}")
public View getCustomer() {
System.out.println("Got in here! ! ! ");
View v = new View("/application");
//v.render(arg0, arg1);
//System.out.println("path " + v.getPath());
return v;
}
#POST
public void addCustomers(List<Customer> customers) {
customersDao.addCustomers(customers);
}
}
Directory Structure

First of all several notes for your code:
you don't need beans.xml file in the project because use don't use CDI annotations but only EJB3 annotations
#LocalBean annotation is not required, #Stateless is enough to define local bean, detailed explanation could be found in EJB 3.1 #LocalBean vs no annotation
definition of listener,servlet and servlet-mapping elements for resteasy in web.xml is not required, JBoss/RestEasy(JAX-RS implementation library) adds this definitions automatically for you. Empty web.xml with root web-app element is sufficient.
Now to your problem:
Attribute CustomerWS.customersDao is not injected by EJB container because CustomerWS is not deployed as EJB bean by container, but only as JAX-RS resource by RestEasy. It's known drawback of RestEasy 2.x used in JBoss EAP 6.x, that restfull resource could not become EJB bean out of the box: https://docs.jboss.org/resteasy/docs/2.3.6.Final/userguide/html/RESTEasy_EJB_Integration.html
All you need to do is define special context parameter in web.xml with comma separated jndi names of EJB beans which are also restfull resources managed by RestEasy. So in your case, you need to insert into web.xml following snippet:
<context-param>
<param-name>resteasy.jndi.resources</param-name>
<param-value>java:module/CustomerWS</param-value>
</context-param>
And that's all. Now CustomerWS class will be handled as EJB bean with working injections.

I see a few issues, some of them might be red herrings so I figure I'll list them all out.
Don't include all of this resteasy configuration in your web.xml. It's probably confusing the app server if nothing else. You should have a JAX-RS application that looks like this:
#ApplicationPath("/customers")
public class RestApplication extends Application {
// nothing needed ...
}
and that's all that's needed. Remove the resteasy listener and servlet from your config.
You're using a CDI 1.1 beans.xml. EAP 6.2 is CDI 1.0 compliant. Either make the file empty or use a CDI 1.0 tag in your file.
Do you in fact have two different CustomerWS classes? or was that a copy and paste issue?

Related

org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype

My on-going quest to migrate to Hibernate OGM 5.4 on JBoss WildFly 14.0.0.Final to use with MongoDB.
Had it working fine in WildFly 12 & 13 using earlier versions of OGM.
Using OGM 5.4, JPA 2.2, Hibernate ORM 5.3 & Hibernate Search 5.10
as per the: Compatibility matrix
My 'provision' in the Gradle Build is:
provision {
//Optional destination directory:
destinationDir = file("wildfly-custom")
configuration = file( 'wildfly-server-provisioning.xml' )
// Define variables which need replacing in the provisioning configuration!
variables['wildfly.version'] = '14.0.0.Final'
variables['hibernate-orm.version'] = '5.3.7.Final'
variables['hibernate-search.version'] = '5.10.4.Final'
variables['hibernate-ogm.version'] = '5.4.0.CR1'
}
which is used by:
<server-provisioning xmlns="urn:wildfly:server-provisioning:1.1" copy-module-artifacts="true">
<feature-packs>
<feature-pack
groupId="org.wildfly"
artifactId="wildfly-feature-pack"
version="${wildfly.version}"/>
<feature-pack
groupId="org.hibernate"
artifactId="hibernate-orm-jbossmodules"
version="${hibernate-orm.version}"/>
<feature-pack
groupId="org.hibernate"
artifactId="hibernate-search-jbossmodules-orm"
version="${hibernate-search.version}"/>
<feature-pack
groupId="org.hibernate.ogm"
artifactId="hibernate-ogm-featurepack-mongodb"
version="${hibernate-ogm.version}"/>
</feature-packs>
</server-provisioning>
The MongoDB persistence unit in my persistence.xml:
<persistence-unit name="nOTiFYwellMongoDBPersistenceUnit" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<properties>
<!-- <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2"/> -->
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.3"/>
<!-- <property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.8"/> -->
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.10.4.Final"/>
<!-- <property name="hibernate.transaction.jta.platform" value="JBossTS"/> -->
<!-- <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAS"/> -->
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform"/>
<property name="hibernate.ogm.datastore.provider" value="org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"/>
<property name="hibernate.ogm.datastore.grid_dialect" value="org.hibernate.ogm.datastore.mongodb.MongoDBDialect"/>
<property name="hibernate.ogm.datastore.database" value="notifyWellDB"/>
<property name="hibernate.ogm.mongodb.host" value="127.0.0.1"/>
</properties>
</persistence-unit>
I've copied the relevant modules from the generated WildFly 14.0.0.Final to my Home Brew installed one.
When I enable my deployed EAR I get:
21:52:42,808 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "NOTiFYwell.ear" (runtime-name: "NOTiFYwell.ear")
21:52:43,318 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0207: Starting subdeployment (runtime-name: "NOTiFYwellJAR.jar")
21:52:43,318 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "NOTiFYwellWAR.war")
21:52:44,373 INFO [org.jboss.as.jpa] (MSC service thread 1-5) WFLYJPA0002: Read persistence.xml for nOTiFYwellMySQLPersistenceUnit
21:52:44,373 INFO [org.jboss.as.jpa] (MSC service thread 1-5) WFLYJPA0002: Read persistence.xml for nOTiFYwellMongoDBPersistenceUnit
21:52:44,585 WARN [org.jboss.as.jsf] (MSC service thread 1-6) WFLYJSF0005: Unknown JSF version 'NONE'. Default version 'main' will be used instead.
21:52:44,841 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 20) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'NOTiFYwell.ear/NOTiFYwellJAR.jar#nOTiFYwellMongoDBPersistenceUnit'
21:52:44,861 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0003: Processing weld deployment NOTiFYwell.ear
21:52:44,911 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 20) MSC000001: Failed to start service jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#nOTiFYwellMongoDBPersistenceUnit".__FIRST_PHASE__: org.jboss.msc.service.StartException in service jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#nOTiFYwellMongoDBPersistenceUnit".__FIRST_PHASE__: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:128)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:104)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:650)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1.run(PhaseOnePersistenceUnitServiceImpl.java:137)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:465)
at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:40)
at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:224)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:455)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:199)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167)
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.<init>(TwoPhaseBootstrapImpl.java:39)
at org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.getBootstrap(HibernatePersistenceProviderAdaptor.java:199)
at org.wildfly.jpa.hibernateogm5.HibernateOGMPersistenceProviderAdaptor.getBootstrap(HibernateOGMPersistenceProviderAdaptor.java:87)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:254)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$900(PhaseOnePersistenceUnitServiceImpl.java:59)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:125)
... 9 more
Seen a few other questions with the same error, but none of the suggestions help.
Thanks.
I’m sorry but actually the hibernate-ogm-featurepack-* modules of Hibernate OGM 5.4.0.CR1 work only with WildFly 13.x. There is open issue for WildFly 14.x: https://hibernate.atlassian.net/browse/OGM-1523.
The workaround here is to install just the Hibernate OGM modules without overriding the Hibernate ORM and Hibernate Search modules. Since the versions already provided of Hibernate ORM and Hibernate Search by WildFly 14.0.x are fully compatible with Hibernate OGM 5.4.0.CR1 (or 5.4.0.Final by the way).
I hope that will help you.
Fabio

FacesContext not injectable in Wildfly 14 with JSF 2.3 (Mojarra, main module)

I have a bean:
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
...
#Named
#ViewScoped
public class SimpleBean implements Serializable
{
private static final long serialVersionUID = 1L;
#Inject
protected FacesContext facesContext;
...
}
According to
https://arjan-tijms.omnifaces.org/p/jsf-23.html#1316
this should work with 2.3 ...
When deploying to Wildfly 14, this results in:
13:02:33,516 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 72) HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
13:02:33,563 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 72) Envers integration enabled? : true
13:02:34,344 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool -- 72) HHH000397: Using ASTQueryTranslatorFactory
13:02:34,531 WARN [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
13:02:34,918 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."auth-portal.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."auth-portal.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1728)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject protected com.company.project.view.SimpleBean.facesContext
at com.company.project.view.SimpleBean.facesContext(SimpleBean.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:290)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:143)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:526)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:64)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:485)
13:02:34,918 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "auth-portal.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"auth-portal.war\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject protected com.company.project.view.SimpleBean.facesContext
at com.company.project.view.SimpleBean.facesContext(SimpleBean.java:0)
"}}
My faces-config.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
version="2.3">
...
QUESTION:
What's wrong here and how do you solve this?
BTW the answer here didn't solve it: How to inject FacesContext with JSF 2.3 and TomEE?
According to
https://github.com/javaserverfaces/mojarra#activating-cdi-in-jsf-23
this is the answer:
By default, JSF 2.3 will run in JSF 2.2 modus as to CDI support. Even
when you use a JSF 2.3 compatible faces-config.xml. In other words,
the new JSF 2.3 feature of injection and EL resolving of JSF artifacts
(spec issue 1316) won't work until you explicitly activate this.
In other words, #Inject FacesContext doesn't work by default. This
is necessary in order for JSF 2.3 to be fully backwards compatible.
There is currently only one way to activate CDI in JSF 2.3 and
herewith make JSF 2.3 to run in full JSF 2.3 modus. Put the
#FacesConfig annotation on an arbitrary CDI managed bean. For
example, a general startup/configuration bean.
#FacesConfig
#ApplicationScoped
public class YourApplicationConfig {
// ...
}
Full example:
import javax.enterprise.context.ApplicationScoped;
import javax.faces.annotation.FacesConfig;
#FacesConfig
#ApplicationScoped
public class Jsf23Activator {
// ...
}
You need the #ApplicationScoped annotation or it will not work. After that in my startup the console finally displays:
14:23:28,805 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 82) Initializing Mojarra 2.3.5.SP2 for context '/blah'
14:23:30,415 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 82) Monitoring file:/C:/dev/servers/wildfly-14.0.1.Final/standalone/deployments/blah.war/WEB-INF/faces-config.xml for modifications

Jersey 1.18.1 is unable to pick my restful service when deployed on Jboss 7.1.1 final

I have a very confusing problem with me. I have a eclipse Restful service project which is being built by gradle. I can successfully build and run my application in Tomcat 7.0.54, from within Eclipse and by deploying the war directly in /webapps folder of Tomcat.
But when I deploy my same war in Jboss 7.1.1 Final, it gives me below error.
10:43:45,390 WARN [org.jboss.jaxrs] (MSC service thread 1-7) JBAS011204: resteasy.scan found and ignored in web.xml. This is not necessary, as Resteasy will use the container integration in the JAX-RS 1.1 specification in section 2.3.2
10:43:45,390 WARN [org.jboss.jaxrs] (MSC service thread 1-7) JBAS011204: resteasy.scan.providers found and ignored in web.xml. This is not necessary, as Resteasy will use the container integration in the JAX-RS 1.1 specification in section 2.3.2
10:43:45,391 WARN [org.jboss.jaxrs] (MSC service thread 1-7) JBAS011204: resteasy.scan.resources found and ignored in web.xml. This is not necessary, as Resteasy will use the container integration in the JAX-RS 1.1 specification in section 2.3.2
10:43:46,128 INFO [com.sun.jersey.api.core.PackagesResourceConfig] (MSC service thread 1-2) Scanning for root resource and provider classes in the packages:
com.xxx.xxx.xxx.xxx.impl
org.codehaus.jackson.jaxrs
10:43:46,534 INFO [com.sun.jersey.server.impl.application.WebApplicationImpl] (MSC service thread 1-2) Initiating Jersey application, version 'Jersey: ${project.version} ${buildNumber}'
10:43:47,372 SEVERE [com.sun.jersey.server.impl.application.RootResourceUriRules] (MSC service thread 1-2) The ResourceConfig instance does not contain any root resource classes.
10:43:47,373 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/xxxxxx]] (MSC service thread 1-2) StandardWrapper.Throwable: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) [jersey-servlet-1.18.1.jar:1.18.1]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
10:43:47,388 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/taxation]] (MSC service thread 1-2) Servlet /xxxxxxx threw load() exception: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) [jersey-server-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) [jersey-servlet-1.18.1.jar:1.18.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) [jersey-servlet-1.18.1.jar:1.18.1]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
Moreover, when I unpack this war to a folder and deploy that folder inside Jboss, it works! It also works if I run my project in Jboss directly from Eclipse. However, if I export the project as a war (from eclipse) and deploy that war file into Jboss, it again gives me same problem.
When I drilled down into the the code of Jersey, I found that com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner is not able to pick my class files from the war.
Please help us resolve this issue.
I found the solution, and would like to post it so someone else could benefit. The problem was there in our build script. We were using different version of Jersey libraries. For some of the libraries, version 1.18.1 was being used, while for some other version 1.18 was being used.
Once the version for all the libraries was updated to 1.18.1, it worked perfectly.

Simple JSF with Managed Bean cannot be loaded by JBoss 7.1 (JBAS018210)

I am getting a strange error in my JBoss log when i try to do a very simple JSF app via Eclipse. So i created a simple scenario to ask, if i have missed something fundamental in my JSF example. Alternatively, i suspect there might be a mis-configuration or bug in my particular tooling or environment.
I have created a very simple JSF app. It's just one JSF html page (hello.jsp) which collects a name via a ManagedBean and transitions to a second JSF html page (ok.jsp). The bean has 1 getter, 1 setter, and 1 action method (addContact).
I am not using annotations, just a simple faces-config.xml file with one ManagedBean entry and one navigation rule. The bean is named "contact" and the class is "com.mbeans.ContactBean". I believe that the mapping is all correct.
I am using JBoss 7.1 via Eclipse Juno SR2. It's a JSF 2.0 app. I have loaded the latest JBoss Tools 4.0 for Juno.
The app only consists of the following files:
web.xml
faces-config.xml
ContactBean.java
hello.jsp
ok.jsp
The file contents are below. But I'll add some colour commentary on how they were created via Eclipse (which you might want to skim or ignore):
I go into Eclipse and create a new project. I select "Dynamic Web Project" with the following settings:
Target runtime = JBoss 7.1 Runtime
Configuration = Dynamic Configuration for JBoss 7.1 Runtime
Generate a web.xml = CHECKED
I right-click WebContent and create a new JSP file (Filename = hello.jsp). I use JSP Template = New JSF Page (html).
I add a few lines representing a simple form accessing a ManagedBean named "contact" so that hello.jsp looks like this:
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%# taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%# taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Add Contact</title>
</head>
<body>
<f:view>
<h2>Add Contact</h2>
<h:form>
Name:<br>
<h:inputText value="#{contact.name}" />
<h:commandButton value="Add Contact"
action="#{contact.addContact}" type="submit" />
</h:form>
</f:view>
</body>
</html>
Similarly, I add the following JSP file (ok.jsp):
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%# taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%# taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OK - Added New Contact</title>
</head>
<body>
<f:view>
<p>
The address for
<h:outputText value="#{contact.name}" />
was successfully added.
</p>
</f:view>
</body>
</html>
I right-click on the project (JSFTest) and add a class with the following settings:
Package = com.mbeans
Name = ContactBean
and I edit the class to appear like so:
package com.mbeans;
public class ContactBean {
public ContactBean() {super();}
String name;
public String getName() {return name;}
public void setName(String name) {this.name = name;}
public String addContact() {
System.out.println("Name: " + getName());
return "success";
}
}
Then I right-clicked the WEB-INF folder and selected New->Other->JBoss Tools Web->JSF->Faces Config with the following settings:
Folder:* = /JSFTest
Name:* = faces-config
Version: 2.0
Register in web.xml = CHECKED
In the new faces-config.xml that is created, I right-click Managed Beans->New->Managed Bean... and set the following:
Scope = application
Class:* = com.mbeans.ContactBean
Name:* = contactBean
Then I right-clicked Navigation Rules->New->Rule ... and left the dialog box blank and clicked Finish.
I right-clicked "[any]"->New->Case... and set the following:
From Outcome: = success
From Action: = #{contact.addContact}
ToView ID:* = /ok.jsp
this, finally, yields the following faces-config.xml file in the WEB-INF folder:
<?xml version="1.0"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<managed-bean>
<managed-bean-name>contact</managed-bean-name>
<managed-bean-class>com.mbeans.ContactBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-action>#{contact.addContact}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/ok.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Then I right-clicked the hello.jsp and selected Run As->Run On Server
I selected the JBoss 7.1 Runtime Server (it's the only one). The server starts successfully. (I know this JBoss server correctly runs other stuff outside of Eclipse.)
I get a 500 error and in particular, I see the following message in the log which I think is the root of the problem:
23:33:08,612 ERROR [org.jboss.web] (MSC service thread 1-3) JBAS018211: Could not load JSF managed bean class: com.mbeans.ContactBean
I think the NullPointerException may be caused by something else which I did wrong unrelated to that error message above. I am most concerned about the above error. But if anyone can point out my mistake which clears this NullPointerException, I would appreciate it so that I can eliminate it. Previously I got a different 500 error without the NPE but still had that JBAS018211 in the log. In other words, I think the NPE is annoying but irrelevant.
The full log is:
23:33:06,543 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
23:33:06,761 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
23:33:06,824 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
23:33:07,636 INFO [org.xnio] XNIO Version 3.0.3.GA
23:33:07,638 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
23:33:07,647 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
23:33:07,655 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
23:33:07,678 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
23:33:07,686 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
23:33:07,689 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
23:33:07,717 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
23:33:07,725 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
23:33:07,749 INFO [org.jboss.as.security] (MSC service thread 1-10) JBAS013100: Current PicketBox version=4.0.7.Final
23:33:07,749 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
23:33:07,752 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
23:33:07,789 INFO [org.jboss.as.connector] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
23:33:07,797 INFO [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
23:33:07,825 INFO [org.jboss.as.mail.extension] (MSC service thread 1-12) JBAS015400: Bound mail session [java:jboss/mail/Default]
23:33:07,844 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
23:33:07,971 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-7) JBoss Web Services - Stack CXF Server 4.0.2.GA
23:33:07,982 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-5) Starting Coyote HTTP/1.1 on http--127.0.0.1-7070
23:33:08,341 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
23:33:08,352 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /usr/local/jboss-as-7.1.1.Final/standalone/deployments
23:33:08,358 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found JSFTest.war in deployment directory. To trigger deployment create a file called JSFTest.war.dodeploy
23:33:08,360 INFO [org.jboss.as.remoting] (MSC service thread 1-10) JBAS017100: Listening on /127.0.0.1:9999
23:33:08,362 INFO [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /127.0.0.1:4447
23:33:08,475 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of "JSFTest.war"
23:33:08,612 ERROR [org.jboss.web] (MSC service thread 1-3) JBAS018211: Could not load JSF managed bean class: com.mbeans.ContactBean
23:33:08,792 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-10) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/JSFTest'
23:33:09,663 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-10) Hibernate Validator 4.2.0.Final
23:33:09,805 INFO [org.jboss.web] (MSC service thread 1-10) JBAS018210: Registering web context: /JSFTest
23:33:09,818 INFO [org.jboss.as] (MSC service thread 1-2) JBAS015951: Admin console listening on http://127.0.0.1:9990
23:33:09,819 INFO [org.jboss.as] (MSC service thread 1-2) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 3541ms - Started 172 of 249 services (76 services are passive or on-demand)
23:33:09,873 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "JSFTest.war"
23:33:29,683 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/JSFTest].[jsp]] (http--127.0.0.1-7070-1) Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException
at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1858) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at org.apache.jsp.hello_jsp._jspx_meth_f_005fview_005f0(hello_jsp.java:103)
at org.apache.jsp.hello_jsp._jspService(hello_jsp.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]
That's it. That's the problem.
(as an aside, Eclipse also does not display the hover-over tag descriptions for JSF. HTML tags are OK. This makes me wonder if there's some deeper JBoss Tools misconfiguration.)
Thank you for any time spent reviewing my problem.
Try to do the following in addition to what you did:
Right click the project → Properties → Project Facets
Add the Java Server Faces facet with the correct version (yours was 2.0)
Click the additional configuration link at the bottom, select "Library provided by server runtime" (the default) and check the option to configure web.xml. Map the Faces Servlet at /faces/* (for the sake of this answer; you can change it later but remember to change the URLs accordingly)
(may be optional, but try it this way first) I prefer to deploy my applications by openning the server tab, right clicking on the server → Add/Remove... → select your application and deploy
After the app is successfully deployed (check the console) get the URL: http://localhost:8080/JSFTest/faces/hello.jsp
Remember the Faces Servlet mapping - /faces/*? You have to include it in the URL.
This works for me.
By the way, prefer Facelets (the XHTML option) over JSP.

JBoss AS 7 simple hello world application

I am trying to get a simple JMS "Hello world" application to run. I would like to try it out on JBoss Application Server 7 but i am not able to run it. Jboss as HornetQ embedden in it and i started it using the following command:
standalone.bat --server-config=standalone-preview.xml
I think the problem is most likely to the way i have configured the queue within JBoss. Here are the steps i did.
Configure queue
Quene name: testQueue
JNDI name: queue/test
The queue configuration has an option for "Selector". Can this be left blank and if not, what goes in this field?
Code
Here is the code i am using as the Sender. I am not worried of the receiver for now as i just want to start sending a message first.
package jms.ex3;
import javax.naming.InitialContext;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.QueueSender;
import javax.jms.DeliveryMode;
import javax.jms.QueueSession;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
public class Sender
{
public static void main(String[] args) throws Exception
{
// get the initial context
InitialContext ctx = new InitialContext();
// lookup the queue object
Queue queue = (Queue) ctx.lookup("queue/test");
// lookup the queue connection factory
QueueConnectionFactory connFactory = (QueueConnectionFactory) ctx.
lookup("queue/connectionFactory");
// create a queue connection
QueueConnection queueConn = connFactory.createQueueConnection();
// create a queue session
QueueSession queueSession = queueConn.createQueueSession(false,
Session.DUPS_OK_ACKNOWLEDGE);
// create a queue sender
QueueSender queueSender = queueSession.createSender(queue);
queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// create a simple message to say "Hello"
TextMessage message = queueSession.createTextMessage("Hello");
// send the message
queueSender.send(message);
// print what we did
System.out.println("sent: " + message.getText());
// close the queue connection
queueConn.close();
}
}
When i run the above class i get the following error:
java -classpath C:\Users\702723344\Downloads\glassfish-3.1.1\glassfish3\glassfish\lib\javaee.jar;. jms.ex3.Sender
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at jms.ex3.Sender.main(Sender.java:22)
How exactly does the above class know that the Provider(JBoss) is running on the localhost machine? Dont i need to specify an IP address somewhere? Any ideas?
Edit
Most of the documentation seem to refer to JBoss AS 6. I have updated the code snippet to include the following:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.PROVIDER_URL, "jnp://localhost:1199");
ctx = new InitialContext(env);
I am now getting classNotFound exception. I think it needs an additional jar file to be added to the classpath but which one???
java -classpath C:\Users\702723344\Downloads\glassfish-3.1.1\glassfish3\glassfish\lib\javaee.jar;. jms.ex3.Sender
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at jms.ex3.Sender.main(Sender.java:27)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
... 5 more
Answering on ClassNotFoundException.
org.jnp.interfaces.NamingContextFactory can be located in jboss-as-7.0.0.Final\modules\org\jboss\as\naming\main\jboss-as-naming-7.0.0.Final.jar.
Also noticed glassfish\lib\javaee.jar in your classpath and wanted to give an advice on how to easily include in classpath multiple jars from jboss/client folder.
But oups - there's no such folder in JBoss AS 7.0.
It appears that JBoss AS 7.0 doesn't support remote clients at all (at least for EJB).
Take a look at this thread: http://community.jboss.org/message/613171. It's very interesting.
There is a chance you'll further get some ClassCastExceptions with using glassfish\lib\javaee.jar.
I do not agree with the last answer from Vadzim
I know I am answering a very old question but this info miss-led me for a day, It was the first time I was trying to setup JMS remote queue on JBOSS 7 , hence had to answer, which got me working.
It appears that JBoss AS 7.0 doesn't support remote clients at all (at least for EJB)...??
It is possible to call remote queue. below are the following steps ..
Make sure to add the queues in standalone.xml or (full.xml) , in below I have got myRemoteStatusQueue set up , if you observe, exported option is must, so that the jboss knows it will consumed by the external jms client
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
<jms-queue name="ddsStatusQueue">
<entry name="java:jboss/exported/jms/queue/myRemoteStatusQueue"/><!--Exported key necessary -->
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
<entry name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
Make sure to add a role to an application user : such as remote-role , after adding the role make sure to include them in the Jboss's standalone.xml.
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
<jms-queue name="ddsStatusQueue">
<entry name="java:jboss/exported/jms/queue/myRemoteStatusQueue"/> <!--Exported key necessary -->
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
<entry name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
<security-settings>
<security-setting match="#">
<permission type="send" roles="remote-role guest"/>
<permission type="consume" roles="remote-role guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
Make sure to use below code ,you can see I have used remote:/ as part of URL for remoting
private static final String DEFAULT_MESSAGE = " Dummy message local Client Message At"+new Date();
private static final String DEFAULT_CONNECTION_FACTORY = "/jms/ConnectionFactory";
private static final String DEFAULT_DESTINATION = "jms/queue/myRemoteStatusQueue";
private static final String DEFAULT_MESSAGE_COUNT = "1";
private static final String DEFAULT_USERNAME = "abhijith";
private static final String DEFAULT_PASSWORD = "password";
private static final String INITIAL_CONTEXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";
private static final String PROVIDER_URL = "remote://localhost:4447";
Make sure to use the right jars, for the Above example , I used hornetq-core-2.2.14.Final.jar and the usage of correct JBOSS client jar , go to the client folder of the bin directory of JBOSS, you will have readme.txt, there you will have reference for Maven version to use, if you are using as a standalone application then you can reference the given jar in the directory.
Deploy your app on JBOSS , During the start up you should see the configured Queue without any error. You can see for example in my server startup log, java:jboss/exported/jms/queue/myRemoteStatusQueue. If the above entry has come up with out error, now you are good to go ...
16:24:46,527 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/queue/test
16:24:46,533 INFO [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test
16:24:46,545 INFO [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
16:24:46,548 INFO [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory
16:24:46,551 INFO [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
16:24:46,552 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-4) trying to deploy queue jms.topic.testTopic
16:24:46,569 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-6) JBAS010406: Registered connection factory java:/JmsXA
16:24:46,607 INFO [org.hornetq.ra.HornetQResourceAdapter] (MSC service thread 1-6) HornetQ resource adaptor started
16:24:46,609 INFO [org.jboss.as.connector.services.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-6) IJ020002: Deployed: file://RaActivatorhornetq-ra
16:24:46,612 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-6) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
16:24:46,638 INFO [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:/topic/test
16:24:46,641 INFO [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/test
16:24:46,642 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-7) trying to deploy queue jms.queue.myRemoteStatusQueue
16:24:46,645 INFO [org.jboss.as.messaging] (MSC service thread 1-7) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/myRemoteStatusQueue
16:24:47,211 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-1) JBoss Web Services - Stack CXF Server 4.0.2.GA
(-1 / -1) (org/jboss/as/network/ManagedBinding$Factory/org/jboss/as/network/ManagedBinding$Factory)
Happy coding,
Regards,
Abhijith