Skip to main content
1-Visitor
April 22, 2017
Question

How to solve JAR file cross platform issue? JAR file created on windows is facing issue on Linux machine.

  • April 22, 2017
  • 1 reply
  • 6141 views

Hi all,

I have created a custom action in quick links and provided location match in apache configuration file and mapped servlet in web.xml file. I have a JAR file that i compiled on windows machine. Since it is an OOTB requirement I have placed it in codebase/WEB-INF/lib folder. Now I have to test it on client test server which is a linux machine.

Action model and action is being displayed and performing required action but my main logic is in JAR file. Issue I am facing is mapped link is not able to access the class file and process to perform properly.

I have changed the user group, ownership and file permissions but still it is not able to enter into JAR file. Should I make any changes to manifest file? or how to proceed with this?

I am stuck at this point from a long time. It will be of great help if anybody could guide me through this.

1 reply

15-Moonstone
April 24, 2017

Hi,

A jar file should be usable everywhere, no need to change anything in a manifest file or whatever.

Maybe the file is corrupted by the transfert Windows-Unix. ( like FTP in ASCII mode instead of BINARY mode )

or you don't have the same version of Java on the linux server as the one used to build the jar file.

What I whould do is to test the file with the jar command.

something like

jar tvf $WT_HOME/codebase/WEB-INF/lib/MyJar.jar

Be sure to use the JDK used by PDMLink, you may have some openjdk installed somewhere ...

you can do a

type jar

to see the path to the jar command, or use an absolute path.

You may have some permissions issues ( file copied by the root user ), but as you already checked it, it should be ok.

Just in caase, you can do a

ls -al $WT_HOME/codebase/WEB-INF/lib/

to compare the files ownerships and access rights.

Vinay_S1-VisitorAuthor
1-Visitor
May 9, 2017

Hi Mr. Olivier fresse,


jar tvf $WT_HOME/codebase/WEB-INF/lib/MyJar.jar

tried the above command all the class files are displayed.

type jar

tried this command and got PDMLink JDK path getting displayed.

Permissions are perfect. But still same problem. Don't know what is going wrong!! It is working fine on Windows but on CENTOS  5.5 it is giving this problem. Have been working on it from a long time and have tried all the solutions suggested on user community and help center but nothing seems to work.

15-Moonstone
May 9, 2017

Hi,

Well, this is really strange.

Let's try to use the wt.util.jmx.Which

Use it with one of your  class used in your jar file.

For example , with a PDMLink class used in a jar in the WEB-INF/lib folder :

windchill wt.util.jmx.Which wt/security/WTJFileChooser.class

URL: jar:file:/opt/ptc/Windchill_11.0/Windchill/codebase/WEB-INF/lib/wncWeb.jar!/wt/security/WTJFileChooser.class

  Last Modified: Fri Dec 04 15:22:14 CET 2015

  Size: 5437

  CRC: 3427589292

If your class is correctly displayed, this is definitly not a corrupted file issue.

Maybe an issue in a configuration file.

If it works on windows, check the letters case. Capitals or lowercase characters differences have no effects on Windows, but do have on unix.

Or a folder separator : the never ending issue between '\' and '/' ...