Runtime Unresolved Compilation Problem

0
Hi, I have added java actions to a Mendix app to utilize Auth0 authentication. I added Auth0 through maven in Eclipse and created the corresponding .java files, everything compiled fine and the app launched. However when I click the login button to launch the microflow, I receive the error below. AuthAPI is a type within the Auth0 maven dependency.     An unhandled error occurred in the MxRuntime. -------- java.lang.Error: Unresolved compilation problems:      AuthAPI cannot be resolved to a type     AuthAPI cannot be resolved to a type     at systemvisioncloud.actions.Auth0_Login.executeAction(Auth0_Login.java:27)     at systemvisioncloud.actions.Auth0_Login.executeAction(Auth0_Login.java:1)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:79)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:57)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:55)     at com.mendix.basis.actionmanagement.ActionManager$1.execute(ActionManager.java:186)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.java:191)     at com.mendix.basis.component.InternalCore.execute(InternalCore.java:593)     at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:64)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:201)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:157)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:79)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:57)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:55)     at com.mendix.basis.actionmanagement.ActionManager$1.execute(ActionManager.java:186)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.java:191)     at com.mendix.basis.component.InternalCore.execute(InternalCore.java:562)     at com.mendix.basis.component.InternalCore.execute(InternalCore.java:577)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.$anonfun$executeMicroflow$5(ExecuteMicroflowAction.scala:108)     at scala.Option.getOrElse(Option.scala:121)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.executeMicroflow(ExecuteMicroflowAction.scala:108)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.execute(ExecuteMicroflowAction.scala:63)     at com.mendix.webui.requesthandling.ClientRequestHandler.$anonfun$handleRequest$2(ClientRequestHandler.scala:364)     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)     at com.mendix.basis.actionmanagement.IMonitoredAction$$anon$1.execute(IMonitoredAction.scala:47)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.IMonitoredAction.monitor(IMonitoredAction.scala:49)     at com.mendix.basis.actionmanagement.IMonitoredAction.monitor$(IMonitoredAction.scala:25)     at com.mendix.webui.requesthandling.ClientRequestHandler$ClientMonitoredAction.monitor(ClientRequestHandler.scala:472)     at com.mendix.webui.requesthandling.ClientRequestHandler.handleRequest(ClientRequestHandler.scala:349)     at com.mendix.webui.requesthandling.ClientRequestHandler.handleActionWithSessionRequired(ClientRequestHandler.scala:280)     at com.mendix.webui.requesthandling.ClientRequestHandler.handleAction(ClientRequestHandler.scala:242)     at com.mendix.webui.requesthandling.ClientRequestHandler.liftedTree1$1(ClientRequestHandler.scala:104)     at com.mendix.webui.requesthandling.ClientRequestHandler.processRequest(ClientRequestHandler.scala:96)     at com.mendix.externalinterface.connector.RequestHandler.doProcessRequest(RequestHandler.java:40)     at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:71)     at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:68)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.external.connector.MxRuntimeConnector.processRequest(MxRuntimeConnector.java:74)     at com.mendix.basis.impl.MxRuntimeImpl.processRequest(MxRuntimeImpl.java:858)     at com.mendix.m2ee.appcontainer.server.handler.RuntimeHandler.service(RuntimeHandler.java:42)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)     at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)     at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)     at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)     at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)     at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)     at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)     at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)     at org.eclipse.jetty.server.Server.handle(Server.java:561)     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334)     at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)     at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)     at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104)     at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)     at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)     at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:243)     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679)     at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597)     at java.lang.Thread.run(Thread.java:748)  
asked
3 answers
2

Hi Ben,

You get this error is because mendix does not understand maven. So you have two options:

1) as Eric recommends, download the jar files from maven repository (see screenshot) and add them to the userlib. Note that if the jar file has other dependencies you need to add those manually as well. 

2) compile a so called fat "jar". Create a small maven project where you put in all the maven dependencies, and build a single jar files that has all of them. Then add this jar file to userlib - I wrote a blog post on this which you can find here https://www.mansystems.com/blog/mendix/managing-java-dependencies-for-mendix-modules/

 

-Andrej

 

answered
0

Try dropping the auth0 JAR file in the /userlib/ folder in your project directory. Any JAR files in that folder get added to the build path.

answered
0

Hi Andrej and Eric,

I followed your steps and this has me on the right track, thank you! I have created the fat jar and added the contents to the right place in userlib to be built, and all of the import statements reference the correct classes from maven dependencies. 

Unfortunately, I am unable to build the project and receive an error about the mendix boot main class not being able to resolve 'model/bundles'. Is this something I need to update in the app?


Exception in thread "main" java.lang.IllegalArgumentException: Path 'model/bundles' cannot be resolved in base path 'C:\Users\blevine\Documents\Mendix\App1-demo-svg-plotly\deployment'.
    at com.mendix.container.config.ProjectConfig.resolveRelative(ProjectConfig.scala:38)
    at com.mendix.container.deployment.Dsl$Support$PathOps.$div(Dsl.scala:180)
    at com.mendix.container.deployment.Model$.project(Model.scala:49)
    at com.mendix.container.boot.Container$.doStart(Container.scala:120)
    at com.mendix.container.boot.Container$.$anonfun$start$3(Container.scala:109)
    at com.mendix.container.boot.Container$.time(Container.scala:181)
    at com.mendix.container.boot.Container$.start(Container.scala:109)
    at com.mendix.container.boot.Main$.$anonfun$new$1(Main.scala:11)
    at scala.util.Either.flatMap(Either.scala:338)
    at com.mendix.container.config.ProjectConfig$.run(ProjectConfig.scala:64)
    at com.mendix.container.boot.Main$.delayedEndpoint$com$mendix$container$boot$Main$1(Main.scala:11)
    at com.mendix.container.boot.Main$delayedInit$body.apply(Main.scala:9)
    at scala.Function0.apply$mcV$sp(Function0.scala:34)
    at scala.Function0.apply$mcV$sp$(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App.$anonfun$main$1$adapted(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:389)
    at scala.App.main(App.scala:76)
    at scala.App.main$(App.scala:74)
    at com.mendix.container.boot.Main$.main(Main.scala:9)
    at com.mendix.container.boot.Main.main(Main.scala)
 

answered