3

I developed application client by Java and it was running normally by Glassfish ..

But after moving to Wildfly .. i'm facing this error :

Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0161: Failed to get manifest for deployment \"/content/Application.jar\" Caused by: java.io.IOException: line too long"}}

I expect the error is because of the long line of Class-Path in Manifest.mf file.

Class-Path: ../lib/jaybird-2.1.6.jar ../lib/rtfparserkit-1.6.0.jar ../lib/jug-lgpl-2.0.0.jar ../lib/mysql-connector-java-5.1.37-bin.jar ../lib/trilead-ssh2-build213.jar ../lib/wsdl4j-1.6.2.jar ../lib/wsdl4j-qname-1.6.1.jar ../lib/xmlbeans-2.6.0.jar ../lib/poi-3.11-20141221.jar ../lib/poi-ooxml-3.11-20141221.jar ../lib/poi-ooxml-schemas-3.11-20141221.jar ../lib/jersey-apache-client-1.16.jar ../lib/jersey-bundle-1.16.jar ../lib/jersey-core-1.16.jar ../lib/jersey-client-1.16.jar ../lib/jackson-core-asl-1.9.13.jar ../lib/jackson-mapper-asl-1.9.2.jar ../lib/js-14.jar ../lib/drools-core-5.0.1.jar ../lib/activemq-all-5.10.0.jar ../lib/json-simple-1.1.1.jar ../lib/commons-io-2.4.jar ../lib/javassist.jar ../lib/scannotation-1.0.2.jar ../lib/j-text-utils-0.3.3.jar ../lib/commons-lang-2.6.jar ../lib/commons-net-3.3.jar ../lib/opencsv-2.4.jar ../lib/gson-2.2.4.jar ../lib/httpclient-4.3.5.jar ../lib/commons-vfs-20100924-pentaho.jar ../lib/log4j-1.2.17.jar ../lib/commons-logging-1.1.3.jar ../lib/spring-core-3.1.4.RELEASE.jar ../lib/commons-digester-2.1.jar ../lib/commons-beanutils-1.9.2.jar ../lib/ognl-2.7.3.jar ../lib/jxl-2.6.3.jar ../lib/metastore-5.0.1.jar ../lib/edtftpj-2.1.0.jar ../lib/kettle5-log4j-plugin-5.1.0.0-752.jar ../lib/kettle-db-4.4.0-stable.jar ../lib/janino-2.5.16.jar ../lib/commons-compiler-2.7.8.jar

Is there any way else to load all jars inside a folder without typing this long line ? or How to avoid this error message ?

Jason4Ever
  • 1,439
  • 4
  • 23
  • 43
  • 1
    Possible duplicate of [Setting multiple jars in java classpath](http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath) – Tom Aug 23 '16 at 09:18
  • Did you wrap the line correctly? – Thorbjørn Ravn Andersen Aug 23 '16 at 09:36
  • @Tom this is not a duplicate of the link you provided. It's a line wrapping problem in the Manifest.mf `Class-Path` entry. – Steve C Aug 23 '16 at 11:50
  • @SteveC You're right, since OP didn't ask *"Is there any way else to load all jars inside a folder without typing this long line ?"* ... – Tom Aug 23 '16 at 12:56

3 Answers3

3

The manifest-file must not contain lines longer than 72 bytes.

You have to break the line after exact 72 bytes.

Class-Path: ../lib/jaybird-2.1.6.jar ../lib/rtfparserkit-1.6.0.jar ../l
 ib/jug-lgpl-2.0.0.jar ../lib/mysql-connector-java-5.1.37-bin.jar ../li
 b/trilead-ssh2-build213.jar ../lib/wsdl4j-1.6.2.jar ../lib/wsdl4j-qnam
 e-1.6.1.jar ...

Look for Line length in the specification:

http://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#JAR_Manifest

Alternative: Do not use the classpath in Manifest. Instead start with commandline argument:

java -cp lib/* mainclass
haridsv
  • 9,065
  • 4
  • 62
  • 65
Tobias Otto
  • 1,634
  • 13
  • 20
  • The usual strategy is to have your build tool generate this entry for you. I know that Maven can do this. – Steve C Aug 23 '16 at 11:53
  • How can i use `java -cp` with `appclient.sh` for `wildfly` ? – Jason4Ever Aug 23 '16 at 14:25
  • @Jason4Ever Sorry, I don´t know _appclient.sh for wildfly_. Is this file generated? As @Steve C posted, normally we don´t write this by hand, but it get´s generated. My alternative `java -cp lib/*' is for the console (cmd, bash, terminal etc.). – Tobias Otto Aug 23 '16 at 14:34
1

Make an uber jar containing all the others.

Andres
  • 10,561
  • 4
  • 45
  • 63
0

FWIW: After some time looking for a solution to this problem, and I finally found something that works. I tested it successfully on both Windows 10 with java 1.8.0_241 and on Linux Mint 19.1 with java 1.8.0_241

Notice that each classpath entry after the "Class-path:" line is indented 2 spaces, although that might not be required. Here's my MANIFEST.MF file:

Manifest-Version: 1.0
Scala-Compiler-Version: 2.12.10
Main-Class: Main
Class-Path: /opt/uejlib2.12/vastblue_2.12.jar
  /opt/uejlib2.12/apps_2.12.jar
  /opt/uejlib2.12/scala-reflect.jar
  /opt/uejlib2.12/scala-library.jar
  /opt/uejlib2.12/better-files_2.12-3.8.0.jar
  /opt/uejlib2.12/scala-collection-compat_2.12-2.1.3.jar
  /opt/uejlib2.12/chronoscala_2.12-0.3.2.jar
  /opt/uejlib2.12/sfm-csv-8.2.1.jar
  /opt/uejlib2.12/sfm-map-8.2.1.jar
  /opt/uejlib2.12/lightning-csv-8.2.1.jar
  /opt/uejlib2.12/sfm-tuples-8.2.1.jar
  /opt/uejlib2.12/sfm-reflect-8.2.1.jar
  /opt/uejlib2.12/sfm-converter-8.2.1.jar
  /opt/uejlib2.12/sfm-util-8.2.1.jar
philwalk
  • 634
  • 1
  • 7
  • 15