JMS - Sending object message - jms

I want to send object message in jms and getting run time exception.
Please suggest me possible solutions.
JMS Code:
ObjectMessage objMessage = session.createObjectMessage();
MessageData data = new MessageData();
objMessage.setObject(data);
sender.send(objMessage);
Exception found on console:
log4j:WARN No appenders could be found for logger org.jboss.remoting.transport.socket.MicroSocketClientInvoker).
log4j:WARN Please initialize the log4j system properly.
java.lang.RuntimeException: com.test.SendJMSMessage
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at org.jboss.messaging.util.StreamUtils.writeObject(StreamUtils.java:249)
at org.jboss.jms.message.JBossObjectMessage.doWriteObject(JBossObjectMessage.java:141)
at org.jboss.messaging.core.impl.message.MessageSupport.getPayloadAsByteArray(MessageSupport.java:216)
at org.jboss.jms.message.JBossObjectMessage.setObject(JBossObjectMessage.java:118)
at org.jboss.jms.message.ObjectMessageProxy.setObject(ObjectMessageProxy.java:59)
at com.test.SendJMSMessage.example(SendJMSMessage.java:36)
at com.test.SendJMSMessage.main(SendJMSMessage.java:130)
After creating new MessageData class in place of creating subclass MessageData, when I run the code I got exceptions as below:
18:26:08,297 ERROR [JmsGatewayListener] Problems invoking method <process>
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.soa.esb.listeners.gateway.JmsGatewayListener.doRun(JmsGatewayListener.java:161)
at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: No ClassLoaders found for: com.test.MessageData
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.io.ObjectInputStream.resolveClass(Unknown Source)
at org.jboss.messaging.util.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:78)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.jboss.messaging.util.StreamUtils.readObject(StreamUtils.java:154)
at org.jboss.messaging.core.impl.message.MessageSupport.readPayload(MessageSupport.java:405)
at org.jboss.jms.message.JBossObjectMessage.getObject(JBossObjectMessage.java:126)
at org.jboss.jms.message.ObjectMessageProxy.getObject(ObjectMessageProxy.java:68)
at org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents.setESBMessageBody(PackageJmsMessageContents.java:165)
at org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents.process(PackageJmsMessageContents.java:89)
... 7 more
Here I am trying to send an object message to esb server code.
Any suggestions on console window as above please?

The exception is at "the other side":
at java.io.ObjectInputStream.resolveClass(Unknown Source)
at org.jboss.messaging.util.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:78)
So you did send the message, but you are unable to deserialize it at the other end. Why? Because the "other side" does not have the class definition of MessageData in its classpath. If it's a different application, you need to extract MessageData to a common jar and have it included in both applications.
Serialization is no magic; both serializing and deserializing party must have access to the same class definition (.class file) and their versions must be the same, or at least compatible.

Your class MessageData needs to implement java.io.Serializable. Could that be the issue? There should be an additional "cause" exception stack trace.

Related

spring redis running script : how to pass expiry time value

