Calling remotely tasks deployed via a GAR file - ignite

I use UriDeploymentSpi bean to load GAR files from a directory in one of my nodes
I have following GAR ignite.xml file (took me a while to figure this one out btw, nowhere documented?)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<util:list id="myList" value-type="java.lang.String">
<value>myproject.HelloWorldTask</value>
<value>myproject.SimpleTask</value>
</util:list>
</beans>
HelloWorldTask:
package myproject;
public class HelloWorldTask extends ComputeTaskAdapter<String, Integer> {
static {
System.out.println("TheGlue: Loading HelloWorldTask ");
}
public HelloWorldTask() {
}
#Nullable
#Override
public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> nodes, #Nullable String arg) throws IgniteException {
System.out.println("Hello from GAR file");
return null; //To change body of implemented methods use File | Settings | File Templates.
}
#Nullable
#Override
public Integer reduce(List<ComputeJobResult> results) throws IgniteException {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}
SimpleTask:
package myproject;
#ComputeTaskName("SimpleTaskName")
public class SimpleTask implements ComputeTask<String, Integer> {
static {
System.out.println("Loading SimpleTask");
}
public SimpleTask() {
}
#Override
public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, String arg) throws IgniteException {
System.out.println("Computing Job in SimpleTask ");
return null; //To change body of implemented methods use File | Settings | File Templates.
}
#Override
public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) throws IgniteException {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
#Override
public Integer reduce(List<ComputeJobResult> results) throws IgniteException {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}
The 2 classes can be found by Ignite (debugged through GridUriDeploymentSpringDocument and GridUriDeploymentFileProcessor and they are found and loaded). Ignite says that it found the GAR, but as far as I can see, the classes are not instantiated. No errors in the log files, no indications that the Tasks are deployed either.
I am trying to execute the following code on a node where the GAR file is not deployed (ie. client node of the cluster), but the Task is not executed on the cluster:
public class _03GarTest {
public static void main(String[] args) {
System.out.println("Start urideployment test");
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setPeerClassLoadingEnabled(true); //needs to be the same as in the XML for the server
cfg.setClientMode(true);
try(Ignite ignite = Ignition.start(cfg)) {
ignite.compute(ignite.cluster().forRemotes()).execute("SimpleTaskName", null);
}
}
}
Log file where I execute the _03GarTest class (same if I run with "SimpleTaskName" or "myproject.SimpleTaskName"), dumps the following stacktraces on the client node:
Exception in thread "main" class org.apache.ignite.IgniteDeploymentException: Unknown task name or failed to auto-deploy task (was task (re|un)deployed?): SimpleTaskName
at org.apache.ignite.internal.util.IgniteUtils$7.apply(IgniteUtils.java:761)
at org.apache.ignite.internal.util.IgniteUtils$7.apply(IgniteUtils.java:759)
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:877)
at org.apache.ignite.internal.IgniteComputeImpl.execute(IgniteComputeImpl.java:154)
at _03GarTest.main(_03GarTest.java:55)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: class org.apache.ignite.internal.IgniteDeploymentCheckedException: Unknown task name or failed to auto-deploy task (was task (re|un)deployed?): SimpleTaskName
at org.apache.ignite.internal.processors.task.GridTaskProcessor.startTask(GridTaskProcessor.java:515)
at org.apache.ignite.internal.processors.task.GridTaskProcessor.execute(GridTaskProcessor.java:447)
at org.apache.ignite.internal.IgniteComputeImpl.execute(IgniteComputeImpl.java:151)
... 6 more
And on the server, following logs are produced:
[13:13:33,057][INFO][disco-event-worker-#48%null%][GridDiscoveryManager] Added new node to topology: TcpDiscoveryNode [id=b70dce5e-c0fd-4ffe-8dc2-b72b18db76da, addrs=[0:0:0:0:0:0:0:1, 10.1.26.59, 127.0.0.1, 192.168.8.103, 192.168.99.1], sockAddrs=[/192.168.8.103:0, /0:0:0:0:0:0:0:1:0, /192.168.99.1:0, /10.1.26.59:0, /10.1.26.59:0, /127.0.0.1:0, /192.168.8.103:0, /192.168.99.1:0], discPort=0, order=12, intOrder=7, lastExchangeTime=1452600812926, loc=false, ver=1.5.0#20151229-sha1:f1f8cda2, isClient=true]
[13:13:33,063][INFO][disco-event-worker-#48%null%][GridDiscoveryManager] Topology snapshot [ver=12, servers=1, clients=1, CPUs=8, heap=1.5GB]
[13:13:33,085][WARNING][disco-event-worker-#48%null%][CourtesyConfigNotice]
>>> +-------------------------------------------------------------------+
>>> + Courtesy notice that joining node has inconsistent configuration. +
>>> + Ignore this message if you are sure that this is done on purpose. +
>>> +-------------------------------------------------------------------+
>>> Remote Node ID: B70DCE5E-C0FD-4FFE-8DC2-B72B18DB76DA
>>> Remote SPI with the same name is not configured: UriDeploymentSpi
>>> => Local node: o.a.i.spi.deployment.uri.UriDeploymentSpi
[13:13:33,103][INFO][exchange-worker-#51%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=12, minorTopVer=0], evt=NODE_JOINED, node=b70dce5e-c0fd-4ffe-8dc2-b72b18db76da]
[13:13:33,907][INFO][disco-event-worker-#48%null%][GridDiscoveryManager] Node left topology: TcpDiscoveryNode [id=b70dce5e-c0fd-4ffe-8dc2-b72b18db76da, addrs=[0:0:0:0:0:0:0:1, 10.1.26.59, 127.0.0.1, 192.168.8.103, 192.168.99.1], sockAddrs=[/192.168.8.103:0, /0:0:0:0:0:0:0:1:0, /192.168.99.1:0, /10.1.26.59:0, /10.1.26.59:0, /127.0.0.1:0, /192.168.8.103:0, /192.168.99.1:0], discPort=0, order=12, intOrder=7, lastExchangeTime=1452600812926, loc=false, ver=1.5.0#20151229-sha1:f1f8cda2, isClient=true]
[13:13:33,908][INFO][disco-event-worker-#48%null%][GridDiscoveryManager] Topology snapshot [ver=13, servers=1, clients=0, CPUs=8, heap=1.0GB]
[13:13:33,918][INFO][exchange-worker-#51%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=13, minorTopVer=0], evt=NODE_LEFT, node=b70dce5e-c0fd-4ffe-8dc2-b72b18db76da]
[13:14:03,193][INFO][grid-timeout-worker-#33%null%][IgniteKernal]
Any ideas on how to call a task deployed via a GAR file on another node?
----UPDATE----
As suggested in one of the answers, I have added the following code in the client
System.out.println("Start urideployment test");
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setPeerClassLoadingEnabled(true); //needs to be the same as in the XML for the server
cfg.setClientMode(true);
UriDeploymentSpi deploymentSpi = new UriDeploymentSpi();
deploymentSpi.setUriList(Arrays.asList("file:///Users/sbeaupre/Dropbox/prorabel/Projects/IgniteTests/ignite/gar"));
cfg.setDeploymentSpi(deploymentSpi);
try(Ignite ignite = Ignition.start(cfg)) {
...
But this doesn't work either, I got following stack trace on the client node and nothing on the server node:
Jan 14, 2016 5:42:23 PM org.apache.ignite.logger.java.JavaLogger info
INFO: Topology snapshot [ver=4, servers=1, clients=1, CPUs=8, heap=1.5GB]
Jan 14, 2016 5:42:23 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from resource loaded from byte array
Jan 14, 2016 5:42:23 PM org.apache.ignite.logger.java.JavaLogger info
INFO: User version is not explicitly defined (will use default version) [file=META-INF/ignite.xml, clsLdr=GridUriDeploymentClassLoader [urls=[file:/var/folders/t3/595tz_px2j9__wl37f0b5nw40000gn/T/gg.uri.deployment.tmp/301a4cb8-6fc7-4aa9-b050-3083183f4cd0/dirzip_Archive8035449106801616883.gar/]]]
Jan 14, 2016 5:42:23 PM org.apache.ignite.logger.java.JavaLogger info
INFO: Task locally deployed: class myproject.SimpleTask
Loading SimpleTask
Computing Job in SimpleTask
Jan 14, 2016 5:42:23 PM org.apache.ignite.logger.java.JavaLogger error
SEVERE: Failed to map task jobs to nodes: GridTaskSessionImpl [taskName=SimpleTaskName, dep=GridDeployment [ts=1452789743727, depMode=SHARED, clsLdr=GridUriDeploymentClassLoader [urls=[file:/var/folders/t3/595tz_px2j9__wl37f0b5nw40000gn/T/gg.uri.deployment.tmp/301a4cb8-6fc7-4aa9-b050-3083183f4cd0/dirzip_Archive8035449106801616883.gar/]], clsLdrId=cc234014251-301a4cb8-6fc7-4aa9-b050-3083183f4cd0, userVer=0, loc=true, sampleClsName=myproject.SimpleTask, pendingUndeploy=false, undeployed=false, usage=1], taskClsName=myproject.SimpleTask, sesId=bc234014251-301a4cb8-6fc7-4aa9-b050-3083183f4cd0, startTime=1452789743638, endTime=9223372036854775807, taskNodeId=301a4cb8-6fc7-4aa9-b050-3083183f4cd0, clsLdr=GridUriDeploymentClassLoader [urls=[file:/var/folders/t3/595tz_px2j9__wl37f0b5nw40000gn/T/gg.uri.deployment.tmp/301a4cb8-6fc7-4aa9-b050-3083183f4cd0/dirzip_Archive8035449106801616883.gar/]], closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=301a4cb8-6fc7-4aa9-b050-3083183f4cd0, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1452789743739, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]]
class org.apache.ignite.IgniteCheckedException: Task map operation produced no mapped jobs: GridTaskSessionImpl [taskName=SimpleTaskName, dep=GridDeployment [ts=1452789743727, depMode=SHARED, clsLdr=GridUriDeploymentClassLoader [urls=[file:/var/folders/t3/595tz_px2j9__wl37f0b5nw40000gn/T/gg.uri.deployment.tmp/301a4cb8-6fc7-4aa9-b050-3083183f4cd0/dirzip_Archive8035449106801616883.gar/]], clsLdrId=cc234014251-301a4cb8-6fc7-4aa9-b050-3083183f4cd0, userVer=0, loc=true, sampleClsName=myproject.SimpleTask, pendingUndeploy=false, undeployed=false, usage=1], taskClsName=myproject.SimpleTask, sesId=bc234014251-301a4cb8-6fc7-4aa9-b050-3083183f4cd0, startTime=1452789743638, endTime=9223372036854775807, taskNodeId=301a4cb8-6fc7-4aa9-b050-3083183f4cd0, clsLdr=GridUriDeploymentClassLoader [urls=[file:/var/folders/t3/595tz_px2j9__wl37f0b5nw40000gn/T/gg.uri.deployment.tmp/301a4cb8-6fc7-4aa9-b050-3083183f4cd0/dirzip_Archive8035449106801616883.gar/]], closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, subjId=301a4cb8-6fc7-4aa9-b050-3083183f4cd0, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1452789743739, endTime=0, ignoreInterrupts=false, lsnr=null, state=INIT]]]
at org.apache.ignite.internal.processors.task.GridTaskWorker.body(GridTaskWorker.java:497)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at org.apache.ignite.internal.processors.task.GridTaskProcessor.startTask(GridTaskProcessor.java:678)
at org.apache.ignite.internal.processors.task.GridTaskProcessor.execute(GridTaskProcessor.java:447)
at org.apache.ignite.internal.IgniteComputeImpl.execute(IgniteComputeImpl.java:151)
at _03GarTest.main(_03GarTest.java:55)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Sven,
You should configure URI deployment SPI on client node as well to make GAR deployment work properly.
When you call compute.execute("taskName"); a lot of things have to be done locally on client prior to first request is sent to any of the node in your topology and after results start coming back. At least, Ignite should be able to get mapped jobs and be able to process results from all remote jobs and reduce all the results - please see ComputeTask.map() and ComputeTask.result() and ComputeTask.reduce(). So, you should be able to instantiate task on client node and that is why you should have task classes available.
I think after you configure URI deployment on client nodes you should have your code work fine.
Please post a comment here if you need any additional info.
Thanks!
UPDATE Jan, 18 2016
This is update in response to question update.
Please note that task in question returns null from map() method which is illegal. You can refer to org.apache.ignite.examples.computegrid.ComputeTaskMapExample in binary release or directly via https://git-wip-us.apache.org/repos/asf?p=ignite.git;a=blob;f=examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java;h=3de5293a814e527b57e3984f6d3ab96bb1b62daf;hb=HEAD

Related

Why is ignite failing to deserialize a GridClosureProcessor object?

I know a similar stack has been posted by others. My question is "it looks like Ignite is trying to deserialize a GridClosureProcessor (or a closure from it?) . If so, why is it doing that? I am trying to root cause this issue but none of my code is in the stack except MyCallable mentioned at the top (not actually in the stack).
No cache puts are happening in this code path unless they are internal. I mention this because of a comment on another post that "Unknown pair" can be caused by a cache put of the wrong type.
I am focusing on
Failed to deserialize object
[typeName=org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2]
Here's the rest.
[2019-04-08 22:20:23,724][ERROR][pub-#63][GridJobWorker] Failed to
initialize job
[jobId=800890ff961-7ff6a786-9d4d-43d8-91a0-70225c5e3a4a,
ses=GridJobSessionImpl [ses=GridTaskSessionImpl
[taskName=com.obfucorp.aa.project.core.jobs.MyCallable,
dep=GridDeployment [ts=1554761996013, depMode=SHARED,
clsLdr=sun.misc.Launcher$AppClassLoader#764c12b6,
clsLdrId=730290ff961-8d93b961-09f2-48c3-bd2f-49db31aae61e, userVer=0,
loc=true,
sampleClsName=o.a.i.i.processors.cache.GridCacheProcessor$RemovedItemsCleanupTask$1,
pendingUndeploy=false, undeployed=false, usage=1],
taskClsName=com.obfucorp.aa.project.core.jobs.MyCallable,
sesId=700890ff961-7ff6a786-9d4d-43d8-91a0-70225c5e3a4a,
startTime=1554762023663, endTime=9223372036854775807,
taskNodeId=7ff6a786-9d4d-43d8-91a0-70225c5e3a4a,
clsLdr=sun.misc.Launcher$AppClassLoader#764c12b6, closed=false,
cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false,
internal=false, topPred=null,
subjId=7ff6a786-9d4d-43d8-91a0-70225c5e3a4a, mapFut=IgniteFuture
[orig=GridFutureAdapter [ignoreInterrupts=false, state=INIT, res=null,
hash=314803578]], execName=null],
jobId=800890ff961-7ff6a786-9d4d-43d8-91a0-70225c5e3a4a]] class
org.apache.ignite.IgniteCheckedException: Failed to deserialize object
[typeName=org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2]
at
org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9908)
at
org.apache.ignite.internal.processors.job.GridJobWorker.initialize(GridJobWorker.java:438)
at
org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1117)
at
org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1921)
at
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1555)
at
org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1183)
at
org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:126)
at
org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1090)
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: class
org.apache.ignite.binary.BinaryObjectException: Failed to deserialize
object
[typeName=org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2]
at
org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:875)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714)
at
org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:310)
at
org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:99)
at
org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
at
org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9902)
... 10 more Caused by: class
org.apache.ignite.binary.BinaryInvalidTypeException: Unknown pair
[platformId=0, typeId=-1409390795] at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:696)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1755)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714)
at
org.apache.ignite.internal.binary.BinaryUtils.doReadObject(BinaryUtils.java:1799)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.readObject(BinaryReaderExImpl.java:1329)
at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.readBinary(GridClosureProcessor.java:1872)
at
org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:834)
... 16 more Caused by: java.lang.ClassNotFoundException: Unknown pair
[platformId=0, typeId=-1409390795] at
org.apache.ignite.internal.MarshallerContextImpl.getClassName(MarshallerContextImpl.java:385)
at
org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:335)
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:687)
... 22 more
update - wanted to note this is happening a fresh deployment. There are no old files or persisted anything around. All classes are either pulled from even or freshly compiled. ty.
Pavel, here is the (Scala) code (redacted)
object MyCallable {
type FooList = Array[Foo]
}
class MyCallable(cacheName: String) extends IgniteCallable[FooList] with Serializable with LazyLogging {
#IgniteInstanceResource
private var ignite: Ignite = _
override def call(): FooList = {
logger.debug("callable called.");
val fooCache = ignite.getOrCreateCache[String, Foo](cacheName)
val qry = new ScanQuery[String, Foo]()
qry.setLocal(true)
val cursor = fooCache.query(qry)
val ret = cursor.iterator().asScala.map(e => e.getValue).toArray
logger.info("load status array: {}", ret.mkString)
return ret
}
#IgniteInstanceResource
def setIgnite(ignite: Ignite): Unit = {
this.ignite = ignite
}
}
Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: Unknown pair [platformId=0, typeId=-1409390795]
Seems like you have lost your marshaller cache (marshaller/ dir).
You can do ignite.marshaller().marshal(new WhateverTypeIsCausingThis()); once to make this error go away.

