I find the jar only three common files, no java file, no pom.xml file. How it works? I'am confused, thanks~
➜ jar -tf spring-boot-starter-data-redis-2.5.1.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/LICENSE.txt
META-INF/NOTICE.txt
The package also includes a pom.xml which defines some dependencies on other projects like spring-data-redis, lettuce-core. These dependencies will be included in your build process.
So there's no actual code in the jar.
Example from the spring-boot-starter-data-redis 2.0.6-RELEASE pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.0.6.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.0.11.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.0.5.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
As Luc said, if you look inside the artifact you'll see a POM https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-data-redis/2.5.2/spring-boot-starter-data-redis-2.5.2.pom that brings all the needed dependencies.
Baeldung has a good article on how starters work https://www.baeldung.com/spring-boot-starters
It's code in jar spring-boot-autoconfigure, in package org.springframework.boot.autoconfigure.data.redis , the core class is RedisAutoConfiguration
Related
My java application creates Google Cloud Functions. It works when the pom.xml is:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.12.2</version>
</dependency>
However after upgrading the version in the pom.xml to:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>9.1.0</version>
<scope>runtime</scope>
</dependency>
These import statements no longer work.
import com.google.firebase.FirebaseApp;
import com.google.firebase.database.*;
How do I use the latest version and import these dependencies?
Here are the dependencies in the pom:
<dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.cloud/libraries-bom -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.1.4</version>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud.functions</groupId>
<artifactId>functions-framework-api</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>9.1.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.14.0</version>
</dependency>
</dependencies>
I also tried removing the version number of the dependency hoping the BOM would take over the version numbers, but that didn't work.
What is strange is that I have looked at the code in github ( https://github.com/firebase/firebase-admin-java ) and can see the class exists in the code ( https://github.com/firebase/firebase-admin-java/blob/master/src/main/java/com/google/firebase/database/FirebaseDatabase.java )
If I look at the maven dependency com.google.firebase:firebase-admin:9.1.0 I can also see the class as shown here:
Thanks in advance for the help.
~Randy
I have a Tomcat application that writes out spreadsheets and it was using the following JAR files:
poi-3.16.jar
poi-ooxml-3.16.jar
poi-ooxml-schemas-3.16.jar
I saw there was a version 4.0.1 of poi, and in looking at https://poi.apache.org/components/ I think I have the prerequisites set up, but I get an Exception when running:
25-Mar-2019 22:33:37.117 SEVERE [http-nio-8181-exec-10] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [xxx.ApplicationConfig] in context with path [/DataLoaderREST] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.ExceptionInInitializerError] with root cause
java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: class POIXMLDocument
location: package org.apache.poi
Update:
Apparently when I built my .WAR file that gave the above error, it looks like NetBeans found the old 3.16 jar files and compiled my code, but I didn't have the 3.16 jar files on the server. Now that I've done a clean in NetBeans, I cannot compile in NetBeans.
Error:
--- maven-compiler-plugin:2.3.2:compile (default-compile) # DataModules ---
Compiling 44 source files to C:\xxx\xxx\10 Software\Java\LoaderFramework\DataModules\target\classes
-------------------------------------------------------------
COMPILATION ERROR :
-------------------------------------------------------------
com/xxx/billing/loader/parser/ExcelParser.java:[36,21] error: cannot find symbol
And ExcelParser.jara line 36 is:
import org.apache.poi.POIXMLDocument;
Here is my pom.xml, referencing the 4.0.1 jars:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xx.billing</groupId>
<artifactId>DataModules</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<!-- POI artifacts See https://poi.apache.org/components/ -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<!-- type>bundle</type -->
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.xx.billing</groupId>
<artifactId>DataLoderShared</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.5.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>1.5.6</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>55.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I have checked my NetBeans .m2 repository, and I have both 3.16 and 4.0.1 directories inC:\Users\mstewart\.m2\repository\org\apache\poi\poi\ and poi\ooxml and poi\ooxml-schemas
I stared at the compiler error
import org.apache.poi.POIXMLDocument;
for days, and just noticed it was missing the ooxml part of the package; changed it to
import org.apache.poi.ooxml.POIXMLDocument;
And all is well. Thanks Axel for the links; that helped me eventually find the issue.
I'm refactoring a simple web project that originally uses icefaces-ee 1.8 with icepush, then was uploaded to icefaces-ee 3.3.0 with icepush, but never actually require them. I'm replacing the 'ee' libraries to community libraries, and droping the icepush funtionality to a simple icefaces project.
My maven icefaces dependencies are:
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>org.icepush</groupId>
<artifactId>icepush</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-compat</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.28</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.4.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
it compiles but when I try to deploy the war into glassfish 3, I get this error
java.lang.NoSuchMethodError: org.icefaces.util.EnvUtils.getWarnBeforeExpiryInterval(Ljavax/faces/context/FacesContext;)
effectively, I see that the class EnvUtils, in the icefaces-3.3.0.jar, lacks that method.
which functionality uses this? how can I avoid this error?
One of the workaround is to upgrade ICEfaces to 4.0.0. EnvUtils.getWarnBeforeExpiryInterval(FacesContext)has been introduced since version 4.0.0.
See also:
EnvUtils of version 3.3.0
EnvUtils of version 4.0.0
I can't make Arquillian and Websphere Embedded EJBContainer work smoothly together.
Because I can't use the arquillian-was-embedded-8 Jar File (Missing in Company Maven repository and Jenkins).
I try to load the WebSphereExtension (LoadableExtension) in my Junit test without success. Can someone point me to the right solution?
My second question is, even if i load this jar file locally in my IDE i also have problems with the interface (on my EJB's). See the same issue here:
[arquillian-was-embedded-8 runs but can't inject EJB. NullPointerException
How can i avoid this?
My maven Dependencies:
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>com.ibm.ws.ejb.embeddableContainer</artifactId>
<version>8.0.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>endorsed_apis</artifactId>
<version>8.0.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-build</artifactId>
<version>1.1.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
<version>1.1.4.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.4.Final</version>
<scope>test</scope>
</dependency>
Java 6, Junit 4.12, IDE Luna 4.4.2
Thank you in advance, I would appreciate it a lot
I found the solution. I don't need to build the artifacts if I use this
in src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension (this is a file name)
with the contents --> /path/to/WebSphereExtension
The second problem I resolve like this:
#EJB(mappedName = "java:global/test/MyEjbTest!com.home.coem.Processor")
Processor test1;
Processor is the interface name and MyEjbTest is the implementation bean!
I hope it will help somebody
I'm using Embedded Glassfish to do some In-Container-Tests with Arquillian. Now, when my test fails, i always get stacktraces from the tests that are cluttered with Arquillian-specific stuff. But there are few informations about what the real reason for failing tests is.
With regular Glassfish, i could check the server.log for more informations. Unfortunately, Embedded Glassfish seems not to provide a Server.log.
I also looked into the temporary directory that is created by Arquillian/Embedded Glassfish, but it doesn't contain any logfiles.
How can i activate logging in Embedded Glassfish?
By the way, i have the following dependencies in my pom:
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3</artifactId>
<version>1.0.0.Alpha4</version>
</dependency>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1-b06</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-testng</artifactId>
<version>1.0.0.Alpha4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
I had a lot of difficulty with exactly the same problem using arquillian , testng and embedded glassfish. After a few hours I managed to get it working
What I found was that arquillian has a dependency on version 1.5.9.RC1 of slf4j-simple which uses the slf4j-api.
To get it working I added the property
<properties>
<version.slf4j>1.5.9.RC1</version.slf4j>
</properties>
and the dependencies
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${version.slf4j}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
and then under dependency management
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${version.slf4j}</version>
</dependency>
</dependencies>
</dependencyManagement>
once I had this I added my usual log4j.properties file to src/test/resources and everything worked fine.
Cheers