Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce noise: 'org.reflections.ReflectionsException: could not get type for name' error during compilation #43

Closed
JonathanGiles opened this issue Jan 3, 2018 · 9 comments

Comments

@JonathanGiles
Copy link
Member

In a certain code situation, I get the following exception at compile time:

[INFO] Step 1 of 6: Searching for Azure Function entry points
[INFO] Reflections took 27 ms to scan 1 urls, producing 2 keys and 2 values
[WARNING] could not get type for name net.jonathangiles.azure.functions.interfacebug.db.DataStore from any class loader
org.reflections.ReflectionsException: could not get type for name net.jonathangiles.azure.functions.interfacebug.db.DataStore
at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
at org.reflections.Reflections.(Reflections.java:126)
at com.microsoft.azure.maven.function.handlers.AnnotationHandlerImpl.findFunctions(AnnotationHandlerImpl.java:42)
at com.microsoft.azure.maven.function.PackageMojo.findAnnotatedMethods(PackageMojo.java:89)
at com.microsoft.azure.maven.function.PackageMojo.doExecute(PackageMojo.java:61)
at com.microsoft.azure.maven.AbstractAzureMojo.execute(AbstractAzureMojo.java:265)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: net.jonathangiles.azure.functions.interfacebug.db.DataStore
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
... 28 more
[INFO] 1 Azure Function entry point(s) found.

I'm attaching the code that caused this for you to reproduce the issue locally.

interface-bug.zip

@nicenemo
Copy link

nicenemo commented Jan 3, 2018

What do you try? mvn compile or mvn package?
If it is the last you probably you should use the shade plugin to copy alle dependencies. (works for me).
Your pom.xml does not contain the shade plugin.
I guess that If you trigger the function code from an integration test it should work but packaging or running it local fails.
The manual now also states that you should use the shade plugin:
README.md

@JonathanGiles
Copy link
Member Author

@nicenemo I'm wondering if this comment was intended for #35 ? In any case, I'll answer your questions as they related to this interface issue I'm seeing (and I'll update issue 35 to answer your questions too).

This is during mvn package. I am using the standard generated scaffolding provided by the Maven Azure plugin, with no dependencies, and only a few extra classes that I wrote to demonstrate the issue. I'm not running the tests, or even accessing the function - this is simply during the packaging of the code - so the issue is present regardless of whether the shade plugin is used or not.

@JunyiYi
Copy link
Contributor

JunyiYi commented Jan 6, 2018

@xscript , please take a look. The problem is during the compilation stage.

@xscript
Copy link
Contributor

xscript commented Jan 8, 2018

@JonathanGiles I tried your attached project and it builds successfully. The warning message you pasted above is coming from the reflection library we use. We will try to suppress it as it doesn't block the generation of function.json.
You can follow up on the fix of microsoft/azure-maven-plugins#76 .

@JonathanGiles
Copy link
Member Author

Thanks!

@nicenemo
Copy link

nicenemo commented Jan 8, 2018

That will save some noise in the build !!

@christopheranderson christopheranderson added this to the backlog milestone Jan 16, 2018
@christopheranderson christopheranderson changed the title 'org.reflections.ReflectionsException: could not get type for name' error during compilation Reduce noise: 'org.reflections.ReflectionsException: could not get type for name' error during compilation Jan 16, 2018
@JonathanGiles
Copy link
Member Author

If issue microsoft/azure-maven-plugins#76 is merged, does that mean that this issue should now be closed as resolved?

@xscript
Copy link
Contributor

xscript commented Jan 17, 2018

@JonathanGiles The fix has not been released yet. We are planning to release a new version this week. Please stay tuned.
You can close this issue after verifying the fix in the next version of our maven plugin.
Thanks!

@JunyiYi
Copy link
Contributor

JunyiYi commented Mar 21, 2018

Close the issue due to lack of response from external for more than two months.

@JunyiYi JunyiYi closed this as completed Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants