Erhalten Sie Java.lang.ILLEGALSTATEException: Keine threadgebundene Anforderung gefundenJava

Java-Forum
Anonymous
 Erhalten Sie Java.lang.ILLEGALSTATEException: Keine threadgebundene Anforderung gefunden

Post by Anonymous »

Ich erhalte einen Fehler, wenn ich versuche, @aSync -Annotation zu verwenden. < /p>

java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
< /code>

Code: < /p>

@Async
@Override
@Transactional
public void triggerEmailCommunication(List eventCode, Integer authorizationId, Integer claimId,
boolean callMethod) {
Map emailBody = new HashMap();
try {

if (callMethod) {
LOGGER.info("Communication async flow triggerEmailCommunication method starts.");
emailBody = emailBodyObject(authorizationId, claimId, eventCode);
}

private Map emailBodyObject(Integer authorizationId, Integer claimId, List eventCode)
throws CareBusinessServiceException {
LOGGER.info("EmailBodyObject method starts.");
Map emailBody = new HashMap();
EmailClaimDetailsVO emailClaimDetails = new EmailClaimDetailsVO();
ClaimAuthorizationVO claimAuthVO = new ClaimAuthorizationVO();
Claim claim = new Claim();
Authorization authorization = new Authorization();
List rejectReasonList = new ArrayList();
Provider provider = new Provider();
String providerName = null;
String claimIntimationNbr = null;
String authorizationNbr = null;
SimpleDateFormat formatter = new SimpleDateFormat(AmhiConstants.DATE_FORMAT_DD_MM_YYYY);
try {
Integer claimIntimationId = null;
if (null != claimId) {
claim = enableBusinessService.retrieveClaimDetails(claimId);
} catch(Exception e) {
}
}
< /code>

Dao -Schicht < /p>

@Override
public Claim retrieveClaimIdRecord(Integer claimId) {
CriteriaBuilder builder = manager.getCriteriaBuilder();
CriteriaQuery criteriaQuery = builder.createQuery(Claim.class);
Root root = criteriaQuery.from(Claim.class);
ArrayList conditions = new ArrayList();
conditions.add(builder.equal(root.get(Claim_.claimId), claimId));
criteriaQuery.select(root).where(conditions.toArray(new Predicate[] {}));
javax.persistence.Query query = manager.createQuery(criteriaQuery);
List claims = query.getResultList();
if(CollectionUtils.isNotEmpty(claims)){
return claims.get(0);
}
return new Claim();
}
< /code>

Der Wert wird von DB abgerufen. Aber ich bekomme wie erwähnt.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post