Teamcenter Connector and Excel Export

0
Hi Everyone   I'm currently working at my first App - which happens to interact with TC. The TC integrations has been implemented some time ago and works as expected.   I now want to add an Excel Export functionality for certain entities and facing issues with this, because as soon as i try to execute an error i receive the following error message: java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B] error.   After some troubleshooting i found the librarie which causes the error, which is org.apache.commons.io-2.3.0.jar which is been required by TcConnector.   Does someone know how i can fix this issue and be able to use the Excel Export properly?   Used mendix studio Version: 9.24.17   Thanks for your help and best regards Raphael
asked
7 answers
1

There is a similar issue with the Excel Importer module.

Java.lang.NoSuchMethodError: org.apache.logging.log4j.util.LoaderUtil.getClassLoaders()[Ljava/lang/ClassLoader;

 

It seems the Teamcenter Connector module is conflicting with some common libraries.

answered
0

Hi Raphael,

What is module you are using to export in excel?

It'is possible that the version of commons.io is to low; you should try to download the last version (2.16.1 I think) and put the jar in your userlib folder.

 

answered
0

Hi Vincent

 

Thank you for answering, i use the Mendix Excel Export Module: https://marketplace.mendix.com/link/component/726

 

the given org.apache.commons.io is delivered with the Teamcenter Connector Module: https://marketplace.mendix.com/link/component/111627

 

Therefor i am not sure if i can simply replace or delete the lib without impacting the functionality of TcConnector Module

 

BR

Raphael

answered
0

I use teamcenter connector with a newer version of commons.io and I don't have any issue, so it should not be a problem.

You can try to update the Excel Export Module to have the correct version of lib for this module.

answered
0

Hi Vincent,

 

Which exact version of commons.io do you use?

Thanks for your help!

 

BR

Raphael

answered
0

I use the commons-io-2.11.0 ;-)

answered
0

Hi Raphael,

The error you're encountering is related to a version conflict between the org.apache.commons.io library used by the Teamcenter Connector and the one required by Mendix's Excel Export module. This is a common issue when two components rely on different versions of the same library. Here's how you can address it:

Steps to Resolve the Issue

1. Verify Library Version Conflict

  • Confirm the conflicting versions:
    • Teamcenter Connector uses org.apache.commons.io-2.3.0.jar.
    • Mendix Excel Export module might require a later version of the library.
  • You can check the JAR files in the userlib folder of your Mendix project.

2. Replace the Older Library

Since Mendix 9.24.17 supports more recent versions of libraries, you can try replacing the older org.apache.commons.io-2.3.0.jar with a newer version that satisfies both components:

  1. Download the latest commons-io JAR (e.g., commons-io-2.11.0.jar) from Apache Commons IO.
  2. Backup Your Project:
    • Before making changes, back up your project folder.
  3. Replace the JAR:
    • Remove the org.apache.commons.io-2.3.0.jar file from the userlib folder.
    • Add the newer commons-io JAR file to the same folder.

3. Test the Application

  • Restart your Mendix Studio Pro.
  • Rebuild and run the application to test if the Excel Export functionality works without errors.

Alternative Solution: Isolate the Modules

If the above approach doesn't work or causes issues with the Teamcenter Connector:

  1. Create a Custom Java Action:
    • Use a custom Java action to perform the Excel export separately, ensuring it uses the required version of commons-io.
  2. Use Separate Libraries:
    • Consider packaging the Teamcenter Connector and Excel Export modules with isolated dependencies using a custom Java implementation.

Prevent Future Conflicts

  • Regularly update Mendix modules and libraries to ensure compatibility.
  • Check for updates in the Teamcenter Connector documentation or community for compatibility with the latest Mendix versions.

If the issue persists, sharing the full stack trace and additional details about the configuration can help pinpoint the exact cause. Let me know how it goes!

Best regards,

Lijo Joseph

answered