Bug 778266 (SOA-765)

Summary: Scripting framework - is there a way to return the script (file) name to the user in the event of an error?
Product: [JBoss] JBoss Enterprise SOA Platform 4 Reporter: Len DiMaggio <ldimaggi>
Component: JBossESBAssignee: Len DiMaggio <ldimaggi>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 4.3 IR4   
Target Milestone: ---   
Target Release: 4.3 IR5   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-765
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
SOA-P IR4
Last Closed: 2008-10-06 13:34:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Len DiMaggio 2008-09-09 18:42:18 UTC
Date of First Response: 2008-10-06 04:09:15
project_key: SOA

In looking at the scripting_chain quickstart, I wanted to see how errors in the scripts would be handled and reported - via the server.log - to the user.

So, I introduced this syntax error into the scripts/link.py script:

===================
cat scripts/link.py 
logger.1#@%^=//@\\q  qqq   let's cause a syntax error
# Jython script: link.py
chain = payloadProxy.getPayload(message) + "~(jython)"
logger.info(config.getAttribute("action") + ": " + chain)
payloadProxy.setPayload(message, chain)
===================

Running this from the shell returns:

/opt/jython2.2.1/jython scripts/link.py 
Traceback (innermost last):
  (no code object) at line 0
  File "scripts/link.py", line 1
        logger.1#@%^=//@\\q  qqq   let's cause a syntax error
              ^
SyntaxError: invalid syntax

The ESB server.log returns:

13:34:48,314 INFO  [ScriptingAction] add_beanshell_link: (chain)~(beanshell)
13:34:48,316 ERROR [STDERR] Traceback (innermost last):
  (no code object) at line 0
13:34:48,316 ERROR [STDERR]   File "<string>", line 1
13:34:48,316 ERROR [STDERR]     logger.1#@%^=//@\\q  qqq   let's cause a syntax error
13:34:48,316 ERROR [STDERR]           ^
13:34:48,321 WARN  [ActionProcessingPipeline] No fault address defined for fault message! To: JMSEpr [ PortReference < <wsa:Address jms://127.0.0.1:1099/queue/quickstart_scripting_chain_esb/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : 127.0.0.1:1099/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AUTO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ] MessageID: 70cb023e-3489-4a97-bde6-dabe7d894dcf RelatesTo: jms:correlationID#70cb023e-3489-4a97-bde6-dabe7d894dcf


Is there anyway to get the script name and not:     File "<string>"
into the log message?

Comment 1 Len DiMaggio 2008-09-09 18:43:59 UTC
Link: Added: This issue is a dependency of JBESB-2002


Comment 2 Len DiMaggio 2008-10-03 19:32:56 UTC
The update is in ScriptingAction.java:

			final String error = "Exception caught while processing script: '" + source + "'" ;
			if (logger.isDebugEnabled())
			{
				logger.debug(error, bsfe) ;
			}
			throw new ActionProcessingException(error, bsfe);

But the exception is not raised:

15:14:05,297 INFO  [ScriptingAction] add_beanshell_link: (chain)~(beanshell)
15:14:07,109 ERROR [STDERR] Traceback (innermost last):
  (no code object) at line 0
15:14:07,110 ERROR [STDERR]   File "<string>", line 2
15:14:07,110 ERROR [STDERR]     logger.1#@%^=//@\\q qqq let's cause a syntax error 
15:14:07,110 ERROR [STDERR]           ^
15:14:07,115 ERROR [STDERR] SyntaxError: invalid syntax
15:14:07,211 WARN  [ActionProcessingPipeline] No fault address defined for fault message! To: JMSEpr [ PortReference < <wsa:Address jms://127.0.0.1:1099/queue/quickstart_scripting_chain_esb/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : 127.0.0.1:1099/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AUTO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ] MessageID: 938c5dc0-a79c-4359-aa37-114c3f89a279 RelatesTo: jms:correlationID#938c5dc0-a79c-4359-aa37-114c3f89a279


Comment 3 Kevin Conner 2008-10-06 08:09:15 UTC
The last line would suggest that the exception is raised.  Why do you think it hasn't been?

Comment 4 Len DiMaggio 2008-10-06 13:34:46 UTC
Because I forgot to check in the log for the DEBUG level message     ;-)   the script name is there...


2008-10-06 09:33:06,795 ERROR [STDERR] Traceback (innermost last):
  (no code object) at line 0
2008-10-06 09:33:06,795 ERROR [STDERR]   File "<string>", line 1
2008-10-06 09:33:06,795 ERROR [STDERR]  logger.1#@%^=//@\\q qqq let's cause a syntax error 
2008-10-06 09:33:06,795 ERROR [STDERR]        ^
2008-10-06 09:33:06,800 ERROR [STDERR] SyntaxError: invalid syntax
2008-10-06 09:33:06,801 DEBUG [org.jboss.soa.esb.actions.scripting.ScriptingAction] Exception caught while processing script: '/scripts/link.py'
org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last):
  (no code object) at line 0
  File "<string>", line 1
        logger.1#@%^=//@\\q qqq let's cause a syntax error 
              ^
SyntaxError: invalid syntax


Comment 5 Len DiMaggio 2008-10-06 13:34:57 UTC
Verified in IR5