I use the lua script:
local lock = redis.call('get', KEYS[1])
if not lock then
return redis.call('SETEX', KEYS[1], ARGV[1] ,ARGV[2] );
end
return false
From spring boot application I use to call redis with the script
DefaultRedisScript<Boolean> redisScript = new
DefaultRedisScript<Boolean>();
redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("checkandset2.lua")));
redisScript.setResultType(Boolean.class);
System.out.println(redisTemplate.execute(redisScript , Collections.singletonList("value123"),"10" ,"key123"));
I always get exception :
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.springframework.data.redis.serializer.StringRedisSerializer.serialize(StringRedisSerializer.java:32)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.keysAndArgs(DefaultScriptExecutor.java:116)
at org.springframework.data.redis.core.script.DefaultScriptExecutor$1.doInRedis(DefaultScriptExecutor.java:63)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:202)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:164)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:60)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:54)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:298)
at com.masary.ledger.ResisScriptTestClass.msisdnJustRechargedException(ResisScriptTestClass.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
When I use
System.out.println(redisTemplate.execute(redisScript ,
Collections.singletonList("value123"),new Long(10) ,"key123"));
I get exception
org.springframework.data.redis.RedisSystemException: Unknown redis exception; nested exception is java.lang.ClassCastException: [B cannot be cast to java.lang.Long
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.getFallback(FallbackExceptionTranslationStrategy.java:48)
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:38)
at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:212)
at org.springframework.data.redis.connection.jedis.JedisConnection.evalSha(JedisConnection.java:3173)
at org.springframework.data.redis.connection.jedis.JedisConnection.evalSha(JedisConnection.java:3158)
at org.springframework.data.redis.connection.DefaultStringRedisConnection.evalSha(DefaultStringRedisConnection.java:1374)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.data.redis.core.CloseSuppressingInvocationHandler.invoke(CloseSuppressingInvocationHandler.java:57)
at com.sun.proxy.$Proxy182.evalSha(Unknown Source)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.eval(DefaultScriptExecutor.java:81)
at org.springframework.data.redis.core.script.DefaultScriptExecutor$1.doInRedis(DefaultScriptExecutor.java:71)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:202)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:164)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:60)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:54)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:298)
at com.masary.ledger.ResisScriptTestClass.msisdnJustRechargedException(ResisScriptTestClass.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
.
.
Caused by: java.lang.ClassCastException: [B cannot be cast to java.lang.Long
at org.springframework.data.redis.connection.jedis.JedisScriptReturnConverter.convert(JedisScriptReturnConverter.java:53)
at org.springframework.data.redis.connection.jedis.JedisConnection.evalSha(JedisConnection.java:3171)
... 46 more
any advice how can I pass expiry time value to the lua script?
I'm a newbie myself, and was having a similar problem. Try sending the string "10", instead of the Long. Worked for me.
The thread might be old, but might be helpful for others who might stumble upon this.
For me, the reason was using JdkSerializationRedisSerializer as value serializer, like: redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()), this is also the default.
To fix this, see below the fix:
private static void redisEvalForExpire(String scriptText, List<String> keys, Object[] argv) {
// since spring boot serializes data to - "\xac\xed\x00\x05t\x00\x0" it was not being recognized by redis as integer
redisTemplate.execute(new DefaultRedisScript<>(scriptText), new StringRedisSerializer(), new StringRedisSerializer(), keys, argv);
}
This says use StringRedisSerializer for any value, so when we do - set a 2, using JdkSerializationRedisSerializer, 2 serialized to something like:
"\xac\xed\x00\x05sr\x00\x11java.lang.Integer\x12\xe2\xa0\xa4\xf7\x81\x878\x02\x00\x01I\x00\x05valuexr\x00\x10java.lang.Number\x86\xac\x95\x1d\x0b\x94\xe0\x8b\x02\x00\x00xp\x00\x00\x00\x02"
but when we say use StringRedisSerializer, 2 is sent as "2", which Redis can easily recognize.
Official Documentation

How to add Richfx in a layout

I have been trying to add an InlineStyleTextArea and a CodeArea in anylayout both in the main method in javafx and in a fxml file. I receive a thread error. Please if possible with examples how can i add these components to a javafx layout? If possible with a tutorial link.
This is a simple code
public class Main extends Application {
#Override
public void start(Stage primaryStage) {
TextField myTextField = new TextField();
InlineCssTextArea TextArea = new InlineCssTextArea();
HBox hbox = new HBox();
hbox.getChildren().add(myTextField);
hbox.getChildren().add(TextArea);
HBox.setHgrow(myTextField, Priority.ALWAYS);
HBox.setHgrow(TextArea, Priority.ALWAYS);
Scene scene = new Scene(hbox);
primaryStage.setScene(scene);
primaryStage.show();}
public static void main(String[] args) {
launch(args);
}
}
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/reactfx/value/SuspendableVal
at application.Main.start(Main.java:20)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(Unknown Source)
at com.sun.javafx.application.LauncherImpl$$Lambda$53/19776028.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$45/18503843.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/3799573.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/2180324.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$36/3326003.run(Unknown Source)
... 1 more
Caused by: java.lang.ClassNotFoundException: org.reactfx.value.SuspendableVal
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
Exception running application application.Main
at com.sun.javafx.application.LauncherImpl$$Lambda$50/14845382.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
From the stack trace, it looks like the Java Runtime can't find (at least one class in) the ReactFX library, which is a dependency of RichTextFX. Since it gets as far as looking for that, it must have found InlineCssTextArea, so the RichTextFX library must be installed.
If you are using some kind of dependency management (Gradle or Maven, for example), that tool should manage all the dependencies for you.
If you are managing the dependencies by hand (i.e. downloading jar files and adding them to the classpath), you need to make sure you either download all the dependent jar files as well, or use the "Fat jar file".

AutoReconfigurationServletContainerInitializer could not be instantiated

I am deploying a Java EE app to Bluemix, and when first request arrives I got this error:
2015-05-20T23:11:58.51+0200 [App/0] OUT [INFO ] FFDC1015I: An
FFDC Incident has been created: "java.util.ServiceConfigurationError:
javax.servlet.ServletContainerInitializer: Provider
org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer
could not be instantiated
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost startWebApp" at
ffdc_15.05.20_21.11.58.0.log
It is a piece of code from Liberty Buildpack I think.
Here it is the content file ffdc_15.05.20_21.11.58.0.log (it seems a ClassNotFoundException but as it is not part of my app I don't know what to do):
Exception = java.util.ServiceConfigurationError Source =
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost probeid = startWebApp
Stack Dump = java.util.ServiceConfigurationError:
javax.servlet.ServletContainerInitializer: Provider
org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer
could not be instantiated at java.util.ServiceLoader.fail(Unknown
Source) at java.util.ServiceLoader.access$100(Unknown Source) at
java.util.ServiceLoader$LazyIterator.next(Unknown Source) at
java.util.ServiceLoader$1.next(Unknown Source) at
com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2454)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1038)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6396)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313)
at
com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251)
at
com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:449)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:383)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:283)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:254)
at
com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at
com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) Caused by:
java.lang.NoClassDefFoundError:
org.springframework.context.ApplicationContextInitializer at
java.lang.ClassLoader.defineClassImpl(Native Method) at
java.lang.ClassLoader.defineClass(Unknown Source) at
com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:297)
at
com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:241)
at java.lang.ClassLoader.loadClassHelper(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:390)
at
com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:362)
at java.lang.ClassLoader.loadClass(Unknown Source) at
org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer.(AutoReconfigurationServletContainerInitializer.java:33)
at java.lang.J9VMInternals.newInstanceImpl(Native Method) at
java.lang.Class.newInstance(Unknown Source) ... 23 more Caused by:
java.lang.ClassNotFoundException:
org.springframework.context.ApplicationContextInitializer at
com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:412)
at
com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:246)
at java.lang.ClassLoader.loadClassHelper(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:390)
at
com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:362)
at java.lang.ClassLoader.loadClass(Unknown Source) ... 35 more
Thanks!
I suppose your application is using Spring Framework, and this triggers the Spring Auto-Reconfiguration. If you don't need this auto-reconfiguration support, you can disable it by setting the below environment variable for your application and do a restage:
cf set-env <app-name> JBP_CONFIG_SPRINGAUTORECONFIGURATION "enabled: false"
cf restage <app-name>

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b spring mail application

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b
at javax.crypto.KeyGenerator.a(DashoA13*..)
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(Unknown Source)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:114)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1562)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1551)
at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:935)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:426)
at javax.mail.Service.connect(Service.java:288)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336)
at com.javapapers.spring.SpringMailSender.sendMail(SpringMailSender.java:50)
at com.javapapers.spring.SpringEmail.main(SpringEmail.java:12)
I am trying send email using spring, i am getting this type of Exception

How to debug a beanshell script?

I have troubles to debug a beanshell script all I get all the time is:
Exception invoking imported object method. : at Line: 194 : in file: inline evaluation of: ``import java.lang.reflect.InvocationTargetException; import java.util.Arrays; i . . . '' : migrateModels ( models , apiManager , isSAPRetailImportCondition , isSAPAFSCondition )
Called from method: initMissingImportSources : at Line: -1 : in file: :
Target exception: java.lang.reflect.InvocationTargetException
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.Name.invokeLocalMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BshMethod.invokeImpl(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.This.invokeMethod(Unknown Source)
at ImportSourceMigration.initMissingImportSources(BeanShell Generated via ASM (www.objectweb.org))
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at bsh.Reflect.invokeMethod(Unknown Source)
at bsh.Reflect.invokeObjectMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHTryStatement.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.servlet.BshServlet.evalScript(Unknown Source)
at bsh.servlet.BshServlet.doGet(Unknown Source)
I am trying to retrieve the full stack trace with this code
try {
migration.initMissingImportSources();
} catch (java.lang.Throwable e) {
print(ExceptionUtils.getFullStackTrace(e));
}
Is there a possibility to retrieve the causing exception?
Thanks a lot.
What is you "ExceptionUtils.getFullStackTrace()" really doing? Are you sure it's printing the nested exception?
Thanks a lot for the reply. Yes the getFullStackTrace is from apache commons and should work. I found the problem. The point is here that I didnt have the complete script in one method call. This is important, only then you are able to surround it with a try catch and see the exception. Hope that will helpful for the others in the future too. I see the exception now. I had several methods calling each other.

Resources