weblogic.application.ClassLoaderNotFoundException while calling Ejb in weblogic application - ejb

Getting below exception on calling EJB but ear component has started well.
weblogic.application.ClassLoaderNotFoundException,Ejb is not found due to missing GenericClassLoader.annotation -- how can this be fixed .its for weblogic server .Application starts up properly.But throws this error when ejb is invoked.

Related

Grails 3.3.10: running integration tests Error creating bean with name 'com.cabolabs.security.UserController'

I'm trying to create an integration test for a service and keep receiving a controller, that is totally disconnected from the service test, can't be created. Spending a day or so on everything that might cause the issue, and failing miserably, decided to create a project from scratch and start adding line by line.
So I did:
grails create-app test
grails create-domain-class com.cabolabs.security.User
added username and password String fields
grails generate-app com.cabolabs.security.User
grails create-service com.cabolabs.cloud.BalanceUpdate
grails create-integration-test com.cabolabs.cloud.BalanceUpdate
grails test-app com.cabolabs.cloud.BalanceUpdate -integration
That runs OK, the test fails because of the default code, that is not important.
Then I started to add references to services in the UserController, and the BalanceUpdateService, like mailService from the mail plugin.
The test worked as before.
Then I added this line, which I have extensively used in many controllers of my original project:
def config = grailsApplication.config
With that line, the whole thing felt apart and got the error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cabolabs.security.UserController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cabolabs.security.UserController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)
at org.spockframework.spring.SpringMockTestExecutionListener.beforeTestMethod(SpringMockTestExecutionListener.java:54)
at org.spockframework.spring.AbstractSpringTestExecutionListener.beforeTestMethod(AbstractSpringTestExecutionListener.java:23)
at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:269)
at org.spockframework.spring.SpringTestContextManager.beforeTestMethod(SpringTestContextManager.java:54)
at org.spockframework.spring.SpringInterceptor.interceptSetupMethod(SpringInterceptor.java:45)
at org.spockframework.runtime.extension.AbstractMethodInterceptor.intercept(AbstractMethodInterceptor.java:28)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:87)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:147)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:129)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
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)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.cabolabs.security.UserController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1152)
... 34 more
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
at grails.web.api.WebAttributes$Trait$Helper.currentRequestAttributes(WebAttributes.groovy:45)
at grails.web.api.WebAttributes$Trait$Helper.getGrailsAttributes(WebAttributes.groovy:54)
at grails.web.api.WebAttributes$Trait$Helper.getGrailsApplication(WebAttributes.groovy:134)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
... 36 more
My question is, how can I have the config injected to my controllers and make the integration tests work? Thanks.
I just created a project from scratch and added line by line, it seems adding this to the controller, makes the test for the service fail (which are not connected in any way): def config = grailsApplication.config
Since I used that in many controllers, I tested changing it to Holders.config and that actually worked. I'll report this as a bug to Grails Core.

Remote EJB invocation from Quartz Job on WildFly fails after module restart

