How do I force an exception in mule [closed] - mule

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I using version 3.2. When a soap fault returns from a service I want log the error and force the Global Exception. I tried using
<test:component throwException="true" />. While it does force the Exception to execution it also genreates a ton of messages in my log (see below). I need to clean this up or find a better to force the execution of the exception.
>>>>>>>>>>>>>>>>>>>>>>>>>THESE ARE UNWANTED MESSAGES>>>>>>>>>>>>>
INFO 2013-09-08 17:38:05,443 [msr-httpConnector.receiver.02] org.mule.tck.functional.FunctionalTestComponent:
********************************************************************************
* Message Received in service: BillingAccountProductAssociationRequest. *
* Content is: <soap:Envelope *
* xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Faul *
* t><faultc...[100 of 567] *
********************************************************************************
ERROR 2013-09-08 17:38:05,449 [msr-httpConnector.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy:
********************************************************************************
Message : Functional Test Service Exception
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Functional Test Service Exception (org.mule.tck.exceptions.FunctionalTestException)
org.mule.tck.functional.FunctionalTestComponent:210 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/tck/exceptions/FunctionalTestException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.tck.exceptions.FunctionalTestException: Functional Test Service Exception
at org.mule.tck.functional.FunctionalTestComponent.throwException(FunctionalTestComponent.java:210)
at org.mule.tck.functional.FunctionalTestComponent.onCall(FunctionalTestComponent.java:134)
at org.mule.model.resolvers.CallableEntryPointResolver.invoke(CallableEntryPointResolver.java:50)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

You can throw any exception from a Groovy scripting component:
<scripting:component doc:name="Script">
<scripting:script engine="Groovy"><![CDATA[
throw new IllegalArgumentException('bad arg')
]]></scripting:script>
</scripting:component>

Related

Gatsby gatsby-source-shopify plugin with starter [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 days ago.
Improve this question
How to solve this. It is runnig locally and the browser give this message:
`
Unhandled Runtime Error Close One unhandled runtime error found in
your files. See the list below to fix it:
Error in function Client.fetcher in
./node_modules/shopify-buy/index.js:10512 Failed to fetch
./node_modules/shopify-buy/index.js:10512 Open in Editor 10510 |
this.graphQLClient = new GraphQLClientClass(types, { 10511 |
fetcher: function fetcher(graphQLParams) {
10512 | return fetchFunction(url, { 10513 | body: JSON.stringify(graphQLParams), 10514 | method:
'POST', 10515 | mode: 'cors',`

Send notifications in telegram group [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
How can I have my telegramBot send automatically messages in a group?
def handle_event(event):
#print(event)
global amount0In
global amount1Out
global amount1In
global amount0Out
amount0In = event['args']['amount0In']
amount1Out = event['args']['amount1Out']
amount1In = event['args']['amount1In']
amount0Out = event['args']['amount0Out']
if amount0In and amount1Out != 0:
print(f"Token Sold {amount0In /10**18}, and eth {amount1Out/10**18}")
buy()
else:
print(f"Token Bought {amount0Out /10**18}, and eth {amount1In/10**18}")
sell()
def buy(update,context):
buyMessage = f"Buy!!!!\n💴: {amount1In/10**18}\nToken Bought: {amount0Out /10**18} \n"
update.message.reply_text(buyMessage)
def sell(update, context):
sellMessage = f"Sell!!!!\n💴: {amount1In/10**18}\nToken Sold: {amount0Out /10**18} \n"
update.message.reply_text(sellMessage)
In case the IF statement is met I want to send a message to a telgram group, however I cant execute the update message this way, because I keep getting this error:
TypeError: buy() missing 2 required positional arguments: 'update' and 'context'
How can I fix this?
To send a message, all you need is an instance of telegram.Bot. Please have a look at the introduction to the API for more details.
The functions buy and sell look like callback functions for handler. Since you are apparently not using python-telegram-bots handler setup to handle the event, there is no sense in defining those functions to accept the update and context arguments.
Disclaimer: I'm currently the maintainer of python-telegram-bot.

async scope is not working in Clustering in mule 3.4.2

async scope is not working in Clustering in mule 3.4.2. we are getting below exception.
Message : Interrupted while queueing event for "SEDA Stage Main_Flow.async1". Message payload is of type: ConfirmReceiveMessageResponse
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. com.sample.client.ReceiveMessageResponse (java.io.NotSerializableException)
java.io.ObjectOutputStream:1183 (null)
2. java.io.NotSerializableException: com.elexon.bmrs.ecp.client.ReceiveMessageResponse (org.apache.commons.lang.SerializationException)
org.apache.commons.lang.SerializationUtils:111 (null)
3. Interrupted while queueing event for "SEDA Stage Main_Flow.async1". Message payload is of type: ConfirmReceiveMessageResponse (org.mule.api.service.FailedToQueueEventException)
org.mule.processor.SedaStageInterceptingMessageProcessor:92 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/service/FailedToQueueEventException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.NotSerializableException: com.sample.client.ReceiveMessageResponse
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at org.apache.commons.collections.map.AbstractHashedMap.doWriteObject(AbstractHashedMap.java:1182)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
After removing the async scope we are able to test the application. Could please help us how to make the application works with async in cluster env?
If the flow ref is using an async processing strategy it will try and persist the event in a cluster I believe. And your object is not Serializable.
You can make com.sample.client.ReceiveMessageResponse implement java.io.Serializable if you want the message to be persisted.
Or you can try forcing the flow that you are flow-ref'ing processingStrategy="synchronous" maybe.

Mule: How to make sure payload is in writable state before doing file outbound

In my <catch-exception-strategy>, I write error payload to file. But sometimes when flow involves web-service calls and host is unavailable or unknown (for e.g. java.net.UnknownHostException is thrown), payload is not anymore an instance of InputStream or String. If I try to log error then to file, following exception is thrown:
exception.AbstractExceptionListener (AbstractExceptionListener.java:299) -
********************************************************************************
Message : Could not find a transformer to transform "SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}".
Code : MULE_ERROR-65237
--------------------------------------------------------------------------------
Exception stack is:
1. Could not find a transformer to transform "SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}". (org.mule.api.transformer.TransformerException)
org.mule.registry.MuleRegistryHelper:252 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}".
at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:355)
at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:313)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
I am thinking of doing a choice block before writing to file to make sure payload is writable. Shall I do something like #[payload instanceof java.io.InputStream]? But then how about cases where payload is DOM or something else? Please advise.
I would use a transformer inside the catch exception strategy and encapsulate there the logic that would consider the input and produce a writable payload.
If you want to check whether there is a transformer available for a specific payload type and output type, I guess you could look up the available transformers from the registry. In Groovy:
transformers = message.getMuleContext().getRegistry().lookupTransformers(
new org.mule.transformer.types.SimpleDataType(payload.getClass()),
new org.mule.transformer.types.SimpleDataType(java.io.InputStream))
if (transformers.size() == 0) {
//set some variable or whatever
}

