I use Apache Kafka Streams the Processor API.
I create a remote object that extends the UnicastRemoteObject inside the StateStore of the Processor.
When the init(ProcessorContext) method of the Processor (which extends the AbstractProcessor) of my topology is called I put a ProcessorContext reference inside that remote Object.
public void init(ProcessorContext processorContext){
super.init(processorContext);
this.myStore = (MyCustomStore<String, String>)context().getStateStore("mystore");
this.myStore.getRemoteObject().setProcessorContext(processorContext);
}
If I access the ProcessorContext only remotely and use the forward method to send records to a sink processor it works fine. And if I access the ProcessorContext only locally to send records with forward it works fine, too.
If I access the ProcessorContext both locally and remotely to use forward I have NPE. I used a synchronized method in which foward is called because I thought that two different threads try to access ProcessorContext at the same time but the NPE insists.
It seems to me that somehow the same thread calls forward at the same time
both locally and remotely and that throws NPE.
The message is:
java.lang.NullPointerException
at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:114)
at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:90)
at StateMessageBean.sendMessage(StateMessageBean.java:109)
at StateMessageBean.subroundEnded(StateMessageBean.java:87)
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:361)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
at com.sun.proxy.$Proxy25.subroundEnded(Unknown Source)
at CoordinatorProcessor.collectIncreaseOfC(CoordinatorProcessor.java:332)
at CoordinatorProcessor.process(CoordinatorProcessor.java:119)
at CoordinatorProcessor.process(CoordinatorProcessor.java:25)
at org.apache.kafka.streams.processor.internals.ProcessorNode$1.run(ProcessorNode.java:50)
at org.apache.kafka.streams.processor.internals.ProcessorNode.runAndMeasureLatency(ProcessorNode.java:244)
at org.apache.kafka.streams.processor.internals.ProcessorNode.process(ProcessorNode.java:133)
at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:143)
at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:126)
at org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:90)
at org.apache.kafka.streams.processor.internals.SourceNode.process(SourceNode.java:87)
at org.apache.kafka.streams.processor.internals.StreamTask.process(StreamTask.java:302)
at org.apache.kafka.streams.processor.internals.AssignedStreamsTasks.process(AssignedStreamsTasks.java:94)
at org.apache.kafka.streams.processor.internals.TaskManager.process(TaskManager.java:409)
at org.apache.kafka.streams.processor.internals.StreamThread.processAndMaybeCommit(StreamThread.java:964)
at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:832)
at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:767)
at org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:736)
The two methods that I call remotely and locally are:
//remote method
#Override
public void subroundEnded()
{
PhiMessage newPhiMessage = new PhiMessage();
newPhiMessage.setSiteId(this.siteId);
newPhiMessage.setCurrentRound(this.currentRound);
newPhiMessage.setCurrentSubround(this.currentSubround);
newPhiMessage.setPhi(this.phi);
byte[] byteNewPhiMessage = SerializationUtils.serialize(newPhiMessage);
this.processorContext.forward("PhiMessage", byteNewPhiMessage);
}
//local method
public void sendIncrease()
{
IncreaseMessage increaseMessage = new IncreaseMessage();
increaseMessage.setCurrentRound(this.currentRound);
increaseMessage.setCurrentSubround(this.currentSubround);
increaseMessage.setIncrease(this.increase);
byte[] byteIncreaseMessage = SerializationUtils.serialize(increaseMessage);
this.processorContext.forward("IncreaseMessage", byteIncreaseMessage);
}
Related
I have a mod that is not executing receive packet events when I run
#Cancelable public class ReceivePacketEvent extends Event { public Packet<?> packet; public ReceivePacketEvent(Packet<?> packet) { System.out.println("PKT"); this.packet = packet; } }
Nothing will happen. Other events will work like on render or tick event but packet wont work. for reference I'm using this mod in a server
I get an error seemingly randomly that looks like this and im not sure where it comes from or if it affects the packet event so id say im lost
[01:22:45] [main/FATAL] (Minecraft) Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_351]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_351]
at net.minecraft.util.Util.runTask(Util.java:43) [Util.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:987) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:443) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:111) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_351]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_351]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_351]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_351]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) [dev-launch-injector-0.2.1+build.8.jar:?]
Caused by: java.lang.NullPointerException
at net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:240) ~[Scoreboard.class:?]
at net.minecraft.client.network.NetHandlerPlayClient.handleTeams(NetHandlerPlayClient.java:1452) ~[NetHandlerPlayClient.class:?]
at net.minecraft.network.play.server.S3EPacketTeams.processPacket(S3EPacketTeams.java:114) ~[S3EPacketTeams.class:?]
at net.minecraft.network.play.server.S3EPacketTeams.processPacket(S3EPacketTeams.java:36) ~[S3EPacketTeams.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_351]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_351]
at net.minecraft.util.Util.runTask(Util.java:42) ~[Util.class:?]
... 10 more
I have a partitioned job that reads from and writes to a DB. I have a chunking size of 10. If a partition fails and i want the restart to happen from the last commit, I have overwritten the checkpointinfo method and wrote my logic according to my application requirement. whenever i try to restart the failed job, i am getting an exception that there is failure in Read-Process-Write Loop
Here is the exception logs:
[3/1/18 19:18:09:004 IST] [process partition0] com.ibm.ws.batch.JobLogger CWWKY0030I: An exception occurred while running the step process.
com.ibm.jbatch.container.exception.BatchContainerRuntimeException: Failure in Read-Process-Write Loop
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:704)
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.invokeCoreStep(ChunkStepControllerImpl.java:795)
at com.ibm.jbatch.container.controller.impl.BaseStepControllerImpl.execute(BaseStepControllerImpl.java:293)
at com.ibm.jbatch.container.controller.impl.ExecutionTransitioner.doExecutionLoop(ExecutionTransitioner.java:118)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl.executeCoreTransitionLoop(WorkUnitThreadControllerImpl.java:93)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl.executeWorkUnit(WorkUnitThreadControllerImpl.java:155)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl$AbstractControllerHelper.runExecutionOnThread(WorkUnitThreadControllerImpl.java:480)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl.runExecutionOnThread(WorkUnitThreadControllerImpl.java:89)
at com.ibm.jbatch.container.util.BatchWorkUnit.run(BatchWorkUnit.java:117)
at com.ibm.ws.context.service.serializable.ContextualRunnable.run(ContextualRunnable.java:79)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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: com.ibm.jbatch.container.exception.BatchContainerRuntimeException: java.lang.ClassNotFoundException: [B
at com.ibm.jbatch.container.util.TCCLObjectInputStream.resolveClass(TCCLObjectInputStream.java:40)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1671)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.access$300(ObjectInputStream.java:208)
at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2182)
at java.io.ObjectInputStream.readFields(ObjectInputStream.java:543)
at java.math.BigInteger.readObject(BigInteger.java:4406)
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:498)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
at java.util.HashMap.readObject(HashMap.java:1404)
at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
at java.util.HashMap.readObject(HashMap.java:1404)
at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
at com.ibm.jbatch.container.persistence.CheckpointData.<init>(CheckpointData.java:47)
at com.ibm.jbatch.container.persistence.jpa.StepThreadInstanceEntity.getCheckpointData(StepThreadInstanceEntity.java:131)
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.openReaderAndWriter(ChunkStepControllerImpl.java:935)
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:599)
... 14 more
Caused by: java.lang.ClassNotFoundException: [B
at com.ibm.ws.classloading.internal.UnifiedClassLoader.findClass(UnifiedClassLoader.java:119)
at com.ibm.ws.classloading.internal.ThreadContextClassLoader.findClass(ThreadContextClassLoader.java:120)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at com.ibm.ws.classloading.internal.UnifiedClassLoader.loadClass0(UnifiedClassLoader.java:107)
at com.ibm.ws.classloading.internal.UnifiedClassLoader$Delegation.loadClass(UnifiedClassLoader.java:78)
at com.ibm.ws.classloading.internal.UnifiedClassLoader.loadClass(UnifiedClassLoader.java:102)
at com.ibm.ws.classloading.internal.ThreadContextClassLoader.loadClass(ThreadContextClassLoader.java:136)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.ibm.jbatch.container.util.TCCLObjectInputStream.resolveClass(TCCLObjectInputStream.java:38)
... 57 more
[3/1/18 19:18:09:005 IST] [process partition0] com.ibm.ws.batch.JobLogger CWWKY0014W: Partition 0 failed with batch status FAILED and exit status null for step process for job instance 105,001 and job execution 105,008.
[3/1/18 19:18:15:588 IST] [process partition0] com.ibm.ws.batch.JobLogger
Here are my code snippet
Item Reader
#Override
public Serializable checkpointInfo() throws Exception {
Checkpoint checkpoint=new Checkpoint();
for (CheckpointProperty prop:dbOp.getCheckpointInfo().getProperty()) {
final Object result = ExprUtils.evaluate(newProps,prop.getCheckpointValue().toString());
checkpoint.addCheckPoint(prop.getName(), result); } return checkpoint;
}
Item writer
#Override
public Serializable checkpointInfo() throws Exception {
final Properties checkpointInfo = new Properties();
for (String key : checkpointProps.stringPropertyNames()) {
final String expr = checkpointProps.getProperty(key);
final Object result = ExprUtils.evaluate(dataMap, expr);
checkpointInfo.setProperty(key, result.toString());
}
return checkpointInfo;
}
Checkpoint class
----------------------
public class Checkpoint implements Serializable {
private HashMap<String, Object> checkpoints = new HashMap();
public void reset() {
this.checkpoints.clear();
}
public void addCheckPoint(String stream, Object position) {
this.checkpoints.put(stream, position);
}
public Object get(String stream) {
return this.checkpoints.get(stream);
}
public HashMap<String, Object> getCheckpoints() {
return this.checkpoints;
}
}
This is because of the BigInteger Datatype used in oracle.
This appears to be a bug in Liberty. Opened issue #2792.
I think it will happen with any array type, and that you could workaround by using an ArrayList in place of an array.
UPDATE: A fix for this issue was delivered in 18.0.0.2.
Hi I currently have an WAS 7.0.29 and we've planned to update it to fix pack 41.
Upon the installation of the Fix pack I have encountered this:
[11/10/16 19:32:24:505 SGT] 00000000 UserRegistryC E SECJ0281E: Error creating user registry object. The exception is java.lang.NoClassDefFoundError: com.dummy.registry.CustomRegistry (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:139)
at java.lang.Class.forName(Class.java:294)
at com.ibm.ws.security.registry.UserRegistryImpl.initialize(UserRegistryImpl.java:225)
at com.ibm.ws.security.config.UserRegistryConfigImpl.do_createRegistryObjects(UserRegistryConfigImpl.java:686)
at com.ibm.ws.security.config.UserRegistryConfigImpl.createRegistryObjects(UserRegistryConfigImpl.java:643)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getUserRegistryImpl(UserRegistryConfigImpl.java:628)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getString(UserRegistryConfigImpl.java:850)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getPrincipalName(UserRegistryConfigImpl.java:577)
at com.ibm.ws.security.config.CSIv2ConfigImpl.initializeOnServer(CSIv2ConfigImpl.java:723)
at com.ibm.ws.security.config.CSIv2ConfigImpl.initialize(CSIv2ConfigImpl.java:1151)
at com.ibm.ws.security.config.CSIv2ConfigImpl.<init>(CSIv2ConfigImpl.java:100)
at com.ibm.ws.security.config.SecurityConfigObjectFactoryImpl.createCSIv2Config(SecurityConfigObjectFactoryImpl.java:116)
at com.ibm.ws.security.config.SecurityObjectLocator.do_getCSIv2Config(SecurityObjectLocator.java:852)
at com.ibm.ejs.ras.RasHelper.printStackTrace(RasHelper.java:368)
at com.ibm.ejs.ras.RasHelper.throwableToString(RasHelper.java:349)
at com.ibm.ejs.ras.MessageEvent6.convertParameters(MessageEvent6.java:346)
at com.ibm.ejs.ras.MessageEvent6.<init>(MessageEvent6.java:221)
at com.ibm.ejs.ras.Tr.fireMessageEvent(Tr.java:1538)
at com.ibm.ejs.ras.Tr.error(Tr.java:733)
at com.ibm.ws.security.config.UserRegistryConfigImpl.do_createRegistryObjects(UserRegistryConfigImpl.java:696)
at com.ibm.ws.security.config.UserRegistryConfigImpl.createRegistryObjects(UserRegistryConfigImpl.java:643)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getUserRegistryImpl(UserRegistryConfigImpl.java:628)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getString(UserRegistryConfigImpl.java:850)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getPrincipalName(UserRegistryConfigImpl.java:577)
at com.ibm.ws.security.config.CSIv2ConfigImpl.initializeOnServer(CSIv2ConfigImpl.java:723)
at com.ibm.ws.security.config.CSIv2ConfigImpl.initialize(CSIv2ConfigImpl.java:1151)
at com.ibm.ws.security.config.CSIv2ConfigImpl.<init>(CSIv2ConfigImpl.java:100)
at com.ibm.ws.security.config.SecurityConfigObjectFactoryImpl.createCSIv2Config(SecurityConfigObjectFactoryImpl.java:116)
at com.ibm.ws.security.config.SecurityObjectLocator.do_getCSIv2Config(SecurityObjectLocator.java:852)
at com.ibm.ws.security.config.SecurityObjectLocator.getCSIv2Config(SecurityObjectLocator.java:882)
at com.ibm.ws.security.config.SecurityObjectLocator.getCSIv2Config(SecurityObjectLocator.java:873)
at com.ibm.ws.security.auth.ContextManagerImpl.getProperty(ContextManagerImpl.java:2102)
at com.ibm.ws.security.auth.ContextManagerImpl.getProperty(ContextManagerImpl.java:2141)
at com.ibm.websphere.security.WSSecurityException.printStackTrace(WSSecurityException.java:230)
at com.ibm.ffdc.util.formatting.IncidentReportHeader.writeTo(IncidentReportHeader.java:77)
at com.ibm.ffdc.util.provider.IncidentStream.write(IncidentStream.java:207)
at com.ibm.ffdc.util.provider.IncidentLogger.writeHeader(IncidentLogger.java:70)
at com.ibm.ffdc.util.provider.IncidentLogger.writeIncidentTo(IncidentLogger.java:61)
at com.ibm.ws.ffdc.impl.FfdcProvider.logIncident(FfdcProvider.java:206)
at com.ibm.ws.ffdc.impl.FfdcProvider.logIncident(FfdcProvider.java:135)
at com.ibm.ffdc.util.provider.FfdcProvider.log(FfdcProvider.java:259)
at com.ibm.ws.ffdc.impl.FfdcProvider.log(FfdcProvider.java:148)
at com.ibm.ffdc.util.provider.IncidentEntry.log(IncidentEntry.java:105)
at com.ibm.ffdc.util.provider.Ffdc.log(Ffdc.java:90)
at com.ibm.ws.ffdc.FFDCFilter.processException(FFDCFilter.java:114)
at com.ibm.ws.security.config.UserRegistryConfigImpl.do_createRegistryObjects(UserRegistryConfigImpl.java:694)
at com.ibm.ws.security.config.UserRegistryConfigImpl.createRegistryObjects(UserRegistryConfigImpl.java:643)
at com.ibm.ws.security.config.UserRegistryConfigImpl.getUserRegistryImpl(UserRegistryConfigImpl.java:628)
at com.ibm.ws.security.core.distSecurityComponentImpl.getRealmFromUserRegistry(distSecurityComponentImpl.java:2808)
at com.ibm.ws.security.core.distSecurityComponentImpl.initialize(distSecurityComponentImpl.java:356)
at com.ibm.ws.security.core.SecurityComponentImpl.initialize(SecurityComponentImpl.java:94)
at com.ibm.ws.runtime.component.ContainerHelper.initWsComponent(ContainerHelper.java:1191)
at com.ibm.ws.runtime.component.ContainerHelper.initializeComponent(ContainerHelper.java:1098)
at com.ibm.ws.runtime.component.ContainerHelper.initializeComponents(ContainerHelper.java:900)
at com.ibm.ws.runtime.component.ContainerImpl.initializeComponents(ContainerImpl.java:776)
at com.ibm.ws.runtime.component.ContainerImpl.initializeComponents(ContainerImpl.java:750)
at com.ibm.ws.runtime.component.ServerImpl.initialize(ServerImpl.java:349)
at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:280)
at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:214)
at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:666)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:981)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:341)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:111)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:221)
at com.ibm.websphere.ras.Manager.createRASTraceLogger(Manager.java:241)
at com.dummy.registry.CustomRegistry.<clinit>(CustomRegistry.java:126)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:199)
at java.lang.Class.forName(Class.java:294)
at com.ibm.ws.security.registry.UserRegistryImpl.initialize(UserRegistryImpl.java:225)
at com.ibm.ws.security.config.UserRegistryConfigImpl.do_createRegistryObjects(UserRegistryConfigImpl.java:686)
... 36 more
Caused by: java.security.AccessControlException: Access denied (java.util.PropertyPermission com.ibm.ws.ffdc.SupportORBFFDC read)
at java.security.AccessController.throwACE(AccessController.java:121)
at java.security.AccessController.checkPermission(AccessController.java:194)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1293)
at java.lang.System.getProperty(System.java:404)
at java.lang.System.getProperty(System.java:388)
at com.ibm.websphere.ras.WsJrasTraceLogger.<clinit>(WsJrasTraceLogger.java:98)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:199)
... 43 more
.
My guess is that the issue is in the CustomRegistry that we have made which looks like this:
public class CustomRegistry implements UserRegistry {
protected static RASTraceLogger traceLogger;
private static RASMessageLogger msgLogger;
static {
Manager mgr = Manager.getManager();
traceLogger = mgr.createRASTraceLogger("MyWebsite", "Authentication", "Registry", CustomRegistry.class.getName());
msgLogger = mgr.createRASMessageLogger("MyWebsite", "Authentication", "Registry", CustomRegistry.class.getName());
msgLogger.setMessageFile("com.dummy.registry.RegistryMessages");
}
It points the usage of mgr.createRASTraceLogger in the CustomRegistry but I'm not sure what is the right approach for it.
Right now, I can't even start my server.
Your suggestions will be a great help! :)
When doing a remote EJB lookup (from JBoss 4.3) in J2SE, I'm encountering the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: LLog;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2499)
at java.lang.Class.getDeclaredField(Class.java:1951)
at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1659)
at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:72)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:480)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:468)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:468)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:365)
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:602)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1622)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1706)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1344)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at java.rmi.MarshalledObject.get(MarshalledObject.java:159)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:737)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:654)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.example.ShoppingBasketServiceClient.main(ShoppingBasketServiceClient.java:44)
Caused by: java.lang.ClassNotFoundException: Log
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 32 more
Here is teh codez, line 44 is the one doing the lookup:
package com.example;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class ShoppingBasketServiceClient {
public static void main(String[] args) throws NamingException {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
props.setProperty("java.naming.provider.url", "jnp://localhost:1099");
String Lookup = "ejb/ShoppingBasketService/remote";
try {
InitialContext ic = new InitialContext(props);
// ShoppingBasketServiceRemote shoppingBasketService = (ShoppingBasketServiceRemote) ic.lookup(Lookup);
Object shoppingBasketService = (Object) ic.lookup(Lookup);
} catch (NamingException e) {
System.out.println("Exception:" + e);
}
}
}
I'm confused as to why it's looking for a Log class (and why the exception is not package-qualified)?
ShoppingBasketServiceRemote is just an interface that imports the javax.ejb.Remote annotation and extends another interface - neither make any reference to a Log class? Additionally, you'll see my example only casts the result to Object (but the result is the same if I swap out for the service interface)?
ShoppingBasketServiceRemote is just an interface that imports the
javax.ejb.Remote annotation and extends another interface - neither
make any reference to a Log class?
Examine all the objects referenced in the interface & their
transitive dependencies. Something will point to the "Log" class.
Also check the remote server for errors, maybe the error is on the
remote server
Try doing a simple
Class.forName("ShoppingBasketServiceRemote") - you might see it failing with the same error.
Additionally, you'll see my example only casts the result to Object
(but the result is the same if I swap out for the service interface)?
Casting the object happens after your jvm is able to load the object returned by ic.lookup(Lookup) - so the error will happen whether you cast or not.
I have simple client based on Jersey framework.
I want to use Genson as default JSON provider.
Firstly I created some class which implemented ContextResolver:
#Provider
public class GensonCustomResolver implements ContextResolver<Genson> {
private final Genson genson = new Genson.Builder().setSkipNull(true).setDateFormat(new UtcDateFormat()).create();
#Override
public Genson getContext(Class<?> type) {
return genson;
}
}
And UtcDateFormat class:
public class UtcDateFormat extends DateFormat {
#Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return new StringBuffer("" + date.getTime());
}
#Override
public Date parse(String source, ParsePosition pos) {
return new Date(Long.parseLong(source));
}
}
Then I used this:
ClientConfig cfg = new DefaultClientConfig(GensonCustomResolver.class);
Client client = Client.create(cfg);
Integer meetingId = 1;
Meeting result = client.resource("http://mywebservise.com/").path("meeting")
.path(meetingId.toString()).get(ClientResponse.class).getEntity(Meeting.class);
But, it failed. Here are log:
javax.ws.rs.WebApplicationException: com.owlike.genson.TransformationException: Could not deserialize to property 'created' of class class com.mypack.model.Meeting
at com.owlike.genson.ext.jaxrs.GensonJsonConverter.readFrom(GensonJsonConverter.java:127)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:565)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:517)
at com.mypack.ws.MeetingsTest.getItem(MeetingsTest.java:159)
at com.mypack.ws.MeetingsTest.getItem(MeetingsTest.java:68)
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:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:659)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1032)
at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:110)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:58)
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:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:113)
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:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.owlike.genson.TransformationException: Could not deserialize to property 'created' of class class com.mypack.model.Meeting
at com.owlike.genson.reflect.PropertyMutator.couldNotDeserialize(PropertyMutator.java:56)
at com.owlike.genson.reflect.PropertyMutator.deserialize(PropertyMutator.java:39)
at com.owlike.genson.reflect.BeanDescriptor.deserialize(BeanDescriptor.java:116)
at com.owlike.genson.reflect.BeanDescriptor.deserialize(BeanDescriptor.java:98)
at com.owlike.genson.convert.NullConverter$NullConverterWrapper.deserialize(NullConverter.java:61)
at com.owlike.genson.Genson.deserialize(Genson.java:452)
at com.owlike.genson.ext.jaxrs.GensonJsonConverter.readFrom(GensonJsonConverter.java:125)
... 48 more
Caused by: com.owlike.genson.TransformationException: Could not parse date 1432800716000
at com.owlike.genson.convert.DefaultConverters$DateConverter.deserialize(DefaultConverters.java:824)
at com.owlike.genson.convert.DefaultConverters$DateConverter.deserialize(DefaultConverters.java:788)
at com.owlike.genson.convert.NullConverter$NullConverterWrapper.deserialize(NullConverter.java:61)
at com.owlike.genson.reflect.PropertyMutator.deserialize(PropertyMutator.java:37)
... 53 more
Caused by: java.text.ParseException: Unparseable date: "1432800716000"
at java.text.DateFormat.parse(DateFormat.java:357)
at com.owlike.genson.convert.DefaultConverters$DateConverter.read(DefaultConverters.java:830)
at com.owlike.genson.convert.DefaultConverters$DateConverter.deserialize(DefaultConverters.java:822)
... 56 more
What's wrong?
P.S. Jersey client 1.8
Genson 0.98
You should upgrade to the latest Genson version, there have been some improvements and providing a custom instance to jersey is easier.
In the newer versions, Genson will automatically detect if the input is the time in millis or a date string and deser it accordingly.
The dateformat registered with useDateFormat(...) will be used during deserialization, but this will also serialize the dates as strings. If you want to serialize them as a long (which is the default in the newever versions), you have define it with useDateAsTimestamp(true).
I hope this makes things a bit more clear. You can have a look at the config options for more details.