I have a simple application with a Quartz scheduler started from a servlet listener. The code is available at https://github.com/ike3/quartz-and-ejb
The only interesting part is that the job calls a remote EJB:
InitialContext initialContext = new InitialContext();
PpaJobRemote remote = (PpaJobRemote) initialContext.lookup(beanName);
remote.process();
The code is packaged as EAR containing EJB-JAR and WAR and then deployed on the WildFly 18 application server. To be sure: there are no duplicated interfaces in EAR/lib and WEB-INF/lib.
Everything works fine until the module is restarted. Then suddenly the lookup fails with an exception:
Caused by: javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination
for request for EJB StatelessEJBLocator for "fz44-test-jobs-ear/fz44-test-jobs-ejb/SendMailMessageJob",
view is interface ru.lanit.fz44.ejb.job.PpaJobRemote, affinity is None
The problem occurs only from a Quartz Job. I have servlet calling the same job in the same WAR - it works fine after such restart. So I think there is some weird bug between Quartz thread pool and Widlfly classloaders.
If I restart the whole server (not the single module) the error is gone. The problem is worse that deploy scripts in the CI server use jboss CLI effectively restarting the module now and then.
Can anyone suggest any workarounds of this issue?
Seems I figured it out. The problem is that I didn't shutdown the scheduler. Aparently Quartz reuses the same scheduler even after the app is restarted.
Adding this to the servlet listener fixed the issue.
public void contextDestroyed(ServletContextEvent event) {
try {
if (sched.isStarted()) {
sched.shutdown();
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
One more example that all the resources must be closed after use and forgetting to do so can lead to strange issues.

BizTalk Server Migration to 2016

Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'CSC.Integration.Orchestrations.LegacyBizTalkProcess(71c7729e-22ac-be38-00c0-0b11beaba439)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 296a4475-58f6-4fa4-8b90-65fe752e9872
Shape name: e_Logging
ShapeId: 919d78da-57e8-4ae1-bd2f-39859310c6de
Exception thrown from: segment 1, progress 20
Inner exception: The type initializer for 'CSC.AppBlocks.Logging.Logger' threw an exception.
Exception type: TypeInitializationException
Source: CSC.AppBlocks.Logging
Target Site: Void Write(CSC.AppBlocks.Logging.Category, System.String, System.String)
The following is a stack trace that identifies the location where the exception occured
at CSC.AppBlocks.Logging.Logger.Write(Category category, String message, String title)
at CSC
We are working on BizTalk migration to 2016 and in testing the application we are getting above error and we updated all Gacs and for this receive location we are using MSMQ adapter. But it is working in BizTalk server 2010.
Are you sure the DLL that contains the namespace CSC.AppBlocks.Logging is GAC'd?
Are there other DLLs that CSC.AppBlocks.Logging depends on that may not be GAC'd?
Did you restart the host instance after GAC'ing the DLL?
Is your DLL 32-bit only? If so, make sure you change your host instance settings to only run as a 32-bit process.
Is there an inner exception reported in any of the messages? Perhaps in the Event Viewer?

Getting Error in EntityManagerWrapper.getNonTxEMsFromCurrentInvocation(EntityManagerWrapper.java:276)

I am having my application deployed in EJBContainer in glassfish server. I am calling one method using Callable and future in session bean, and in this method i'm using EntityManager for some transaction but getting an NullPointerException for whenever any call to EntityManager is there. Below is the error stack trace::
Severe: java.lang.NullPointerException
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.getNonTxEMsFromCurrentInvocation(EntityManagerWrapper.java:276)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.getNonTxEMFromCurrentInvocation(EntityManagerWrapper.java:260)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:213)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:455)
at LogisticsEngineSessionBean.getAllPackSerialsForProcess(LogisticsEngineSessionBean.java:3137)
at LogisticsEngineSessionBean.processSalesOutLines(LogisticsEngineSessionBean.java:3462)
at LogisticsEngineSessionBean.lambda$updateSKULocationStatusOnSell$0(LogisticsEngineSessionBean.java:2972)
at LogisticsEngineSessionBean$$Lambda$7/1138463255.call(Unknown Source)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Please suggest whether it is because i'm trying to do multi threading or any alternate for this is available. I'm using EclipseLink JPA. This NullPointerException is not within my Code,it is coming in EntityManager which is working fine when i'm not doing MultiThreading. And EntityManager Object is not null, Please read the question properly before giving downvote.

EJB Timer IllegalArgumentException

I have an EJB3.0 timer which runs great.During application deployment i see this error in my WL logs,
An exception occurred while registering the MBean null.java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=admin,Name=weblogic.ejb.timer"
And during undeployment this
An unexpected error was encountered while attempting to remove any EJB Timers from the persistent store for the EJB 'TimerBean(Application: )
I don't use persistence store mechanism.I trigger the timer with servlet context.
We use WL 10.3.1,How can i overcome/catch this exception so,that it wouldn't be displayed during build process.
Thanks
The WLS ejb timers are persisted to a default store. The error messages seem to be related to it. Its likely that the ejb timer from a previous deployment is interfering. Does a server restart resolve this issue? You may want to try your app on WLS 10.3.4 to see if the issue has been resolved.

Resources