java code
public static synchronized void init(String log4jXMLPath) //throws ServletException
{
try
{
if (!initialized) // set the global RepositorySelector
{
defaultRepository = LogManager.getLoggerRepository();
RepositorySelector theSelector = new AppRepositorySelector();
**LogManager.setRepositorySelector(theSelector, guard);**
initialized = true;
}
Hierarchy hierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
//loadLog4JConfig(servletContext, hierarchy);
loadLog4JConfig(hierarchy, log4jXMLPath);
ClassLoader loader = Thread.currentThread().getContextClassLoader();
repositories.put(loader, hierarchy);
}
catch (Exception e)
{
e.printStackTrace();
}
}
LogManager.setRepositorySelector(theSelector, guard); this line in java code throwing an error
stacktrace
18:17:11,189 ERROR [stderr] (MSC service thread 1-2) java.lang.IllegalArgumentException: Attempted to reset the LoggerFactory without possessing the guard.
18:17:11,190 ERROR [stderr] (MSC service thread 1-2) at org.apache.log4j.LogManager.setRepositorySelector(LogManager.java:164)
18:17:11,191 ERROR [stderr] (MSC service thread 1-2) at com.mportal.logger.api.AppRepositorySelector.init(AppRepositorySelector.java:73)
18:17:11,192 ERROR [stderr] (MSC service thread 1-2) at com.mportal.logger.api.MPLoggerImpl.loadLogInstance(MPLoggerImpl.java:64)
18:17:11,192 ERROR [stderr] (MSC service thread 1-2) at com.mportal.logger.api.MPLoggerImpl.<init>(MPLoggerImpl.java:38)
18:17:11,192 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
18:17:11,193 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
18:17:11,194 ERROR [stderr] (MSC service thread 1-2) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
18:17:11,194 ERROR [stderr] (MSC service thread 1-2) at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
How to solve this one? Please give solutions.
LogManager.setRepositorySelector(theSelector, guard);
You can only use one guard, using different guard objects will result in the observerd error:
java.lang.IllegalArgumentException: Attempted to reset the LoggerFactory without possessing the guard.
It should be possible to pass null as a parameter to the function. Or simply hold a reference to the initial set guard.
The documentation states:
Initally the guard is null. If the guard is null, then invoking this method sets the logger factory and the guard. Following invocations will throw a IllegalArgumentException, unless the previously set guard is passed as the second parameter.
Related
The error on the title is because of no serialization, I know it because I had that error before and solved it thanks to this source: https://developer.jboss.org/thread/279558
But now I have a bigger issue with it, while debugging I found out I had a class called "MessageProvider" that wasn't implementing Serializable so I made it implement it but then the error persisted, checking more carefully I found out that this class has attributes that are of type ResourceBundle and guess what ResourceBundle doesn't implement Serializable so im stuck there because I can't edit it since it is from java "root" package.
This is some code of the class MessageProvider:
#Dependent
public class MessageProvider implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/** The message provider. */
public static MessageProvider messageProvider = new MessageProvider();
/** The etiquetas msg. */
private ResourceBundle etiquetasMsg;
/** The sistema msg. */
private ResourceBundle sistemaMsg;
This is the error I get when debugging:
Caused by: java.io.NotSerializableException: java.util.PropertyResourceBundle
09:51:12,621 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:256)
09:51:12,622 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:130)
09:51:12,622 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:391)
09:51:12,622 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:311)
09:51:12,622 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)
09:51:12,622 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:130)
09:51:12,623 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:391)
09:51:12,623 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:311)
09:51:12,623 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)
09:51:12,623 ERROR [stderr] (default task-1) at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:130)
09:51:12,623 ERROR [stderr] (default task-1) at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:378)
09:51:12,624 ERROR [stderr] (default task-1) ... 101 more
What I have tried with no success:
How to inject a non-serializable class (like java.util.ResourceBundle) with Weld
I tried using the "transient" on the attributes like so:
private transient ResourceBundle etiquetasMsg but it didn't work and after that tried
#PostConstruct
#PostActivate
public void getResourceBundle() {
bundle = ResourceBundle.getBundle("/messages", locale );
}
But it didn't work also :/, not sure where to look at, if you guys need more details to be able to help me just tell me.
Context:
Im doing all this for a REST service, testing it with POSTMAN, when a validation doesn't work I throw an exception that is from a class defined here in the company, lets call it CompanyExceptions, this class Extends from Exception, so this class CompanyExceptions uses MessageProvider class that is the one using ResourceBundle.
If I replace CompanyExceptions for just Exception I don't get the error from the title.
So for example if I throw an exception like this "throw new CompanyException("Failed to validate user password");" it gives me the error, but if I use throw new Exception("Failed to validate user password"); it works.
I am developing an application that reads messages from a Kafka queue, and processes them creating an e-mail and sending it.
I was able to get a simple camel route working in a standalone java application, however when I package it up using CDI and Wildfly 8.2 it fails to deploy.
I am following the directions from here:
camel CDI Properties example
I used the example as a template for my application.
I am using Wildfly 8.2.0, Camel 2.18.1, Kafka 0.10.1.1
What am I doing wrong? I don't understand the error "org.apache.camel.FailedToCreateRouteException: Failed to create route Deep-email-notify-route: Route(Deep-email-notify-route)[[From[no uri or ref supplied!... because of Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext#55edcc54"
This is most of my code:
#ApplicationScoped
public class OrderEmailApplication {
/** The logger. */
private static Logger logger =LogManager.getLogger(OrderEmailRoute.class);
public OrderEmailApplication() {}
#ContextName("OrderNotifications")
static class OrderEmailRoute extends RouteBuilder {
#Uri("kafka://{{deep.notify.kafka.server}}?topic={{deep.notify.order.topics}}&groupId={{deep.notify.order.groupId}}&"+
"keyDeserializer=org.apache.kafka.common.serialization.StringDeserializer&" +
"valueDeserializer=org.apache.kafka.common.serialization.StringDeserializer")
Endpoint kafkaEndpoint;
#Uri("file:///home/whomer/tmp/Notify/deadMessages")
private Endpoint deadLetter;
#BeanInject
BulkEmailProcessor bulkEmailProcessor;
#BeanInject
FailedMessageEnrichmentProcessor failedEmailEnrichement;
#Override
public void configure() throws Exception {
errorHandler(defaultErrorHandler().maximumRedeliveries(0));
from(kafkaEndpoint).routeId("Deep-email-notify-route")
.unmarshal().json(JsonLibrary.Jackson, LinkedHashMap.class)
.bean("velocityBean")
.process(bulkEmailProcessor)
.marshal().json(JsonLibrary.Jackson, Map.class)
.to("Log:?level=DEBUG");
from("direct:getTemplate").to("velocity://dummy");
}
}
#Named("velocityBean")
static class VelocityBean {
#Uri("direct:getTemplate")
private ProducerTemplate template;
public void process(Exchange exchange) {
// removed for brevity
}
}
#Produces
#Named("properties")
// "properties" component bean that Camel uses to lookup properties
PropertiesComponent properties(PropertiesParser parser) {
PropertiesComponent component = new PropertiesComponent();
// Use DeltaSpike as configuration source for Camel CDI
component.setPropertiesParser(parser);
return component;
}
// PropertiesParser bean that uses DeltaSpike to resolve properties
static class DeltaSpikeParser extends DefaultPropertiesParser {
#Override
public String parseProperty(String key, String value, Properties properties) {
return ConfigResolver.getPropertyValue(key);
}
}
}
This is the stack trace:
14:51:37,674 INFO [org.apache.camel.cdi.CdiCamelExtension] (MSC service thread 1-4) Camel CDI is starting Camel context [OrderNotifications]
14:51:37,680 INFO [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) is starting
14:51:37,682 INFO [org.apache.camel.management.ManagedManagementStrategy] (MSC service thread 1-4) JMX is enabled
14:51:37,821 INFO [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service thread 1-4) Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000)
14:51:37,827 INFO [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) is shutting down
14:51:37,849 INFO [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) uptime 0.169 seconds
14:51:37,849 INFO [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-4) Apache Camel 2.18.1 (CamelContext: OrderNotifications) is shutdown in 0.022 seconds
14:51:37,859 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."NotificationService.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."NotificationService.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_51]
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions:
Exception 0 :
org.apache.camel.FailedToCreateRouteException: Failed to create route Deep-email-notify-route: Route(Deep-email-notify-route)[[From[no uri or ref supplied!... because of Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext#55edcc54
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1008)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3397)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3128)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:182)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2957)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2953)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2976)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2953)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2920)
at org.apache.camel.impl.DefaultCamelContext$Proxy$_$$_WeldClientProxy.start(Unknown Source)
at org.apache.camel.cdi.CdiCamelExtension.afterDeploymentValidation(CdiCamelExtension.java:422)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:90)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:271)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:121)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:258)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:237)
at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:174)
at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:133)
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:107)
at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:54)
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:439)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:93)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Either 'uri' or 'ref' must be specified on: org.apache.camel.impl.DefaultRouteContext#55edcc54
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:136)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:69)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:90)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1051)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
... 35 more
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:37)
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:439)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:93)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
OOPS. Programmer error!
The main issue turned out to be the Endpoint injections.
Instead of
#Uri("kafka:...")
Endpoint fubar;
the injection should have been:
#EndpointInjection(uri = "kafka:...")
Endpoint fubar;
I use eclipse Neon.
I created simple EJB project with follow code:
package com.clientManager;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
/**
* Session Bean implementation class ClientManager
*/
#Stateless
#LocalBean
public class ClientManager {
/**
* Default constructor.
*/
public ClientManager() {
// TODO Auto-generated constructor stub
}
public String test() {
return "test";
}
}
It created automatically and reside in ejbModule folder.
It uses EJB 3.2 and successfully deploying on WildFly server:
11:25:50,360 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0028: Stopped deployment Neoflex.jar (runtime-name: Neoflex.jar) in 9ms
11:25:50,370 WARN [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0357: Notification of type deployment-undeployed is not described for the resource at the address []
11:25:50,370 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0009: Undeployed "Neoflex.jar" (runtime-name: "Neoflex.jar")
11:25:55,380 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found Neoflex.jar in deployment directory. To trigger deployment create a file called Neoflex.jar.dodeploy
11:25:55,380 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "Neoflex.jar" (runtime-name: "Neoflex.jar")
11:25:55,400 INFO [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0003: Processing weld deployment Neoflex.jar
11:25:55,400 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-6) WFLYEJB0473: JNDI bindings for session bean named 'ClientManager' in deployment unit 'deployment "Neoflex.jar"' are as follows:
java:global/Neoflex/ClientManager!com.clientManager.ClientManager
java:app/Neoflex/ClientManager!com.clientManager.ClientManager
java:module/ClientManager!com.clientManager.ClientManager
java:global/Neoflex/ClientManager
java:app/Neoflex/ClientManager
java:module/ClientManager
11:25:55,523 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "Neoflex.jar" (runtime-name : "Neoflex.jar")
Now I created DynamicWebProject for JSP page which will use the EJB:
<%#page import="com.clientManager.*"%>
<%
ClientManager c = new ClientManager();
%>
<%= c.test() %>
I configured in Build Path of JSP project the EJB project (!)
Please see screenshot.
When I publish JSP and access to the page (main.jsp), I have:
JBWEB004060: An error occurred at line: 3 in the jsp file: /main.jsp
ClientManager cannot be resolved to a type
1: <%#page import="com.clientManager.*"%>
2: <%
3: ClientManager c = new ClientManager();
4: %>
5: <%= c.test() %>
What is wrong?
You shouldn’t directly instantiate the EJB bean rather it lifecycle in managed by the EJB container, the right way of getting the EJB bean handle is via it's look up method.
Make sure you choose the correct look up name, I am using randomly the one from your post
Try changing to something like below.
<%
ClientManager cm;
cm = (ClientManager) ctx.lookup("java:module/ClientManager");
%>
I posted this a while ago in the hibernate search forum and got no response, so trying again in stackoverflow...
Since migrating from HS 4.5.1 to HS 5.5.1 we have problems with sorting and faceting.
All our indexing is done using a class bridge which calls a CDI-Bean to do the actual indexing. In our system the configuration which fields are indexed is dynamic and can change at runtime, so we cannot use HS-annotations.
Sorting: we would like to take advantage of lucene's new sorting features using docvalues. We tried to add interface MetadataProvidingFieldBridge to the class bridge to provide the information which fields are sort fields, but at the time when the class bridge is initalized (when jboss is booting) the CDI-bean is not yet available.
Question 1: Is there a way to re-initialize the HS-SearchIntegrator at a later time, when the CDI-bean is available or when our index configuration has changed?
For the time being HS falls back to using the UninvertingReader for dealing with the sort fields without docvalues.
Question 2: Is this going to be supported in the future? How "bad" is it performancewise to use UninvertingReader?
With faceting we face a similar problem, we cannot use #Facet-annotation because the configuration is dynamic. For the time being we use lucene's faceting API directly.
Question 3: Is there a plan in HS to add faceting-information via a class bridge in the near future, similar to MetadataProvidingFieldBridge? Is the class bridge going to be supported by Hibernate Search in the future?
Code of the ClassBridge:
public class FtiClassBridgeCE implements FieldBridge, MetadataProvidingFieldBridge
{
#Override
public void set(String fieldName, Object value, Document document, LuceneOptions options)
{
if( !(value instanceof ComplexEntity))
return; // ignore
ComplexEntity object = (ComplexEntity)value;
// FtiService does the actual indexing by adding fields to given document
Configuration.service( FtiService.class).setIndexData( object, new FtiDocumentHS( document, options));
}
/*
* This method is called in startup process of JBoss (Wildfly10) when initializing the persistence context. At that
* time the CDI-Beans are not yet available resulting in a NullPointerException.
*
* #see org.hibernate.search.bridge.MetadataProvidingFieldBridge#configureFieldMetadata(java.lang.String,
* org.hibernate.search.bridge.spi.FieldMetadataBuilder)
*/
public void configureFieldMetadata(String name, FieldMetadataBuilder builder)
{
try
{
// FtiService is a CDI bean which is obtained from BeanManager via our Configuration-class
// FtiSearchConfig stores information which fields should be added to lucene index and how they map to
// ComplexEntity's data
for( FtiSearchConfig config : Configuration.service( FtiService.class).getAllConfigurations())
{
for( FtiSearchField ftiSearchField : config.getSortFields())
{
builder.field( ftiSearchField.getNameForSort( null), hsSortType( ftiSearchField.getFieldDataType())).sortable( true);
}
}
}
catch( Exception ex)
{
ex.printStackTrace();
// catch the NPE thrown at JBoss boot time
}
}
private FieldType hsSortType(FtiFieldDataType fieldDataType)
{
switch( fieldDataType)
{
case DATE:
return FieldType.LONG;
case NUMERIC:
return FieldType.INTEGER;
case PRICE:
return FieldType.DOUBLE;
default:
return FieldType.STRING;
}
}
In the #PostConstruct-Method of the CDI-Bean I tried to reinitialized the HS SearchIntegrator like this but it did not call again the method FtiClassBridgeCE.configureFieldMetadata(String name, FieldMetadataBuilder builder).
#PostConstruct
protected void initialize() throws ConfigurationException
{
initSearchConfig();
initializeHSSearch();
}
private void initializeHSSearch()
{
FullTextEntityManager ftEM = ftidx().getFullTextEM();
SearchIntegrator si = ftEM.getSearchFactory().unwrap( SearchIntegrator.class);
SearchIntegratorBuilder sb = new SearchIntegratorBuilder().currentSearchIntegrator( si);
sb.buildSearchIntegrator();
}
Which is the right way to do this or is there no way to reinitialize the SearchIntegrator?
Stacktrace of the Exception that is thrown at JBoss boot time when initializing HS SearchIntegrator:
13:33:12,656 INFO [jpa] (ServerService Thread) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'mc.ear/web.war#mc'
13:33:16,219 INFO [Dialect] (ServerService Thread) HHH000400: Using dialect: mc.core.system.util.db.SQLServerDialect
13:33:16,996 INFO [EnversServiceImpl] (ServerService Thread) Envers integration enabled? : true
13:33:23,864 INFO [UpdateTimestampsCache] (ServerService Thread) HHH000250: Starting update timestamps cache at region: mc.ear/web.war#mc.org.hibernate.cache.spi.UpdateTimestampsCache
13:33:25,675 INFO [StandardQueryCache] (ServerService Thread) HHH000248: Starting query cache at region: mc.ear/web.war#mc.org.hibernate.cache.internal.StandardQueryCache
13:33:27,529 INFO [Version] (ServerService Thread) HSEARCH000034: Hibernate Search 5.5.1.Final
babysitten13:34:45,462 ERROR [stderr] (ServerService Thread) java.lang.NullPointerException
13:34:45,463 ERROR [stderr] (ServerService Thread) at org.jboss.weld.bean.builtin.BeanManagerProxy.<init>(BeanManagerProxy.java:74)
13:34:45,463 ERROR [stderr] (ServerService Thread) at org.jboss.as.weld.WeldProvider$CdiImpl.getBeanManager(WeldProvider.java:95)
13:34:45,463 ERROR [stderr] (ServerService Thread) at org.jboss.as.weld.WeldProvider$CdiImpl.getBeanManager(WeldProvider.java:73)
13:34:45,463 ERROR [stderr] (ServerService Thread) at mc.core.service.configuration.WorkerFactory.lookupBM(WorkerFactory.java:42)
13:34:45,464 ERROR [stderr] (ServerService Thread) at mc.core.service.configuration.WorkerFactory.createService(WorkerFactory.java:28)
13:34:45,464 ERROR [stderr] (ServerService Thread) at mc.core.service.configuration.Configuration.service(Configuration.java:27)
13:34:45,464 ERROR [stderr] (ServerService Thread) at mc.core.service.ftindex.hs.FtiClassBridgeCE.configureFieldMetadata(FtiClassBridgeCE.java:63)
13:34:45,464 ERROR [stderr] (ServerService Thread) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getSortableFieldNames(AnnotationMetadataProvider.java:1751)
13:34:45,464 ERROR [stderr] (ServerService Thread) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.bindClassBridgeAnnotation(AnnotationMetadataProvider.java:621)
13:34:45,464 ERROR [stderr] (ServerService Thread) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.bindClassBridgeAnnotation(AnnotationMetadataProvider.java:593)
13:34:45,465 ERROR [stderr] (ServerService Thread) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClassLevelAnnotations(AnnotationMetadataProvider.java:546)
13:34:45,465 ERROR [stderr] (ServerService Thread) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:430)
13:34:45,465 ERROR [stderr] (ServerService Thread) at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getTypeMetadataFor(AnnotationMetadataProvider.java:130)
13:34:45,465 ERROR [stderr] (ServerService Thread) at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:373)
13:34:45,466 ERROR [stderr] (ServerService Thread) at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199)
13:34:45,466 ERROR [stderr] (ServerService Thread) at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117)
13:34:45,467 ERROR [stderr] (ServerService Thread) at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75)
13:34:45,473 ERROR [stderr] (ServerService Thread) at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
13:34:45,473 ERROR [stderr] (ServerService Thread) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:530)
13:34:45,473 ERROR [stderr] (ServerService Thread) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.__build(SessionFactoryBuilderImpl.java:444)
13:34:45,474 ERROR [stderr] (ServerService Thread) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java)
13:34:45,474 ERROR [stderr] (ServerService Thread) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879)
13:34:45,474 ERROR [stderr] (ServerService Thread) at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.__build(TwoPhaseBootstrapImpl.java:44)
13:34:45,474 ERROR [stderr] (ServerService Thread) at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java)
13:34:45,474 ERROR [stderr] (ServerService Thread) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
Using Jboss AS 7.1.1 Final, I'm trying to invoke a Local EJB(3.1) through JNDI.
My Local EJB is:
#Stateless(mappedName = "Services")
#LocalBean
public class Services implements ServicesLocal {
.....// scary stuffs here
}
My Interface Services is:
#Local
public interface ServicesLocal {
.... // Some powerfull stuffs here
}
I'm trying to invoke this EJB above like this:
private ServicesLocal getLocalEJB() throws NamingException {
log.info("\n\n\n\n\n\n\n\n ################## Getting the ServicesLocal");
InitialContext context = new InitialContext();
return (ServicesLocal) context.lookup("ejb:/global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal");
}
This is the error I'm getting when invoking this code above:
############ Getting the ServicesLocal
15:36:10,437 INFO [org.jboss.ejb.client] (http-localhost-127.0.0.1-8080-1) JBoss EJB Client version 1.0.5.Final
15:36:10,456
ERROR [stderr] (http-localhost-127.0.0.1-8080-1) java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:global,distinctname:docs] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext#396f6a24
15:36:10,457
ERROR [stderr] (http-localhost-127.0.0.1-8080-1) ^Iat org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
And this is the JNDI log when the Jboss 7.1.1 Final boot. Having the EJB that I want to invoke:
15:07:07,975 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named Services in deployment unit subdeployment "docs-ejb-0.1.jar" of deployment "docs.ear" are as follows:
java:global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal
java:app/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal
java:module/Services!com.mycompany.docs.local.ServicesLocal
java:global/docs/docs-ejb-0.1/Services!com.mycompany.docs.services.Services
java:app/docs-ejb-0.1/Services!com.mycompany.docs.services.Services
java:module/Services!com.mycompany.docs.services.Services
I think my context.lookup("ejb:/global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal") is wrong. What I can do to fix that and invoke my Local EJB with JNDI?
Have you tried to use what JBoss tells you?
context.lookup("java:global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal")
Your EJB is stored in java namespace, not in ejb one.