Apache Ignite Cache put fails with in the IgniteRunnable run method

I am getting the below error during the igniteCache.put() in the IgniteRunnable run()
I have only 2 nodes (client and server) .
1) Client creates the cache
CacheConfiguration<Integer, LAttribute> cfg = new CacheConfiguration<Integer, LAttribute>();
cfg.setIndexedTypes(Integer.class, LoanAttribute.class);
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setName("inv_result");
cfg.setCopyOnRead(false);
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
2) Client Submit the IgniteRunnable task to Server
3) Client exit the cluster
On the Server (with in run() method)
1) Get the cache and put a value
IgniteCache<Integer, LAttribute> iCache = Ignition.localIgnite().cache("inv_result");
System.out.println("Begin .. "+iCache.size(CachePeekMode.ALL));
iCache.put(la.getId(), la);
Error :
[21:41:14,859][SEVERE][pub-#67%null%][GridJobWorker] Failed to execute job due to unexpected runtime exception [jobId=f4606f39b51-21c994a7-6b35-49fa-b696-582fa7825c31, ses=GridJobSessionImpl [ses=GridTaskSessionImpl [taskName=com.test.ignite.compute.AssetRestrictionComputeJob, dep=GridDeployment [ts=1492836063447, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader#73d16e93, clsLdrId=438a5f39b51-76a937b0-7831-458b-aee4-cec662f02b0d, userVer=0, loc=true, sampleClsName=o.a.i.i.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2, pendingUndeploy=false, undeployed=false, usage=1], taskClsName=com.bfm.seclending.ignite.compute.AssetRestrictionComputeJob, sesId=c4606f39b51-21c994a7-6b35-49fa-b696-582fa7825c31, startTime=1492836072790, endTime=9223372036854775807, taskNodeId=21c994a7-6b35-49fa-b696-582fa7825c31, clsLdr=sun.misc.Launcher$AppClassLoader#73d16e93, closed=false, cpSpi=null, failSpi=null, loadSpi=null, usage=1, fullSup=false, internal=false, subjId=21c994a7-6b35-49fa-b696-582fa7825c31, mapFut=IgniteFuture [orig=GridFutureAdapter [resFlag=0, res=null, startTime=1492836072829, endTime=0, ignoreInterrupts=false, state=INIT]]], jobId=f4606f39b51-21c994a7-6b35-49fa-b696-582fa7825c31]]
javax.cache.CacheException: class org.apache.ignite.IgniteInterruptedException: Failed to wait for asynchronous operation permit (thread got interrupted).
at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1440)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.cacheException(IgniteCacheProxy.java:2183)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.put(IgniteCacheProxy.java:1383)
at co.test.ignite.compute.AssetRestrictionComputeJob.run(AssetRestrictionComputeJob.java:110)
at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4V2.execute(GridClosureProcessor.java:2215)
at org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:556)
at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6564)
at org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:550)
at org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:479)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1180)
at org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1894)
at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1082)
at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:710)
at org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:102)
at org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:673)
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: class org.apache.ignite.IgniteInterruptedException: Failed to wait for asynchronous operation permit (thread got interrupted).
at org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:766)
at org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:764)
... 19 more
Caused by: java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
at java.util.concurrent.Semaphore.acquire(Semaphore.java:312)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.asyncOpAcquire(GridCacheAdapter.java:4597)
at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.asyncOp(GridDhtAtomicCache.java:817)
at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAsync0(GridDhtAtomicCache.java:1148)
at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.putAsync0(GridDhtAtomicCache.java:618)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.putAsync(GridCacheAdapter.java:2541)
at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.put(GridDhtAtomicCache.java:595)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2215)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.put(IgniteCacheProxy.java:1376)
... 16 more
Most likely server node was stopped in the middle of execution. That's the only case when internal Ignite threads are interrupted. When this happens, job can be automatically failed over to another node: https://apacheignite.readme.io/docs/fault-tolerance
I found the reason for the InterruptedException , executionService that i am using on the client side to submit the jobs is not waiting for the job completion .
when i call future.get() .. all good now. Thanks

