Jason4Ever
Jason4Ever

Reputation: 1479

Class-Path line too long

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 ?

Upvotes: 5

Views: 3863

Answers (3)

philwalk
philwalk

Reputation: 674

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

Upvotes: 1

Tobias Otto
Tobias Otto

Reputation: 1676

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

Upvotes: 4

Andres
Andres

Reputation: 10725

Make an uber jar containing all the others.

Upvotes: 1

Related Questions