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

Manifest of org.glassfish.hk2/hk2 generates false warnings #462

Open
Marco-Sulla opened this issue Jul 17, 2019 · 6 comments
Open

Manifest of org.glassfish.hk2/hk2 generates false warnings #462

Marco-Sulla opened this issue Jul 17, 2019 · 6 comments

Comments

@Marco-Sulla
Copy link

Marco-Sulla commented Jul 17, 2019

EDIT: see comment number 3


I'm using a Spring Boot 2 application that needs hk2 version 2.5.0-b42 as dependency. Gradle 5.4.1 downloads hk2.jar without problems, but not its dependencies. This happens only with hk2. It does not work also with version 2.5.0.

I checked on internet and there's people that have this problem with this library with maven too. One example:
https://stackoverflow.com/questions/54151711/the-class-path-manifest-attribute-in-path-referenced-one-or-more-files-that-do-n

EDIT: I also tried to explicitly set the dependencies, and also to change from Maven Central to JCenter, but nothing. I think for the moment I have to download them manually.

@Marco-Sulla
Copy link
Author

Marco-Sulla commented Jul 17, 2019

Furthermore the error is strange:

The Class-Path manifest attribute in /[...]/hk2-2.5.0-b42.jar referenced one or more files that do not exist: file:/[...]/javax.annotation-api.jar

It should not be javax.annotation-api.jar, but javax.annotation-api-2.5.0-b42.jar

Maybe there's something wrong in the MANIFEST?

@Marco-Sulla
Copy link
Author

Marco-Sulla commented Jul 17, 2019

Indeed the problem is in the MANIFEST. You use Class-Path, while you should use Import-Package and Export-Package.

Anyway, the error displayed is not blocking, since the required packages are anyway downloaded (I don't know how...).

Example from https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.9.9

Export-Package: com.fasterxml.jackson.module.jaxb;version="2.9.9";uses
 :="com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fa
 sterxml.jackson.databind,com.fasterxml.jackson.databind.cfg,com.faste
 rxml.jackson.databind.introspect,com.fasterxml.jackson.databind.jsont
 ype,com.fasterxml.jackson.databind.type,com.fasterxml.jackson.databin
 d.util,javax.xml.bind.annotation,javax.xml.bind.annotation.adapters",
 com.fasterxml.jackson.module.jaxb.deser;version="2.9.9";uses:="com.fa
 sterxml.jackson.core,com.fasterxml.jackson.databind,com.fasterxml.jac
 kson.databind.deser.std,javax.activation,javax.xml.parsers,org.w3c.do
 m",com.fasterxml.jackson.module.jaxb.ser;version="2.9.9";uses:="com.f
 asterxml.jackson.core,com.fasterxml.jackson.databind,com.fasterxml.ja
 ckson.databind.jsonFormatVisitors,com.fasterxml.jackson.databind.ser.
 std,javax.activation,org.w3c.dom"
Import-Package: com.fasterxml.jackson.annotation;version="[2.9,3)",com
 .fasterxml.jackson.core;version="[2.9,3)",com.fasterxml.jackson.core.
 util;version="[2.9,3)",com.fasterxml.jackson.databind;version="[2.9,3
 )",com.fasterxml.jackson.databind.cfg;version="[2.9,3)",com.fasterxml
 .jackson.databind.deser.std;version="[2.9,3)",com.fasterxml.jackson.d
 atabind.introspect;version="[2.9,3)",com.fasterxml.jackson.databind.j
 sonFormatVisitors;version="[2.9,3)",com.fasterxml.jackson.databind.js
 ontype;version="[2.9,3)",com.fasterxml.jackson.databind.jsontype.impl
 ;version="[2.9,3)",com.fasterxml.jackson.databind.node;version="[2.9,
 3)",com.fasterxml.jackson.databind.ser.std;version="[2.9,3)",com.fast
 erxml.jackson.databind.type;version="[2.9,3)",com.fasterxml.jackson.d
 atabind.util;version="[2.9,3)",com.fasterxml.jackson.module.jaxb.dese
 r;version="[2.9,3)",com.fasterxml.jackson.module.jaxb.ser;version="[2
 .9,3)",javax.activation,javax.xml.bind,javax.xml.bind.annotation,java
 x.xml.bind.annotation.adapters,javax.xml.parsers,org.w3c.dom

