jleenk
(Oleg Yakushev)
May 2, 2015, 11:02am
1
Hello.
I have piece of code which generates a MANIFEST.MF file:
manifest {
attributes('Manifest-Version': '0.1',
'Class-Path': ' quartz-1.6.1-RC3.jar \n' +
' log4j-1.2.14.jar \n' +
' commons-beanutils-1.7.0.jar \n' +
' commons-codec-1.3.jar \n' +
' commons-collections-3.1.jar \n' +
' commons-digester-1.6.jar \n' +
' commons-el-1.0.jar \n' +
' commons-fileupload-1.2.jar \n' +
' commons-lang-2.1.jar \n' +
' commons-logging-1.1.jar \n' +
' commons-validator-1.3.1.jar \n' +
' core-3.1.1.jar \n' +
' oro-2.0.8.jar \n' +
' jldap-4.3.jar \n' +
' commons-io-1.4.jar \n' +
' poi-3.7.jar \n' +
' itext-2.1.7.jar \n' +
' jasperreports-4.5.0.jar \n' +
' jfreechart-1.0.13.jar \n' +
' jcommon-1.0.21.jar')
writeTo("src/main/webapp/META-INF/MANIFEST1.MF")
}
I expected to see in a file something like this:
Manifest-Version: 0.1
Class-Path: quartz-1.6.1-RC3.jar
log4j-1.2.14.jar
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.1.jar
commons-digester-1.6.jar
commons-el-1.0.jar
commons-fileupload-1.2.jar
commons-lang-2.1.jar
commons-logging-1.1.jar
commons-validator-1.3.1.jar
core-3.1.1.jar
oro-2.0.8.jar
jldap-4.3.jar
commons-io-1.4.jar
poi-3.7.jar
itext-2.1.7.jar
jasperreports-4.5.0.jar
jfreechart-1.0.13.jar
jcommon-1.0.21.jar
but I got this:
Manifest-Version: 0.1
Class-Path: quartz-1.6.1-RC3.jar
log4j-1.2.14.jar
commons-beanutil
s-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.1.jar
c
ommons-digester-1.6.jar
commons-el-1.0.jar
commons-fileupload-1.2
.jar
commons-lang-2.1.jar
commons-logging-1.1.jar
commons-valid
ator-1.3.1.jar
core-3.1.1.jar
oro-2.0.8.jar
jldap-4.3.jar
com
mons-io-1.4.jar
poi-3.7.jar
itext-2.1.7.jar
jasperreports-4.5.0
.jar
jfreechart-1.0.13.jar
jcommon-1.0.21.jar
My server can’t read it. I guess it’s bug
sterling
(Sterling Greene)
May 2, 2015, 12:13pm
2
It’s wrapping at the 72-byte limit .
Have you tried…
manifest {
def classpathEntries = [ 'quartz-1.6.1-RC3.jar',
'log4j-1.2.14.jar',
'commons-beanutils-1.7.0.jar',
'commons-codec-1.3.jar',
'commons-collections-3.1.jar',
'commons-digester-1.6.jar',
'commons-el-1.0.jar',
'commons-fileupload-1.2.jar',
'commons-lang-2.1.jar',
'commons-logging-1.1.jar',
'commons-validator-1.3.1.jar',
'core-3.1.1.jar',
'oro-2.0.8.jar',
'jldap-4.3.jar',
'commons-io-1.4.jar',
'poi-3.7.jar',
'itext-2.1.7.jar',
'jasperreports-4.5.0.jar',
'jfreechart-1.0.13.jar',
'jcommon-1.0.21.jar' ]
attributes('Manifest-Version': '0.1',
'Class-Path': classpathEntries.join(" "))
writeTo("src/main/webapp/META-INF/MANIFEST1.MF")
}
The Class-Path attribute seemed right when I checked with:
import java.util.jar.*
task checkJar() {
dependsOn jar
doLast {
def jarfile = new JarFile(jar.archivePath)
def attributes = jarfile.manifest.getMainAttributes()
def classpath = attributes[Attributes.Name.CLASS_PATH]
println classpath
}
}
Where does your list of jars come from?
jleenk
(Oleg Yakushev)
May 2, 2015, 1:06pm
3
Yes I tried variant without “\n” and I got:
Manifest-Version: 0.1
Class-Path: quartz-1.6.1-RC3.jar log4j-1.2.14.jar commons-beanutils-1.
7.0.jar commons-codec-1.3.jar commons-collections-3.1.jar commons-dig
ester-1.6.jar commons-el-1.0.jar commons-fileupload-1.2.jar commons-l
ang-2.1.jar commons-logging-1.1.jar commons-validator-1.3.1.jar core-
3.1.1.jar oro-2.0.8.jar jldap-4.3.jar commons-io-1.4.jar poi-3.7.jar
itext-2.1.7.jar jasperreports-4.5.0.jar jfreechart-1.0.13.jar jcommon
-1.0.21.jar
Server also doesn’t read this file.
I create this file manually and place it in jar and war archives. I place jar and war archives in a ear archive so me need a correct manifest for jar and war archives. They use libraries from manifest and libraries I put in ear archive.
Should this be
writeTo("src/main/webapp/META-INF/MANIFEST.MF")
jleenk
(Oleg Yakushev)
May 2, 2015, 3:03pm
5
I know. It’s only for example. I compare MANIFEST1.MF (generated version) and MANIFEST.MF(working version) in my sources.
sterling
(Sterling Greene)
May 2, 2015, 6:06pm
6
That appears to be correct. I’ve confirmed locally that I can run jars with wrapped classpaths like that.
Which app server are you using to load the EARs? Maybe it’s not doing something right. By default, the JVM tries to load the jars relative to the jar with the manifest on the filesystem. It doesn’t know how to load jars inside an archive.
Do you have a working manifest for the same project built some other way?
jleenk
(Oleg Yakushev)
May 2, 2015, 8:43pm
7
I work with weblogic 10.3.6. My project can find jar archives before first broken record. In my case if we see on last example, it will quartz-1.6.1-RC3.jar and log4j-1.2.14.jar. Project doesn’t see other archives after that record (commons-beanutils-1.). Although when I put correct manifest without broken records my project see them all so I guess that problem in broken records
I’ve found way how it to avoid but it is not comfortable:
manifest {
attributes('Manifest-Version': '0.1',
'Class-Path': 'ru.bpc.sv.ejb.authClient.jar ' +
' ru.bpc.sv.ejb.svboClient.jar \n' +
' ru.bpc.sv.ejb.svfeClient.jar ' +
' quartz-1.6.1-RC3.jar \n' +
' log4j-1.2.14.jar \n' +
' commons-beanutils-1.7.0.jar' +
' commons-codec-1.3.jar \n' +
' commons-collections-3.1.jar ' +
' commons-digester-1.6.jar \n' +
' commons-el-1.0.jar ' +
' commons-fileupload-1.2.jar \n' +
' commons-lang-2.1.jar ' +
' commons-logging-1.1.jar \n' +
' commons-validator-1.3.1.jar ' +
' core-3.1.1.jar \n' +
' oro-2.0.8.jar \n' +
' jldap-4.3.jar \n' +
' commons-io-1.4.jar ' +
' poi-3.7.jar \n' +
' itext-2.1.7.jar \n' +
' ru.bpc.sv.commonItems.jar ' +
' jasperreports-4.5.0.jar \n' +
' jfreechart-1.0.13.jar \n' +
' jcommon-1.0.21.jar')
}
jleenk
(Oleg Yakushev)
May 3, 2015, 12:26pm
8
I’ve found problem. It’s my inattention so I’m sorry for botheration.
smalviy
(Seema)
March 22, 2016, 7:23pm
9
What was the problem? I am also facing the similar issue
jleenk
(Oleg Yakushev)
March 23, 2016, 8:28am
10
It was much time ago so I can’t remember now what exactly I did, sorry. Although I remember that I changed name sequence in class-path.