Apache Tomcat 5.5.23 error. HTTP Status 500 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Following is the stack trace
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.JspCompilationContext.load(jasper5-compiler-5.5.23.jar.so)
org.apache.jasper.servlet.JspServletWrapper.getServlet(jasper5-compiler-5.5.23.jar.so)
org.apache.jasper.servlet.JspServletWrapper.service(jasper5-compiler-5.5.23.jar.so)
org.apache.jasper.servlet.JspServlet.serviceJspFile(jasper5-compiler-5.5.23.jar.so)
org.apache.jasper.servlet.JspServlet.service(jasper5-compiler-5.5.23.jar.so)
javax.servlet.http.HttpServlet.service(tomcat5-servlet-2.4-api-5.5.23.jar.so)
looks like this code is compiled pre generics support,
An error occurred at line: 236 in the jsp file: /dashboard_new.jsp
Syntax error, parameterized types are only available if source level is 5.0
recompile the code with jdk >= 1.5 would be my guess or maybe the tomcat server is setup to use a jdk < 1.5
hope that helps
EDIT:
all of the errors apart from the one below seem to be a compiled version issue.
this one :
An error occurred at line: 338 in the jsp file: /dashboard_new.jsp
Incompatible conditional operand types String and int
335: out.println( "<td valign=\"top\">" + frameBean.getLatitude() + "</td>" );
336: out.println( "<td valign=\"top\">" + frameBean.getLongitude() + "</td>" );
seems to be trying to concatonate Strings and Integers. this should also work in later versions of java, i think.