Not able to run the SimpleApp program of Google Could big-query using maven as mvn exec:java -Dexec.mainClass=com.example.bigquery.SimpleApp - google-bigquery

Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory
at com.google.api.client.json.jackson2.JacksonFactory.(JacksonFactory.java:44)
at com.google.api.client.json.jackson2.JacksonFactory$InstanceHolder.(JacksonFactory.java:64)

I just deleted the older versions of jackson-core jars from my local maven repository and then run the code and it worked

Related

Spring boot will not run in InteliJ [duplicate]

Recently I created a new project using IntelliJ IDEA and Gradle for dependency management. After resolving all the dependencies needed by the project and running it I get the following error:
java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at com.some.fancy.name.Application.main(Application.java:13)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
The problem occurs only with the classes from the resolved dependencies (I tried it also with a simple main program using Cache from Guava). The class causing the error is the following:
#SpringBootApplication
public class Application {
public static void main(String... args) {
SpringApplication.run(Application.class, args);
}
}
All the fields are shown correct colour (annotations are yellow, nothing is red), IntelliJ has all the resolved dependencies in the External Libraries directory. I'm using the green "run" arrow to start the project.
When using gradle from the command line, creating a fat jar then everything works fine. I already tried "Invalidate Caches/Restart", pulled the project several times from the repository, cleared the gradle caches, removed all the dependencies by hand, tried to run it using the Community Edition, the Ultimate Edition, running older projects which already worked some time ago (and don't work now).
Could it be somehow related to updating IntelliJ IDEA to 2016.3.4, build 163.12024.16?
It's a known issue in IntelliJ IDEA that is specific to Gradle 3.4 and later versions:
IDEA-167412 Gradle 3.4-rc-1 changes compile dependencies to provided
original bug report in the Gradle project with more details
comment from the responsible developer regarding "Create Module per source set" option and how Gradle integration works in IntelliJ IDEA
It's already fixed in IntelliJ IDEA 2017.1 and 2016.3.6.
You can also use Gradle 3.3 or older as a workaround if you can't or don't want to update IntelliJ IDEA.
I had the same problem, getting the error below from a spring boot application which was working fine a day before. I am using IntelliJ 2020.3, Gradle 6.5.1. I suspect my repository might have been corrupted.
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
After lot of tries from my IntelliJ I tried bootRun (in the gradle tree you can find this under Tasks > application > bootRun) and it worked.
Setting gradle version to 3.3 corrected this issue.

NoClassDefFoundError after IntelliJ IDEA upgrade

Recently I created a new project using IntelliJ IDEA and Gradle for dependency management. After resolving all the dependencies needed by the project and running it I get the following error:
java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at com.some.fancy.name.Application.main(Application.java:13)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
The problem occurs only with the classes from the resolved dependencies (I tried it also with a simple main program using Cache from Guava). The class causing the error is the following:
#SpringBootApplication
public class Application {
public static void main(String... args) {
SpringApplication.run(Application.class, args);
}
}
All the fields are shown correct colour (annotations are yellow, nothing is red), IntelliJ has all the resolved dependencies in the External Libraries directory. I'm using the green "run" arrow to start the project.
When using gradle from the command line, creating a fat jar then everything works fine. I already tried "Invalidate Caches/Restart", pulled the project several times from the repository, cleared the gradle caches, removed all the dependencies by hand, tried to run it using the Community Edition, the Ultimate Edition, running older projects which already worked some time ago (and don't work now).
Could it be somehow related to updating IntelliJ IDEA to 2016.3.4, build 163.12024.16?
It's a known issue in IntelliJ IDEA that is specific to Gradle 3.4 and later versions:
IDEA-167412 Gradle 3.4-rc-1 changes compile dependencies to provided
original bug report in the Gradle project with more details
comment from the responsible developer regarding "Create Module per source set" option and how Gradle integration works in IntelliJ IDEA
It's already fixed in IntelliJ IDEA 2017.1 and 2016.3.6.
You can also use Gradle 3.3 or older as a workaround if you can't or don't want to update IntelliJ IDEA.
I had the same problem, getting the error below from a spring boot application which was working fine a day before. I am using IntelliJ 2020.3, Gradle 6.5.1. I suspect my repository might have been corrupted.
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
After lot of tries from my IntelliJ I tried bootRun (in the gradle tree you can find this under Tasks > application > bootRun) and it worked.
Setting gradle version to 3.3 corrected this issue.

springfox 2.2.3 snapshot dependencies adding failed because of missing nexus-maven-repository-index.properties

I setup my project with springfox 2.2.3 snapshot version in IDEA 14 with gradle. I follow instruction 2.1.1. Gradle Snapshot. I failed with error that maven repository cannot be indexed and see exception in IDEA's log:
WARN - #org.jetbrains.idea.maven - Failed to update Maven indices for: [com.intellij.util.CachedValueImpl#a1d13c] http://oss.jfrog.org/simple/oss-snapshot-local/io/springfox
org.jetbrains.idea.maven.server.MavenServerIndexerException: java.lang.RuntimeException: java.io.FileNotFoundException: Resource nexus-maven-repository-index.properties does not exist
I tried both repositories and both failed:
http://oss.jfrog.org/simple/oss-snapshot-local/io/springfox/
http://oss.jfrog.org/oss-snapshot-local/io/springfox/
Could anyone have any idea how to fix the issue?
I tried to download dependencies manually and put them in my local .m2 directory and setup in gradle mavenLocal() instead of maven {url ...} but my attempt failed with IDEA's warning on Gradle refresh operation:
Warning:<i><b>project ':data-service': Web Facets/Artifacts will not be configured</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':data-service:runtime'.
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.springfox:springfox-swagger2:2.2.3-SNAPSHOT.
Required by:
parseq:data-service:2.4.0 alpha</i>
Now I think that should also manually add transitive dependencies for springfox package. But it looks ugly and I think I should not go this way.
Does anyone has idea what should I do?
I found issues with dependency donwloading:
* when I work from corporate network I have SSL certificate issue
* initially I added maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' } into buildscript {...} section, I changed it to repositories {...} and fixed the issue
* also I updated my gradle to 2.4 version (but it didn't help)
Now my starting issue is fixed.

Atlassian SDK error: can not install plugin

I doing the following steps:
Install Atlassian latest SDK 5.1.18
Run Atlassian command: atlas-run-standalone --product jira. Then I can access the web.
Go to sample plugin folder and execute: "altas-cli:. then "pi".
This is the output error message:
java.lang.RuntimeException: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalCommand.java:112)
at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalCommand.java:107)
at org.twdata.maven.cli.CliShell.interpretCommand(CliShell.java:48)
at org.twdata.maven.cli.CliShell.run(CliShell.java:29)
at org.twdata.maven.cli.AbstractCliMojo.displayShell(AbstractCliMojo.java:174)
at org.twdata.maven.cli.AbstractCliMojo.access$000(AbstractCliMojo.java:22)
at org.twdata.maven.cli.AbstractCliMojo$1.run(AbstractCliMojo.java:123)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
at org.shaded.mojoexecutor.MojoExecutor.executeMojoImpl(MojoExecutor.java:174)
at org.shaded.mojoexecutor.MojoExecutor$ExecutionEnvironmentM3.executeMojo(MojoExecutor.java:476)
at org.shaded.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:75)
at org.twdata.maven.cli.MojoCall.run(MojoCall.java:33)
at org.twdata.maven.cli.commands.ExecuteGoalCommand.runMojo(ExecuteGoalCommand.java:126)
at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalCommand.java:109)
... 6 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:106)
at com.atlassian.maven.plugins.amps.MavenGoals.copyBundledDependencies(MavenGoals.java:142)
at com.atlassian.maven.plugins.amps.CopyBundledDependenciesMojo.execute(CopyBundledDependenciesMojo.java:15)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.shaded.mojoexecutor.MojoExecutor.executeMojoImpl(MojoExecutor.java:172)
... 11 more
Caused by: java.lang.UnsupportedOperationException
at org.apache.maven.plugin.internal.DefaultPluginManager.executeMojo(DefaultPluginManager.java:89)
at org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:104)
... 15 more
please help me.
Jira sample plugin: https://bitbucket.org/atlassian_tutorial/jira-gadget-2
(I succeeded installing this Gadget once)
You must be sure if Your Jira SDK version(amps.version) and Jira version specified in pom.xml are same as installed in system.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<amps.version>5.1.11</amps.version>
<jira.version>6.3.14</jira.version>
</properties>
And please add Your pom.xml to question as Ram wrote
(I cannot add comments so I add answer)

