Java Casting Error Using CFPOP - java

My CF9 application running on a windows server pops mail. When I attempt to retrieve the entire body of the message, I sometimes get the following error...
Error:
An exception occurred while retrieving mail.
The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Location:
Line 335 in controllers\Submissions.cfc
Not sure if this is pertinent, but FYI every message will have an image attached and the whole process usually works fine. This problem is intermittent.
My Questions
Any idea what causes this?
Any idea how to catch and resolve this issue?
I suspect I'll need to drop down into java, but not sure where to start.
Code Fragments
<cfscript>
// setup variables array for all cfpop calls
CFPopAttributes = {
server = request.pop.server,
port = request.pop.port,
username = request.pop.username,
password = request.pop.password,
timeout = 300
};
</cfscript>
<cfpop
action="getall"
name="entireEmail"
uid="#uid#"
attachmentpath="#originalsPath#"
attributecollection="#CFPopAttributes#" // Line 335
generateuniquefilenames="true"
/>
NOTE: I added the comment "Line 335" above to communicate exactly where in the code the template is breaking. If I move the attributecollection up or down (before/after other attributes), the error always breaks at the attributecollection line.
Stack Trace
struct [Filtered - 1 of 8 keys hidden]
Detail: An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest.
Message: Event handler exception.
RootCause:
[struct]
Detail: The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
Message: An exception occurred while retrieving mail.
RootCause:
[struct]
Message: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
StackTrace: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
at coldfusion.mail.EmailTable.getAttachmentName(EmailTable.java:819)
at coldfusion.mail.EmailTable.populate(EmailTable.java:283)
at coldfusion.mail.PopImpl.getMails(PopImpl.java:241)
at coldfusion.tagext.net.PopTag$1.run(PopTag.java:433)
at java.security.AccessController.doPrivileged(Native Method)
at coldfusion.tagext.net.PopTag.doStartTag(PopTag.java:429)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799)
at cfSubmissions2ecfc1952269377$funcGETEMAIL.runFunction(D:\home\wwwroot\controllers\Submissions.cfc:335)

Related

how to start with Iota-Java?

I want to write a simple app to save messages in the Iota-Tangle and read them again.
How should I configure the API so that the messages are visible in the mainnet or devnet (Tangle Explorer) after I send them ?
that means, I just want to send a message / transaction, and then see it in the tangle at https://thetangle.org/...
i hope there is someone here who knows about iota-
this Api-config does not work..
IotaAPI api = new IotaAPI.Builder()
.protocol("https")
.host("thetangle.org")
.port(443)
.localPoW(new PearlDiverLocalPoW())
.build();
SendTransferResponse response = api.sendTransfer( ...... );
And I get this Error
Execution of the API call raised exception. IOTA Node not reachable?
com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1597)
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1404)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:593)
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:206)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:225)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
at org.iota.jota.connection.HttpConnector.wrapCheckedException(HttpConnector.java:244)
at org.iota.jota.connection.HttpConnector.getTransactionsToApprove(HttpConnector.java:333)
at org.iota.jota.IotaAPICore.getTransactionsToApprove(IotaAPICore.java:449)
at org.iota.jota.IotaAPI.sendTrytes(IotaAPI.java:344)
at org.iota.jota.IotaAPI.sendTransfer(IotaAPI.java:1126)
at com.example.iota_experiment_3.Main.main(Main.java:60)
Exception in thread "main" java.lang.IllegalStateException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
at org.iota.jota.connection.HttpConnector.wrapCheckedException(HttpConnector.java:272)
at org.iota.jota.connection.HttpConnector.getTransactionsToApprove(HttpConnector.java:333)
at org.iota.jota.IotaAPICore.getTransactionsToApprove(IotaAPICore.java:449)
at org.iota.jota.IotaAPI.sendTrytes(IotaAPI.java:344)
at org.iota.jota.IotaAPI.sendTransfer(IotaAPI.java:1126)
at com.example.iota_experiment_3.Main.main(Main.java:60)

JMS error : Error while deserialising an object

Getting Following strange exception
weblogic.jms.commom.JMSException:[JMSClientExceptions:055115]Error deserialising an object
Caused by: java.lang.ClassNotFoundException: com.my.TestClass
To my surprise , this is not happening for all invocation/Transactions. Sometimes deserialisation happens with no issue and sometimes i'm facing this issue.
If its related to class path, then I should be getting this error on constant basis but the case here is quit strange. Any help highly appreciated.