SimpleMessageListenerContainer: Consumer raised exception, processing can restart if processing supports it

I have a Spring Boot application interfacing with a rabbitmq broker which manages to startup fine but I am getting a constant start/shutdown of the message consumer regardless of there being a message on the queue. Below is a copy of my application log and client class:
2016-10-19 11:40:25,909 WARN t:[SimpleAsyncTaskExecutor-106] SimpleMessageListenerContainer: Consumer raised exception, processing can restart if the connection factory supports it
java.lang.NullPointerException: null
at com.rabbitmq.client.impl.ChannelN.validateQueueNameLength(ChannelN.java:1232) ~[amqp-client-3.5.5.jar:na]
at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:884) ~[amqp-client-3.5.5.jar:na]
at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:61) ~[amqp-client-3.5.5.jar:na]
at sun.reflect.GeneratedMethodAccessor334.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_51]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_51]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:666) ~[spring-rabbit-1.4.6.RELEASE.jar:na]
at com.sun.proxy.$Proxy181.queueDeclarePassive(Unknown Source) ~[na:na]
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:533) ~[spring-rabbit-1.4.6.RELEASE.jar:na]
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:453) ~[spring-rabbit-1.4.6.RELEASE.jar:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1083) ~[spring-rabbit-1.4.6.RELEASE.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51]
2016-10-19 11:40:25,909 INFO t:[SimpleAsyncTaskExecutor-106] SimpleMessageListenerContainer: Restarting Consumer: tags=[{}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest#127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=0
2016-10-19 11:40:25,910 DEBUG t:[SimpleAsyncTaskExecutor-106] BlockingQueueConsumer: Closing Rabbit Channel: Cached Rabbit Channel: AMQChannel(amqp://guest#127.0.0.1:5672/,1)
2016-10-19 11:40:25,910 DEBUG t:[SimpleAsyncTaskExecutor-106] CachingConnectionFactory: Closing cached Channel: AMQChannel(amqp://guest#127.0.0.1:5672/,1)
2016-10-19 11:40:25,911 DEBUG t:[SimpleAsyncTaskExecutor-107] DefaultListableBeanFactory: Returning cached instance of singleton bean 'macRequestQueue'
2016-10-19 11:40:25,911 DEBUG t:[SimpleAsyncTaskExecutor-107] BlockingQueueConsumer: Starting consumer Consumer: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2016-10-19 11:40:25,912 DEBUG t:[SimpleAsyncTaskExecutor-107] CachingConnectionFactory: Creating cached Rabbit Channel from AMQChannel(amqp://guest#127.0.0.1:5672/,1)
2016-10-19 11:40:25,912 DEBUG t:[SimpleAsyncTaskExecutor-107] SimpleMessageListenerContainer: Recovering consumer in 5000 ms.
Below is a copy of my client class:
public class RabbitClientConfiguration extends AbstractEMCRabbitConfiguration {
#Inject
private JacksonConfiguration jacksonConfiguration;
#Inject
private MessagingConfiguration messagingConfiguration;
//#Value("${data.core.pattern}")
//private String coreDataRoutingKey;
//#Inject
//private ClientHandler clientHandler;
#Override
public void configureRabbitTemplate(RabbitTemplate rabbitTemplate) {
rabbitTemplate.setRoutingKey(MAC_REQUEST_ROUTING_KEY);
}
#Bean
public SimpleMessageListenerContainer messageListenerContainer(){
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setQueueNames(MAC_REQUEST_QUEUE_NAME);
container.setMessageListener(messageListenerAdapter());
container.setAcknowledgeMode(AcknowledgeMode.AUTO);
return container;
}
#Bean
MessageListenerAdapter messageListenerAdapter(){
return new MessageListenerAdapter(clientHandler(jacksonConfiguration.objectMapper(),messagingConfiguration.macMessageHandler(messagingConfiguration.messagingFactory())),jsonMessageConverter());
//return new MessageListenerAdapter(clientHandler,"receiveMessage");
}
#Bean
ClientHandler clientHandler(ObjectMapper objectMapper, IMessageHandler macMessageHandler){
ClientHandler clientHandler = new ClientHandler();
clientHandler.setObjectMapper(objectMapper);
clientHandler.setMacMessageHandler(macMessageHandler);
return clientHandler;
}
#Bean
public AmqpAdmin rabbitAdmin() { return new RabbitAdmin(connectionFactory());}
}
java.lang.NullPointerException: null at com.rabbitmq.client.impl.ChannelN.validateQueueNameLength
It means MAC_REQUEST_QUEUE_NAME contains null - it looks like the container doesn't check that when you call the setter.
I opened a JIRA Issue to detect this condition.

Unable to do a remote ejb access from a different host

We are using a servlet to access a remote ejb deployed on a different host and getting the
exception mentioned in the stacktrace below.
The remote access works if the servlet client and the remote ejb war are deployed in different domains and on the same host.
Works if they are deployed on the same host and same domain
does not work when deployed on two diffrent hosts.
Looking at the exception"CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No", we thought it could be security issue.
But the test ejb application didnt have any security configurations. Tried adding the "" details to the sun-ejb-jar.xml
and used ProgrammaticLogin api. We got the same exception. Not sure if the security config was correct though.
The glassfish-corba log level was set to finest in the server where the ejb application was deployed. We then got this exception, "
org.omg.CORBA.BAD_INV_ORDER: FINE: IOP01600015: Service context add failed in portable interceptor because a service context with id 15 already exists vmcid: SUN minor code: 15 completed: No".
The full stacktrace is mentioned below in the server log.
tried using the front-end back-end test cases from Glassfish bug: http://java.net/jira/browse/GLASSFISH-15523. We are
getting the same exception.
Glassfish version: 3.1 build 43
Not sure where we are going wrong. Please help. Thanks.
Client Side log:
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=TestService,Remote 3.x interface =com.medallion.test.service.TestService,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:50.57.150.62:3700#TestService,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'corbaname:iiop:50.57.150.62:3700#TestService__3_x_Internal_RemoteBusinessHome__' [Root exception is org.omg.CORBA.BAD_PARAM: FINE: IOP00100009: string_to_object conversion failed due to bad schema specific part in name TestService__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No]
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:178)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1106)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:776)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:744)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:172)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:498)
... 38 more
Caused by: org.omg.CORBA.BAD_PARAM: FINE: IOP00100009: string_to_object conversion failed due to bad schema specific part in name TestService__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at $Proxy142.soBadSchemaSpecific(Unknown Source)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:227)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:154)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:145)
at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:976)
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:171)
... 43 more
Caused by: org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:421)
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:443)
at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:612)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:612)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:333)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:196)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1624)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1486)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:990)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:214)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:742)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:539)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2324)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)
----------END server-side stack trace---------- vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:900)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:131)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:637)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:499)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:373)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:273)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:395)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextExtHelper.narrow(NamingContextExtHelper.java:73)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:212)
... 47 more
Server Side log( after setting the corba log level to finest):
[#|2011-12-02T11:37:16.111-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba.org.glassfish.enterprise.iiop.impl|_ThreadID=161;_ThreadName=Thread-2;ClassName=org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory;MethodName=setAcceptedSocketOptions;|setAcceptedSocketOptions: SocketOrChannelAcceptorImpl[3700 IIOP_CLEAR_TEXT true true] ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=3700] Socket[addr=/173.13.42.205,port=54829,localport=3700]|#]
[#|2011-12-02T11:37:16.113-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba|_ThreadID=15;_ThreadName=Thread-2;ClassName=com.sun.logging.LogDomains$1;MethodName=getResourceBundle;|Can not find resource bundle for this logger. class name that failed: org.glassfish.enterprise.iiop.impl.GlassFishORBManager|#]
[#|2011-12-02T11:37:16.180-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba|_ThreadID=161;_ThreadName=Thread-2;ClassName=com.sun.logging.LogDomains$1;MethodName=getResourceBundle;|Can not find resource bundle for this logger. class name that failed: org.glassfish.enterprise.iiop.impl.GlassFishORBManager|#]
[#|2011-12-02T11:37:16.179-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba.org.glassfish.enterprise.iiop.impl|_ThreadID=161;_ThreadName=Thread-2;ClassName=org.glassfish.enterprise.iiop.impl.POAProtocolMgr;MethodName=getEjbDescriptor;|POAProtocolMgr.getEjbDescriptor->: [B#77dc7838|#]
[#|2011-12-02T11:37:16.181-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba|_ThreadID=161;_ThreadName=Thread-2;ClassName=com.sun.logging.LogDomains$1;MethodName=getResourceBundle;|Can not find resource bundle for this logger. class name that failed: org.glassfish.enterprise.iiop.impl.GlassFishORBManager|#]
[#|2011-12-02T11:37:16.181-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba.org.glassfish.enterprise.iiop.impl|_ThreadID=161;_ThreadName=Thread-2;ClassName=org.glassfish.enterprise.iiop.impl.POAProtocolMgr;MethodName=getEjbDescriptor;|POAProtocolMgr.getEjbDescriptor: [B#77dc7838: ejbId: 4,294,967,297|#]
[#|2011-12-02T11:37:16.181-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba|_ThreadID=161;_ThreadName=Thread-2;ClassName=com.sun.logging.LogDomains$1;MethodName=getResourceBundle;|Can not find resource bundle for this logger. class name that failed: org.glassfish.enterprise.iiop.impl.GlassFishORBManager|#]
[#|2011-12-02T11:37:16.181-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba.org.glassfish.enterprise.iiop.impl|_ThreadID=161;_ThreadName=Thread-2;ClassName=org.glassfish.enterprise.iiop.impl.POAProtocolMgr;MethodName=getEjbDescriptor;|POAProtocolMgr.getEjbDescriptor<-: [B#77dc7838: null|#]
[#|2011-12-02T11:37:16.183-0600|FINE|glassfish3.1.1|javax.enterprise.resource.corba.OMG|_ThreadID=161;_ThreadName=Thread-2;ClassName=com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator;MethodName=handleFullLogging;|IOP01600015: Service context add failed in portable interceptor because a service context with id 15 already exists
org.omg.CORBA.BAD_INV_ORDER: FINE: IOP01600015: Service context add failed in portable interceptor because a service context with id 15 already exists vmcid: SUN minor code: 15 completed: No
at sun.reflect.GeneratedConstructorAccessor729.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at $Proxy210.serviceContextAddFailed(Unknown Source)
at com.sun.corba.ee.impl.interceptors.ServerRequestInfoImpl.enqueue(ServerRequestInfoImpl.java:702)
at com.sun.corba.ee.impl.interceptors.ServerRequestInfoImpl.add_reply_service_context(ServerRequestInfoImpl.java:482)
at com.sun.corba.ee.impl.interceptors.ServerRequestInfoImpl.setCurrentExecutionPoint(ServerRequestInfoImpl.java:738)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIEndingPoint(PIHandlerImpl.java:632)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.runInterceptors(CorbaMessageMediatorImpl.java:2189)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.createResponseHelper(CorbaMessageMediatorImpl.java:2101)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.createResponseHelper(CorbaMessageMediatorImpl.java:2089)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.createSystemExceptionResponse(CorbaMessageMediatorImpl.java:2014)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:1796)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:1758)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:255)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1624)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1486)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:990)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:214)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:742)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:539)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2324)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)
|#]
Code used:
Client:
servlet:
#WebServlet("/TestServlet")
public class TestServlet extends HttpServlet {
#EJB(name = "TestService")
private TestService testService;
/**
* #see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter w = response.getWriter();
try {
w.write("Test o/p: " + testService.testEJB("This is a test msg") + "\n");
} catch (Exception e) {
e.printStackTrace(w);
}
}
}
sun-web.xml:
<ejb-ref>
<ejb-ref-name>TestService</ejb-ref-name>
<!-- <jndi-name>corbaname:iiop:localhost:3700#TestService</jndi-name> -->
<jndi-name>corbaname:iiop:<ip>:3700#TestService</jndi-name>
</ejb-ref>
Remote ejb:
#Stateless(mappedName="TestService")
public class TestServiceImpl implements Serializable, TestService {
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(TestServiceImpl.class.getName());
#Resource EJBContext ejbContext;
#Override
public String testEJB(String testStr) {
String userName = ejbContext.getCallerPrincipal().getName();
System.out.println("Username: " + userName);
return "Msg Recieved: " + testStr;
}
sun-ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>TestServiceImpl</ejb-name>
<jndi-name>TestService</jndi-name>
<!--<ior-security-config>
<as-context>
<auth-method>USERNAME_PASSWORD</auth-method>
<realm>database-realm</realm>
<required>true</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
<transport-config>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
</ior-security-config>-->
</ejb>
</enterprise-beans>
<security-role-mapping>
</security-role-mapping>
</sun-ejb-jar>
Perhaps not the answer to your question but I'll mention this here:
We had a similar problem with glassfish 3.1.2 where the occurring exception mentions CORBA.NO_PERMISSION and there is no stacktrace on the server side. Somewhere in the logfile we found the Exception Invalid iiop-listener orb-listener-1. Lazy-init not supported for SSL iiop-listeners
This is a bug in glassfish see:
https://java.net/jira/browse/GLASSFISH_CORBA-13
The glassfish admin interface automatically adds an SSL entry to the configured non SSL iiop-listener, due to this, the exception occures and remoting won't work anymore. As workaround you can remove the SSL-config-entry from the domain.xml manually to get remoting work again. But a soon as you open the IOP-Listener section again in the admin interface, the entry will be created again on glassfish restart.

Why is Glassfish 3.1.1 unable to create my Stateless Session Bean?

Glassfish 3.1.1 (build 12)
Application deployed as a WAR using JAX-RS, EJB3, JPA
There are no deployment errors in the logs. This is a very clean glassfish 3.1.1 install, with only this application deployed. This application works in Glassfish 3.0.1 I am getting the following exception when web service method is invoked.
EJB5070: Exception creating stateless session bean : [VehicleManagementService]|#]
Here is some info from the logs during deployment regarding the creation of the EJBs:
[#|2011-08-26T11:03:26.928-0500|INFO|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=23;_ThreadName=Thread-2;|Portable JNDI names for EJB VehicleAliases : [java:global/vehicle/VehicleAliases!com.realcomp.vehicle.ejb.VehicleAliases, java:global/vehicle/VehicleAliases]|#]
[#|2011-08-26T11:03:26.937-0500|INFO|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=23;_ThreadName=Thread-2;|Portable JNDI names for EJB VehicleManagementService : [java:global/vehicle/VehicleManagementService!com.realcomp.vehicle.web.service.VehicleManagementService, java:global/vehicle/VehicleManagementService]|#]
[#|2011-08-26T11:03:27.002-0500|INFO|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=23;_ThreadName=Thread-2;|Portable JNDI names for EJB VehicleManagementBean : [java:global/vehicle/VehicleManagementBean!com.realcomp.vehicle.ejb.VehicleManagementBean, java:global/vehicle/VehicleManagementBean!com.realcomp.vehicle.ejb.VehicleManagement]|#]
[#|2011-08-26T11:03:27.003-0500|INFO|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=23;_ThreadName=Thread-2;|Glassfish-specific (Non-portable) JNDI names for EJB VehicleManagementBean : [com.realcomp.vehicle.ejb.VehicleManagement, com.realcomp.vehicle.ejb.VehicleManagement#com.realcomp.vehicle.ejb.VehicleManagement]|#]
[#|2011-08-26T11:03:27.218-0500|INFO|glassfish3.1.1|org.hibernate.validator.engine.resolver.DefaultTraversableResolver|_ThreadID=23;_ThreadName=Thread-2;|Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.|#]
[#|2011-08-26T11:03:27.602-0500|INFO|glassfish3.1.1|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=23;_ThreadName=Thread-2;|Initializing Mojarra 2.1.3 (FCS b02) for context '/vehicle'|#]
[#|2011-08-26T11:03:27.660-0500|INFO|glassfish3.1.1|org.hibernate.validator.engine.resolver.DefaultTraversableResolver|_ThreadID=23;_ThreadName=Thread-2;|Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.|#]
[#|2011-08-26T11:03:27.771-0500|INFO|glassfish3.1.1|com.sun.jersey.api.core.WebAppResourceConfig|_ThreadID=23;_ThreadName=Thread-2;|Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes|#]
[#|2011-08-26T11:03:28.072-0500|INFO|glassfish3.1.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-2;|Root resource classes found:
class com.realcomp.vehicle.web.service.VehicleManagementService|#]
[#|2011-08-26T11:03:28.073-0500|INFO|glassfish3.1.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-2;|Provider classes found:
class org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper
class com.realcomp.vehicle.web.service.NoResultMapper
class com.realcomp.vehicle.web.service.EntityNotFoundMapper
class org.codehaus.jackson.jaxrs.JacksonJsonProvider
class com.realcomp.vehicle.web.service.NonUniqueResultMapper
class org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider
class org.codehaus.jackson.jaxrs.JsonParseExceptionMapper|#]
[#|2011-08-26T11:03:28.078-0500|INFO|glassfish3.1.1|com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer|_ThreadID=23;_ThreadName=Thread-2;|CDI support is enabled|#]
[#|2011-08-26T11:03:28.079-0500|INFO|glassfish3.1.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=23;_ThreadName=Thread-2;|Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:17 PM'|#]
[#|2011-08-26T11:03:28.172-0500|INFO|glassfish3.1.1|com.sun.jersey.server.impl.ejb.EJBComponentProviderFactory|_ThreadID=23;_ThreadName=Thread-2;|Binding the EJB class com.realcomp.vehicle.web.service.VehicleManagementService to EJBManagedComponentProvider|#]
Here is some of the VehicleManagementService:
#Stateless
#LocalBean
#Path("/")
#DeclareRoles({"production"})
public class VehicleManagementService implements Serializable{
private static final Logger logger = Logger.getLogger(VehicleManagementService.class.getName());
#Context
private UriInfo uriInfo;
#EJB
private VehicleManagementBean vehicles;
#EJB
private VehicleAliases aliases;
...
Here is full stack trace:
[#|2011-08-26T11:03:33.537-0500|SEVERE|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=27;_ThreadName=Thread-2;|EJB5070: Exception creating stateless session bean : [VehicleManagementService]|#]
[#|2011-08-26T11:03:33.538-0500|WARNING|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=27;_ThreadName=Thread-2;|A system exception occurred during an invocation on EJB VehicleManagementService method public javax.ws.rs.core.Response com.realcomp.vehicle.web.service.VehicleManagementService.getVehicle(java.lang.String)
javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:454)
at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2528)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1895)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at $Proxy307.getVehicle(Unknown Source)
at com.realcomp.vehicle.web.service.__EJB31_Generated__VehicleManagementService__Intf____Bean__.getVehicle(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:327)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:679)
Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:726)
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:247)
at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:449)
... 53 more
Caused by: javax.ejb.CreateException: Could not create stateless EJB
at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:534)
at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:95)
at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:724)
... 55 more
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:796)
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:1209)
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:144)
at org.glassfish.weld.services.JCDIServiceImpl._createJCDIInjectionContext(JCDIServiceImpl.java:169)
at org.glassfish.weld.services.JCDIServiceImpl.createJCDIInjectionContext(JCDIServiceImpl.java:146)
at com.sun.ejb.containers.BaseContainer.createEjbInstanceAndContext(BaseContainer.java:1636)
at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:475)
... 57 more
And here is getVehicle()
#GET
#Path("vin/{vin}")
#Produces(MediaType.APPLICATION_JSON)
#RolesAllowed("production")
public Response getVehicle(#PathParam("vin") String vin) {
Vehicle vehicle = vehicles.find(vin);
Response response = null;
if (vehicle == null)
response = Response.status(Status.NOT_FOUND).build();
else
response = Response.ok(vehicle).build();
return response;
}
The following changes fixed my problem. Unfortunately, I have changed too many things trying to fix this to be able to point to any one item.
I repackaged the application from WAR to EAR.
I changed the configuration of jersey from using the com.sun.jersey.spi.container.servlet.ServletContainer configuration in web.xml to a proper class that extends Application.
#ApplicationPath("/")
public class VehicleService extends Application {
#Override
public Set<Class<?>> getClasses() {
Set<Class<?>> retVal = new HashSet<Class<?>>();
retVal.add(VehicleResource.class);
retVal.add(EntityNotFoundMapper.class);
retVal.add(NoResultMapper.class);
retVal.add(NonUniqueResultMapper.class);
return retVal;
}
#Override
public Set<Object> getSingletons() {
Set<Object> singletons = new HashSet<Object>();
singletons.add(new org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider());
return singletons;
}
Thanks to JamesBoyZ for the link to EJB 3.1 in war package in WEB-INF/classes - javax.ejb.CreateException: Could not create stateless EJB that got me going in the right direction.
In the 2nd line of the stack trace, I saw:
A system exception occurred during an invocation on EJB VehicleManagementService getVehicle(java.lang.String)
It seems there is a problem with your getVehicle method?
Double-check that there's a(n empty) beans.xml in your bundled project.