IntelliJ can't resolve com.amazonaws symbols com.amazonaws.SdkClientException - java

Im working in this intellij java maven project on ubuntu 18.04, i want to run my project but i get this error message:
java: cannot find symbol
symbol: class sdkBaseException
location: package com.amazonaws
These are the libraries that i have installed but for some reason com.amazonaws.SdkClientException is not working when im trying to import with import com.amazonaws.SdkClientException but all the other com.amazonaws.blahblah are working just fine.
I already installed the AWS toolkit plugin, what em i missing? i cant find anything helpfull online.

Im working in this intellij java maven project
If this is a Maven based project you must manage dependencies in Maven pom.xml and not manually through IDE UI.
Add required dependency into the dependencies section of your pom.xml file.
If this is a locally built dependency, then first install it into your local Maven repository:
mvn install:install-file \
-Dfile=<path-to-file> \
-DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-Dpackaging=<packaging> \
-DgeneratePom=true

You need to follow the import documentation depending on the version of the library you are adding, in this case for version 1.11.1034 use this documentation https://jar-download.com/artifacts/com.amazonaws/aws-java-sdk-core/1.11.1034/documentation.
You have to import all the following dependencies for that version:
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.amazonaws.SdkBaseException
com.amazonaws.AmazonClientException
com.amazonaws.SdkClientException
If you are looking for other versions see: https://jar-download.com/maven-repository-class-search.php?search_box=com.amazonaws.SdkClientException&p=5

Related

Problems with an oracle maven dependency

I'm trying to compile a project in Anypoint studio, and for some reason it's failing on one dependency -
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
Should say, when I run this on my Windows laptop i have absolutely no issues and the jars download fine. Running it on my macbook, i get the following error -
Archive for required library: '/Users/matt/.m2/repository/com/oracle/jdbc/ucp/12.1.0.2/ucp-12.1.0.2.jar' in project 's-wms-hj-api' cannot be read or is not a valid ZIP file s-wms-hj-api
the message i get when i update project dependencies is -
[WARNING] Invalid POM for com.oracle.jdbc:ucp:jar:12.1.0.2, transitive dependencies (if any) will not be available, enable debug logging for more details
Is it something Mac related?
The dependency is not available in public repositories so the jar has to be installed manually in the local Maven repository. The error was likely because it was incorrectly installed.
The warning is the expected result because that method doesn't provide the pom.
I'm not sure why you don't see the warning in Windows. Perhaps a different Maven version or using a repository manager?
I've always dealt with Oracle the following way (I'm running a mac as well, though it really doesn't matter):
Download the .jar file from the internet somewhere. Install the dependency using Maven using these instructions: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Here's an example of the command, assuming you downloaded the jar for ucp version 12.1.0.2, you are currently in that directory, and the file is called ucp-12.1.0.2.jar:
mvn install:install-file \
-Dfile=ucp-12.1.0.2.jar \
-DgroupId=com.oracle.jdbc \
-DartifactId=ucp \
-Dversion=12.1.0.2 \
-Dpackaging=jar
This should install into your default ~/.m2/repository. If you want you can verify this with:
ls -al ~/.m2/repository/com/oracle/jdbc/ucp/12.1.0.2.jar
You should see a pom file in there.
Maven will now be ready to grab this file when you specify them in your pom. Keep in mind that the groupId, artifactId, and version parameters for the mvn install command relate exactly to what you'd put in the pom for those same fields.

Maven cannot find JAR

Recently I tried to develop an interface for my group. My service runs and works well on my local machine, but when trying to use Maven Compile in IDEA, the compilation fails and tells me it cannot find my JAR package. The JAR package I use is JAVE (Java Audio Video Encoder), which was manually added into my CLASSPATH. I know Maven cannot find JAR package without adding dependency to pom, but I can't find the Maven dependency for JAVE, it seems that they only provide a JAR package for users. JAVE HomePage
So in this case, what should I do if I want to successfully compile my code using Maven? I need to deploy my service in the future, so manually adding JAR package to my CLASSPATH instead of adding dependency to pom is definitely not acceptable.
You can install a maven jar locally using:
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
You can install the artefact to either your local or a remote maven repo or you could use it as a system-scoped dependency (see https://stackoverflow.com/a/2177417/9705485 or http://roufid.com/3-ways-to-add-local-jar-to-maven-project/ for examples)

How to use cloned github repository classes into existing java project

I am using some classes from a github project. I created a maven project and added the dependency from the provided github project, but I need to change some code in those project classes.
I have downloaded and modified the repository but now I have no idea how to import it and use the classes to my existing project.
Any help will be appreciated.
Once you have built your modified github project, you can install it in your local maven repository.
Just use this command:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
If you have built it with a different version, you now just have to reference this new version in your pom.xml file.

Missing artifact com.oracle:ojdbc5:jar:11.2.0.1 error in pom.xml in eclipse

I have created a project in Eclipse using maven. I am getting an error in my pom.xml in dependency, the dependency look like this.
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.1</version>
<scope>provided</scope>
</dependency>
I am getting:
Missing artifact com.oracle:ojdbc5:jar:11.2.0.1
I saw a solution in stackoverflow it self, That-
due to Oracle license restriction, there are no public
repositories that provide ojdbc jar.
you need to download it and install in your local repository.
Get jar from Oracle and install it in your local maven repository using
mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
the above command. I executed the bellow command changing the path to my ojdbc.jar.
mvn install:install-file -Dfile={
C/monitoring-workspace/ojdbc5.jar} -DgroupId=com.oracle
-DartifactId=ojdbc5 -Dversion=11.2.0.1-Dpackaging=jar
but I am getting an error on cmd that
I am confused in two things
My oracle folder it self has ojdbc5 and ojdbc6 jar then why do I need
to install ojdbc5
What should be the path I need to provide while installing ojdbc-the
where I need to install or the path where I have kept ojdbc5 jar.
I see you have referred to mykong article. The problem is new lines. You have to make sure that you got it in one line in the command prompt.
mvn install:install-file -Dfile=C:/monitoring-workspace/ojdbc5.jar -DgroupId=com.oracle -DartifactId=ojdbc5 -Dversion=11.2.0.1 -Dpackaging=jar
ojdbc6.jar - Classes for use with JDK 1.6. or newer
ojdbc5.jar - Classes for use with JDK 1.5.
you need only one of them

Maven Web project with Maven java application as a dependency?

I have a simple java application - maven project in my Netbeans IDE.
After I created Maven Web Application and added first project as a dependency Netbeans shows that everything is OK, and I can use all methods as well.
But in runtime I am getting
java.lang.ClassNotFoundException: com.example.dal.factory.PersistenceDaoFactory
Is it possible to make web project depending on simple java application without creating multimodule java EE application?
Yes, but you need to install your first project locally:
mvn install:install-file \
-Dfile=<path-to-file> \
-DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-Dpackaging=jar
Setting up NetBeans to use a project as a dependency isn't the same thing as having a Maven artifact you can use in other Maven projects; for Maven, you need to have it in a Maven repo.

Categories