When using gwt-log source maps doesn't work when catching uncaught exceptions

I have recently started using gwt-log.
I followed the Getting Started tutorial and added Log.setUncaughtExceptionHandler() in my initialization file as suggested, but when it is there I get this exception in the chrome console (using super dev mode):
2014-07-31 15:16:21,025 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException: (TypeError)
__gwt$exception: <skipped>: Cannot read property 'formatTotal' of null
at Unknown.$getTotal_1(project-0.js#33:126146)
at Unknown.$getFromModel_198(project-0.js#65:103988)
at Unknown.getFromModel_199(project-0.js#10:104011)
at Unknown.$visit(project-0.js#15:22142)
at Unknown.visit_3(project-0.js#10:22188)
at Unknown.$traverse(project-0.js#11:21813)
at Unknown.accept_73(project-0.js#33:103339)
at Unknown.$traverse(project-0.js#57:21813)
at Unknown.$traverse_0(project-0.js#13:21877)
at Unknown.attach(project-0.js#21:21903)
...
Quite hard to debug as you can see, no line numbers or link to java source. When I comment out the Log.setUncaughtExceptionHandler() line I get the source mapped to the exception like this:
Uncaught TypeError: Cannot read property 'formatTotal' of null UnitRate.java:87
$getTotal_1 UnitRate.java:87
$getFromModel_198 UnitRateRenderer_total_Context.java:17
getFromModel_199 UnitRateRenderer_total_Context.java:16
$visit Refresher.java:30
visit_3 Initializer.java:49
$traverse AbstractEditorContext.java:128
accept_73 UnitRateRenderer_SimpleBeanEditorDelegate.java:57
$traverse AbstractEditorContext.java:129
$traverse_0 AbstractEditorDelegate.java:100
...
Is this expected behaviour or am I not doing something I should be?

How to resolve Error org.omg.CORBA.BAD_OPERATION exception in java ?

When I invoke method on client side, for distributed reference object, I have this message error:
Exception in thread "main" org.omg.CORBA.BAD_OPERATION:
at org.omg.CORBA.portable.ObjectImpl._get_delegate(ObjectImpl.java:18)
at org.omg.CORBA.portable.ObjectImpl._is_local(ObjectImpl.java:130)
at fr.esiag.commun._ManageDemandStub.createDemand(_ManageDemandStub.java
:28)
at fr.esiag.commun.resource.MyInvocationHandler.invoke(MyInvocationHandl
er.java:29)
at com.sun.proxy.$Proxy0.createDemand(Unknown Source)
at org.TD.TransactionDriver.main(TransactionDriver.java:55)
Can someone tell me what that means ?
BAD_OPERATION expception happens when you try to call a method that dosen't exist in the servant. I think you cast (instead of narrow) the remote object wrong. Maybe it's is relative to your previous question

ELException Error Reading ... on type

I'm getting an exception when displaying my jsp page that tries to invoke a function defined getCurrentlocation() in type Person.
The function is invoked by ${person.currentlocation} in the jsp file.
type Exception report
message javax.el.ELException: Error reading 'currentlocation' on type **.person.Person
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.el.ELException: Error reading 'currentlocation' on type **.person.Person
I am pretty new to jsp technology. Maybe someone could help me out!
Thanks,
Benjamin
This particular ELException is a wrapper exception. This is usually only thrown when invoking the getter method itself has thrown an exception. Something like the following is happening under the covers when this ELException is been thrown:
Object bean;
String property;
Method getter;
// ...
try {
getter.invoke(bean);
} catch (Exception e) {
String message = String.format("Error reading '%s' on type %s", property, bean.getClass().getName());
throw new ELException(message, e);
}
You should look further down in the stacktrace for the real root cause. The complete stacktrace is usually just available in server logs. The real root cause is the bottommost exception of the stacktrace. E.g. the below one is caused by a NullPointerException being thrown in the getter method.
javax.el.ELException: Error reading 'currentlocation' on type **.person.Person
at ...
at ...
at ...
Caused by: java.lang.NullPointerException
at **.person.Person.getCurrentlocation(Person.java:42)
at ...
at ...
The information about the real root cause (the exception type and the line number) should give you enough clues to nail down the problem.
Again, this is not a problem with EL in general. It's just your own code which caused the problem.

Categories

Resources