I'm having some sort of problem with ucp.jar
If I use ucp.jar for oracle 12.1.0.1 it works.
If I use the version for oracle 12.1.0.2 then I get the following exception:
java.lang.ClassNotFoundException: oracle.jdbc.pooling.Factory
Is there anyone who can help me?
Thanks, Mauro
The Jdbc (ojdbc7.jar) and UCP (ucp.jar) jars must always be from the same version (12.1.0.2). You can't upgrade one without upgrading the other. This version dependency was introduced in 12c. It wasn't the case before.
There is a ojdbc7.jar/ojdbc6.jar file dependency. You need to download/update either depending on the java version you are using.
Adding the following maven dependencies solved the issue for me
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
(1) Register (or have an existing Oracle.com account)
(2) Go to http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html
Download ojdbc8.jar and udp.jar add to classpath.
(3) If you use build tools (Maven or Gralde), go to directory of files ojdbc8.jar and upd.jar
mvn install:install-file -Dfile=udp.jar -DgroupId=com.oracle -DartifactId=udp -Dversion=12.1.0.1 -Dpackaging=jar
mvn install:install-file -Dfile=ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.1.0.1 -Dpackaging=jar
(4) If you use Gradle, you must declare use MavenLocal in build.gradle. Example
plugins {
id 'java'
}
group 'com.donhuvy'
version '1.0-SNAPSHOT'
sourceCompatibility = 10
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile('com.oracle:ojdbc8:12.1.0.1')
compile('com.oracle:ucp:12.1.0.1')
testCompile group: 'junit', name: 'junit', version: '4.12'
}
Related
We currently use gradle 5.6.4 version. After I upgrade the gradle version, above 6, I tried with 6.3 and 6.7.1, the following error occurs:
What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find com.lowagie:itext:2.1.7.js8.
Required by:
project : > net.sf.jasperreports:jasperreports:6.16.0
The dependency exists in ".gradle/caches/modules-2/files-2.1". I also tried with --refresh-dependencies flag, but nothing works. Any ideas?
I had the same issue. Some solutions which worked for me:
Adding new repositories
repositories {
mavenCentral()
maven{url "http://jasperreports.sourceforge.net/maven2/"}
maven{url "http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/"
}
dependencies {
...
implementation 'net.sf.jasperreports:jasperreports:6.16.0'
...
}
Excluding a deprecated artifact (com.lowagie)
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.16.0</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>
PS. Similar problem with itext library
I got the following build error:
Could not find com.lowagie:itext:2.1.7.js6
So I added http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/ as repository and now it works.
repositories {
mavenCentral()
maven { url "https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/" }
}
dependencies {
compile 'net.sf.jasperreports:jasperreports:6.8.0'
}
I had the same issue. I externally added the dependency for itext 2.1.7, which required for the complier.
implementation 'com.lowagie:itext:2.1.7'
implementation 'net.sf.jasperreports:jasperreports:6.17.0'
I'm trying to write integration tests in a separate project that does not have "web" code just tests. I'm trying to only add spring-test-starter like this:
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.3.4.RELEASE'
without having to also add this (or a similar starter)
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.3.4.RELEASE'
But it appears that when I go to use
org.springframework.boot.test.web.client.TestRestTemplate
The return type is not included in org.springframework.boot.test it's under "org.springframework.http.ResponseEntity"
public <T> ResponseEntity<T> getForEntity(String url,
Class<T> responseType,
Map<String,?> urlVariables)
throws RestClientException
I can't find anywhere that says that spring-boot-starter-test depends on say spring-boot-starter-web because otherwise what would be the point of the starter? Is there a way to use TestRestTemplate without depending on (2) starters?
If you don't want to use the starter packages, then you need to add dependency for the packages you want manually. Like ResponseEntity is a part of spring-web. So you need to add spring-web dependency to you pom.xml or build.gradle file.
if you only want spring-web for testing, then you can add this line to your build.gradle file.
testCompile group: 'org.springframework', name: 'spring-web', version: '5.2.9.RELEASE'
or your pom.xml file
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.9.RELEASE</version>
<scope>test</scope>
</dependency>
Check the version you need.
Version: maven 3.6.3
I try to put this dependency into pom.xml,but it not auto download
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.11</artifactId>
<version>2.4.3</version>
</dependency>
so i use command line:
mvn dependency:get -DremoteRepositories=http://repo1.maven.org/maven2 -DgroupId=com.datastax.spark -DartifactId=spark-cassandra-connector_2.11 -Dversion=2.4.3 -Dtransitive=false
but it give me couldn't download artifact error log :
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Could not transfer artifact com.datastax.spark:spark-cassandra-connector_2.11:jar:2.4.3
Do I need to upgrade remoteRepositories?
Why are some commonly used packages automatically downloaded quickly ? such as guava,commons-lang.
Some new versions are always problematic to rely on for download,Is it no cache in
repository?
How can I download the dependency? Thanks
i been stuck with this for a while.
I am trying to automate the build and deploy (in nexus3) of several java modules and remove the need for manually set the module version in the projects pom.
My issue is that maven is ignoring the variables inside the pom files.
Parent pom:
<properties>
<revision>local</revision>
</properties>
<name>lib-cloud</name>
<groupId>com.company.lib</groupId>
<artifactId>lib-cloud</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<modules>
<module>lib-cloud-main</module>
</modules>
and the child pom:
<properties>
<unrelatedVAR>2017.3.3</unrelatedVAR>
</properties>
<parent>
<groupId>com.company.lib</groupId>
<artifactId>lib-cloud</artifactId>
<version>${revision}</version>
</parent>
<artifactId>lib-cloud-main</artifactId>
<name>lib-cloud-main</name>
and then i build this with:
mvn -Drevision=3.1 clean package deploy
This build the code just fine, create a lib-cloud-main/target/lib-cloud-main-3.1.jar
In side the jar, i can already see that
lib-cloud-main-3.1.jar/maven/com.company.lib/lib-cloud-main/pom.xml have
<version>${revision}</version>
As version, instead 3.1 as i would expected, but still this artifact manages to be saved in nexus.
If i try to use it, however, maven trow the error when trying to get the pom:
[ERROR] Failed to execute goal on project core-backend-api: Could not resolve dependencies for project com.company.core:core-backend-api:jar:local: Failed to collect dependencies at com.company.lib:lib-cloud-main:jar:3.1: Failed to read artifact descriptor for com.company.lib:lib-cloud-main:jar:3.1: Could not transfer artifact com.company.lib:lib-cloud:pom:${revision} from/to company-maven-public (http://mvn.company.local/repository/maven-public/): Failed to transfer file: http://mvn.company.local/repository/maven-public/com/company/lib/lib-cloud/$%7Brevision%7D/lib-cloud-$%7Brevision%7D.pom. Return code is: 400 , ReasonPhrase:Invalid repository path.
I even tried to use
mvn release:update-versions -DdevelopmentVersion=3.1
As a way to overwrite the poms with a static value before the build but this methos STILL fail to touch the tag in any project children pom.
What i am doing wrong?
Apache Maven 3.5.4 (Red Hat 3.5.4-4) Maven home: /usr/share/maven Java
version: 1.8.0_212, vendor: Oracle Corporation, runtime:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.fc29.x86_64/jre
Default locale: pt_BR, platform encoding: UTF-8 OS name: "linux",
version: "5.0.17-200.fc29.x86_64", arch: "amd64", family: "unix"
You should use release plugin to do this.
mvn release:update-versions -DautoVersionSubmodules=true
Hi I am trying to follow the Getting Started guide for Jersey 2.0.
I did steps 1.1 and 1.2 as is. No problem there.
For step 1.3 I had a problem cause maven could not find the javax-annotation 1.2 but I solved it following the advice of another Stackoverflow user and added a repository to my pom.
Somvn clean test passes with no problems, BUT when I try to run mvn clean exec:java I get back
[WARNING] java.lang.ClassNotFoundException: com.example.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:722)
The pom.xml is the one created by the following command:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
-DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example \
-DarchetypeVersion=2.0
where the only addition I 've made is the following:
<repositories>
<repository>
<id>java.net.repo</id>
<url>https://maven.java.net/content/groups/promoted/</url>
<layout>default</layout>
</repository>
</repositories>
In case it is of interest this is the output of mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/share/maven
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre
Default locale: el_GR, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.3", arch: "x86_64", family: "mac"
I am able to reproduce your error. This has nothing to do with Jersey; it's an error you're making with Maven. mvn clean exec:java says: "delete all the .class files and then try to run the Main .class file". Since you deleted it, Maven can't find it. Here's a solution:
mvn clean compile exec:java
This should fix the problem in your question. This says "delete all the .class files, recompile them from source and then try to run the Main .class file"
To get past the next error you'll see, delete the <scope>test</scope> line from the client dependency in the pom.xml:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<scope>test</scope>
</dependency>
To:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>