我正在运行以下groovy脚本。我面临以下例外:
提交事件时出错:groovy.lang.MissingMethodException:没有方法签名:static com.wipro.core.common.BaseSpec.auditRequest()适用于参数类型:(java.lang.String,java.lang。 String,java.lang.String,java.util.LinkedHashMap)值:[35796698,http://localhost:8090/core-admin/http://curacao1-core-re-md1/,...] 可能的解决方案:auditRequest(java.lang.Long,java.lang.String,java.lang.String,java.util.Map)
我在groovy中提到过以前关于缺失方法的帖子,并检查了我的代码中的拼写错误或拼写错误(找不到)。任何帮助都非常感谢。
private String doSyncEvent(def ctx) {
def result = ""
def commId = getStringCommId(sql)
def xmlText = replaceXmlTag(ctx.message, 'CommId', commId)
def endPointURL = config["core.rest.url"]
endPointURL = endPointURL + ctx.serviceUrl
def id = syncRequestCount.getAndIncrement()
sendForEvaluationWithContext(sql, endPointURL, commId, xmlText, ctx)
return result;
}
static void sendForEvaluationWithContext(def sql, def url,def commId, def message, Map ctx) {
auditRequest(commId, url, message, ctx)
response = EventPublisher.sendForEvaluation(url, message)
}
static String auditRequest(final Long commId, final String target, final String message, final Map ctx) {
final LobHandler oracleLobHandler = (LobHandler) AppContext.getBean("oracleLobHandler")
final JdbcTemplate jdbcTemplate = (JdbcTemplate) AppContext.getBean("testScriptJdbcTemplate")
final def userId = Utils.getHostName().toUpperCase()
String msgTrackerAuditSql = "INSERT INTO MSG_TRACKER (COMM_ID,EVENT_TYPE, TIME_SENT) VALUES (?, ?, ?)"
PlatformTransactionManager transactionManager = null
TransactionDefinition txDef = null
TransactionStatus status = null
try {
transactionManager = (PlatformTransactionManager) AppContext.getBean(BeanEnum.transactionManager);
txDef = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW)
status = transactionManager.getTransaction(txDef)
jdbcTemplate.execute(
msgTrackerAuditSql,
new AbstractLobCreatingPreparedStatementCallback(oracleLobHandler) {
protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
ps.setLong(1, commId);
ps.setString(2, userId);
ps.setString(3, "TEST_SCRIPT" + "_" + userId);
ps.setString(4, target);
ps.setString(5, "ASYNC");
lobCreator.setClobAsString(ps, 6, message);
ps.setString(7, ctx.get("eventType",""));
ps.setTimestamp(8, new Timestamp(System.currentTimeMillis()));
}
}
);
transactionManager.commit(status)
} catch (RuntimeException e) {
transactionManager.rollback(status)
throw e;
}
}
答案 0 :(得分:4)
再次阅读错误......
没有方法签名:static com.wipro.core.common.BaseSpec.auditRequest()适用于参数类型:( java.lang.String ,java.lang.String,java。 lang.String,java.util.LinkedHashMap)值:[35796698,http://localhost:8090/core-admin/http://curacao1-core-re-md1/,...]可能的解决方案:auditRequest( java.lang.Long ,java.lang.String,java .lang.String,java.util.Map)
这告诉您,当方法签名指定第一个参数应为auditRequest
时,您尝试使用String
作为第一个参数调用Long
方法