AsposeBadServerResponseException 404 Error When Sending Emails

Hi, we update our aspose library to your last version:

        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-total</artifactId>
            <version>25.8</version>
            <type>pom</type>
        </dependency>

And this new issue starting appear:

com.aspose.email.AsposeBadServerResponceException: Server error [404] Operation failed.: 404/Not Found

Details:

{"error":{"code":"ErrorItemNotFound","message":"The specified object was not found in the store., The process failed to get the correct properties."}}

At the next run, our task retry on failed emails and after one or two retry the email is processed correctly by aspose.

Locally on my local dev environnement all working fine without any error for the same emails at the first try.

Thanks for your help.

@frjo

The error you’re encountering, AsposeBadServerResponceException: Server error [404], indicates that the specified object was not found in the store. This can occur for several reasons, particularly after a library update.

Here are some steps to troubleshoot and resolve the issue:

  1. Check Object Existence: Verify that the email or object you are trying to access actually exists in the store. It may have been deleted or moved.

  2. Implement Retry Logic: Since you mentioned that the email processes correctly after one or two retries, consider implementing a more robust retry mechanism. This can help manage transient errors more effectively.

  3. Compare Local and Server Environments: Since the process works in your local development environment, check for any differences in configuration or permissions between your local setup and the server environment. Ensure that the server has the same access rights and configurations as your local environment.

  4. Update Dependencies: Ensure that all related dependencies are updated to compatible versions. Mismatched versions can lead to unexpected behavior.

  5. Enable Detailed Logging: Activate detailed logging to capture more information about the requests being made. This can help identify what might be going wrong during the operation.

If the issue persists, consider reaching out to Aspose support with detailed logs and context about your implementation for further assistance.

Thank’s AI for your basic answer.

Like I described, we already have the latest version you released and this issue must investigating by your team.

Thank you to forward this issue to your dev team.

Yesterday we fallback on our previous version on our task and actually we use this library: aspose-email-24.11.0.2-jdk16.jar.

The message issue not append with this version.

I hope this help you in your investigation.

Regards

Hello @frjo,

Could you please share a minimal code example that reproduces the problem?
It would be helpful to know which specific classes or methods are involved in your scenario.

Once we have that information, we’ll be able to analyze the issue.

Thank you

Sure this is the stack trace we have when this happening.

com.aspose.email.AsposeBadServerResponceException: Server error [404] Operation failed.: 404/Not Found

Details:

{"error":{"code":"ErrorItemNotFound","message":"The specified object was not found in the store., The process failed to get the correct properties."}}
at com.aspose.email.zxl.c(SourceFile:182) ~[aspose-email-24.11.0.2-jdk16.jar!/:na]
at com.aspose.email.zxl.a(SourceFile:210) ~[aspose-email-24.11.0.2-jdk16.jar!/:na]
at com.aspose.email.zxl.n(SourceFile:73) ~[aspose-email-24.11.0.2-jdk16.jar!/:na]
at com.aspose.email.zxm.fetchMessage(SourceFile:250) ~[aspose-email-24.11.0.2-jdk16.jar!/:na]
    ... our java stack.

@frjo,

Thank you for the details provided.

  • From the info shared, it’s not entirely clear which client you are using ( IMAP, EWS, or Graph). Could you please clarify that?

  • Also, to help us investigate the issue further, please provide at least a minimal code sample that reproduces the problem.

  • Our clients support activity logging, which can be enabled as follows:

    client.setLogFileName("log-path"); // Specifies the path where the activity log will be written
    

    Would it be possible for you to enable logging, reproduce the issue, save the activity log, and share it with us?
    This will help us analyze the server interaction.

Hello @frjo ,

The JSON error is a server response indicating that the requested object was not found. The call to MSGraph fetchMessage(String id) returns ErrorItemNotFound (404) — meaning the message with this id does not exist or is not accessible.

It’s likely that the id is invalid or refers to a deleted message. Please review the code that calls fetchMessage and make sure the id is correct.

Could you please provide more details:

  • a code snippet that performs the request,
  • an example of the id (you can mask part of it),

This will help us identify the exact cause.

Hi @margarita.samodurova ,

We configured your libraries to use MS Graph API to get emails from our MS SAAS Exchange servers services.

This issue never happen before we use your lasts release of your librarie. The question is what happen on your side between version aspose-email-24.11.0.2-jdk16.jar and aspose-email-25.7-jdk16.jar.

Like I said before version aspose-email-25.7-jdk16.jar we never had this issue.

I tried locally the same email raise an exception in production and I never have this issue and it’s not possible for me to recreate the same behaviour to reproduce the issue.

In our project we bundle all of the dependencies of your maven pom:
Groupeid: com.aspose
Artefactid: aspose-total
version: 25.8
type: pom

Is it ok? Do we need to pick and choose some of jar… This regression is realy wierd and nothing as changed in our runtime environment…

Regards,

Hi @sergey.vivsiuk,

I can giving you a snippet of our implementation but not on a public forum. Is it possible to send you this by direct mail or a more safe communication canal.

Regards,

Hello @frjo,

You can safely upload your file here. Although this is a public forum, all uploaded files remain private and can only be accessed by you and our team.

LogAndJavaClasse.zip (7.2 KB)

Hi @margarita.samodurova,

I saw something new when I packaging these files for your investigation (log and our java class).

When the issue happen we trying to delete the email in our input malbox.

When we successfully have extracted the information from the email, if all is good we delete it to avoid to process it into the next run.

Clarely, the bug is arround what you did when you process de MS Graph response when we invoke the function:

com.aspose.email.IGraphClient.delete(…)

Look to line 240 in our Java source code.

Hello @frjo,

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILJAVA-35414

Thank you.

Hello @frjo ,

We performed additional testing related to your case; however, we were unable to reproduce the reported issue.
The verification was carried out using versions 24.11 and 25.6 through 25.9.
The following code sample was used during testing:

GraphMessagePageInfo messagePageInfo = client.listMessages(
        GraphKnownFolders.Inbox,
        new PageInfo(2),
        new MailQuery("", "('SentDate' OrderBy 'ASC')"));
for (GraphMessageInfo info : messagePageInfo.getItems()) {
    MailConversionOptions options = new MailConversionOptions();
    MailMessage msg = client.fetchMessage(info.getItemId()).toMailMessage(options);
    System.out.println("Del >>>" + info.getSubject());
    client.delete(info.getItemId());
    System.out.println("Del Complete");
}

For further investigation, we would appreciate additional details about your message processing.
In particular, could you please confirm whether multi-threaded processing might be involved, as it could potentially lead to such conflicts?