teamcity 5.1 maven proxy configuration

I created a new build configuration and tried to run the same. However I encounter errors saying the artifacts could not be found in the repository. If I run the maven build from command line for the same workspace, the build works well. The proxy configuration has been mentioned in ./m2/settings.xml and the settings file has been mentioned in the build configuration. I tried even placing the proxy configuration in TeamCity\buildAgent\plugins\maven\conf\settings.xml but it does not seem to help. Kindly let me know if you have any pointers.
Caused by: org.apache.maven.plugin.InvalidPluginException: Unable to build project for plugin 'org.apache.maven.plugins:maven-site-plugin': POM 'org.apache.maven.plugins:maven-site-plugin' not found in repository: Unable to download the artifact from any repository[16:59:48]: org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7[16:59:48]: from the specified remote repositories:[16:59:48]: central (http://repo1.maven.org/maven2)[16:59:48]: for project org.apache.maven.plugins:maven-site-plugin[16:59:48]: at org.apache.maven.plugin.DefaultPluginManager.checkRequiredMavenVersion(DefaultPluginManager.java:293)[16:59:48]: at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:205)[16:59:48]: at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)[16:59:48]: at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)[16:59:48]: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)[16:59:48]: ... 19 more[16:59:48]: Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.apache.maven.plugins:maven-site-plugin' not found in repository: Unable to download the artifact from any repository[16:59:48]: org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7[16:59:48]: from the specified remote repositories:[16:59:48]: central (http://repo1.maven.org/maven2)[16:59:48]: for project org.apache.maven.plugins:maven-site-plugin[16:59:48]: at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)[16:59:48]: at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)[16:59:48]: at org.apache.maven.plugin.DefaultPluginManager.checkRequiredMavenVersion(DefaultPluginManager.java:277)[16:59:48]: ... 23 more[16:59:48]: Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository[16:59:48]: org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-7[16:59:48]: from the specified remote repositories:[16:59:48]: central (http://repo1.maven.org/maven2)[16:59:48]: at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)[16:59:48]: at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)[16:59:48]: at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)[16:59:48]: ... 25 more[16:59:48]: Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository[16:59:48]: at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)[16:59:48]: at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)[16:59:48]: ... 27 more
Have you tried setting the settings.xml within the Maven installation
e.g. for my TeamCity installation /usr/local/apache-maven/apache-maven-2.2.1/conf/settings.xml
Don't forget that TeamCity will probably be running as its own user, so ~/.m2/settings.xml may not be where you think it is.