Issue debugging / starting the application out of Eclipse

0
Hello, I am working on a Java Action and besides running into another problem I now additionally have to deal with this issue: There are several locations where this error pops up.  The pattern is always the same: “The package <..> is accessible from more than one module: <unnamed>, <..>” I remember that I had this exact same issue a while back, but then I somehow was able to resolve it. Unfortunately I cannot remember how I did it. I thought it was a combination of cleaning the project out of the studio pro and then deploying it for eclipse. But now nothing seems to work.   When I run it it starts the console and proceeds with the startup process of the application. Everything seems to work until it makes use of one of the classes which have the exceptions: stating: java.lang.Error: Unresolved compilation problem   I already tried to refreshing the project in the Eclipse workspace, removing and adding it completly and building and cleaning out of Eclipse. I also verified that I am using the correct JDK and compiler settings. Starting the project out of the Mendix Studio works. I really need this to work out of Eclipse, otherwise I cannot debug my code, which is a problem.   Does anyone have an idea what causes this? How can I fix this? Thoughts?   Thanks! - Tobias
asked
2 answers
1

It states that the class is available from multiple sources and therefore the app will not start.

Check your userlib for multiple versions of the package org.xml.sax, as Robert stated probably you have multilpe jars defining the same class.

answered
0

Hi there,

Since I needed to continue my work in this project I needed to find a workaround for this issue. I tried to clean up the duplicate libraries in the \userlib\ directory but this didn’t yield much success. The error count increased, since some of the AppStore modules installed require a certain version of their dependencies.

In a frustrating attempt I tried removing all the installed AppStore modules and reinstalling them. What I noticed is that the libraries in the \userlib\ directory do not get cleaned up automatically, even if you remove an AppStore module out of your project. This was obvious when I compared the two directories before and after reinstalling the modules and cleaning the directory manually. A lot of the libraries were not used anymore. How they got there in the first place can have multiple reasons. One is that you performed an update and the dependency got updated as well, this will result in you having multiple version of the dependency in the directory, even if you only need one of them. Another reason might be that you added a module from the AppStore and then removed it again without manually removing the added libraries from the directory. They will remain there indefinitely. see

  

Another thing I noticed was that the same library might be referenced by multiple AppStore modules, but under a different name. E.g. “org.apache.commons.lang3.jar” and “commons-lang3-3.7.jar”. This will also cause both of the libraries to get used, even if they contain the same code segments.

I have no clue how Mendix manages these dependencies exactly. But since I was able to startup the environment and start the server until a certain point I assume that most of the code is runtime evaluated. The exceptions will only occur when code from one of those segments is actually called, not when being compiled. 

 

I finally tried to just remove the suspected AppStore modules, cleanup the exceptions in the project, deploy to Eclipse and then start it from there. Having removed the modules resolved the issues for me. This allowed me to debug and test this specific Java Action before I reverted the other changes and continued as usual. 

I additionally informed the support by opening an incident explaining the issue. I hope they improve how those dependencies get managed.

 

Thanks for your help guys!

Tobias

answered