@Marco-Sulla Marco-Sulla changed the title Gradle / Maven does not downloads the dependencies of org.glassfish.hk2/hk2 Manifest of org.glassfish.hk2/hk2 generates false warnings Jul 17, 2019
@romain-grecourt
Copy link
Member

romain-grecourt commented Jul 17, 2019

Import-Package is used for OSGi, while Class-Path is used for creating the normal Java class-path when using java -jar.

Looking at the pom, I don't see anything wrong with the dependencies at first glance: http://repo1.maven.org/maven2/org/glassfish/hk2/hk2/2.5.0-b42/hk2-2.5.0-b42.pom

The entries in the generated class-path are correct, they don't have the version because that's how it's stated in the maven-jar-plugin configuration of the pom:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathLayoutType>custom</classpathLayoutType>
<customClasspathLayout>${artifact.artifactId}.${artifact.extension}</customClasspathLayout>
</manifest>
</archive>
</configuration>
</plugin>

Note that this artifact does not contain any code, it's more like a meta-module or meta-bundle that exposes HK2 as a module, it should probably not be included in your app.

  • What does your dependency tree looks like, what artifact(s) depend on it ?
  • What is the actual error you are facing in your Spring Boot application ?
  • How is your application packaged ?

@jogu
Copy link

jogu commented Oct 19, 2019

For info, I ran into this too; specifically I was getting this on starting the application:

The Class-Path manifest attribute in /Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.5.0-b42/hk2-2.5.0-b42.jar referenced one or more files that do not exist: file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.5.0-b42/hk2-utils.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.5.0-b42/javax.annotation-api.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.5.0-b42/javax.inject.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.5.0-b42/hk2-api.jar

in this project: https://gitlab.com/openid/conformance-suite

I discovered that upgrading to SpringBoot 2.2.0 (previously using 2.1.5) seems to stop the warning appearing.

jogu added a commit to openid-certification/conformance-suite that referenced this issue Oct 19, 2019
This avoids an annoying warning (and some unhelpful exceptions thrown &
caught) on starting the app:

eclipse-ee4j/glassfish-hk2#462

but probably also pulls in some security & other fixes, and generally
staying up to date seems like a good plan if it doesn't break anything.
jogu added a commit to openid-certification/conformance-suite that referenced this issue Oct 19, 2019
This avoids an annoying warning (and some unhelpful exceptions thrown &
caught) on starting the app:

eclipse-ee4j/glassfish-hk2#462

but probably also pulls in some security & other fixes, and generally
staying up to date seems like a good plan if it doesn't break anything.
@jogu
Copy link

jogu commented Oct 19, 2019

Sadly I was mistaken; upgrading to springboot 2.2.0 just made the error appear in a subtly different form/place; I still get:

2019-10-19 16:40:23.050 INFO 68679 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in /Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-2.6.1.jar referenced one or more files that do not exist: file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-utils.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/jakarta.annotation-api.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/jakarta.inject.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-api.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/aopalliance-repackaged.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-core.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-locator.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/javassist.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-runlevel.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/class-model.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-analysis.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-commons.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-tree.jar,file:/Users/joseph/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-util.jar

This is from building+running https://gitlab.com/openid/conformance-suite in IntellIiJ - dependency tree here:

https://gist.github.com/jogu/5c51b8368c45c04af43eecd6fe3d74f0

Project is packaged as a jar.

@romain-grecourt I think that answers all your questions; please let me know if there's any further questions.

@AriVagelatos-KSO
Copy link

i think its something to do with spring boot devtools, I am getting:


2022-01-23 14:13:59.526  INFO 49840 --- [  restartedMain] o.s.b.devtools.restart.ChangeableUrls    : The Class-Path manifest attribute in /Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-2.6.1.jar referenced one or more files that do not exist: 
file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-utils.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/jakarta.annotation-api.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/jakarta.inject.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-api.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/aopalliance-repackaged.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-core.jar,
file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-locator.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/javassist.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/hk2-runlevel.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/class-model.jar,
file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-analysis.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-commons.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-tree.jar,file:/Users/user/.m2/repository/org/glassfish/hk2/hk2/2.6.1/asm-util.jar

My dependencies are just the default:



<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.6.3</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants