cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

15-Moonstone

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

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.

Vinay S.
Bengaluru.
10 REPLIES 10
13-Aquamarine
(To:Vinay_S)

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.

15-Moonstone
(To:olivierfresse)

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.

Vinay S.
Bengaluru.
13-Aquamarine
(To:Vinay_S)

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 '/' ...

15-Moonstone
(To:olivierfresse)

Hi,

I tried this command wt.util.jmx.Which and all the files are fine. It displayed URL last modified and other details also. I checked for slashes also everything is proper. I then recompiled the jar file but still same problem.

Let me explain my scenario:

abc.jar is my main jar inside that is directoryA\directoryB\directoryC\xyz.class and directoryA\directoryB\directoryD\def.class  .

first logic process xyz.class and then redirects to def.class . But the problem is processing is only happening for xyz.class and it is not going to def.class.

If you don't mind, can you please let me know once a customized jar file is added to windchill, what are all the steps to be performed to get that customization work. This is to verify if I have somewhere lost/skipped any step in between. Thank you in advance.

Vinay S.
Bengaluru.
13-Aquamarine
(To:Vinay_S)

Hi,

Well, adding a jar in folder like codebase/WEB-INF/lib is enough to get it used by PDMLink.

But I dont understand this 'redirect'

Are you trying to create a new instance of the def class, call a method on it ?

15-Moonstone
(To:olivierfresse)

Hi Olivier,

call to method inside the class that displays link for page redirection is not happening. Link is not displaying on the new page. A page is opening but the link is not displaying.

Vinay S.
Bengaluru.
12-Amethyst
(To:Vinay_S)

Are you trying to access classes from different packages? I assume you mean package path by directory A > directory B > directory C. If that's the case, you need to import the full reference of def in your xyz.class

15-Moonstone
(To:BineshKumar1)

Hi Binesh,

In eclipse while building project I have imported all the external JARs that provides references. Have configured eclipse with Mahesh Mhetre 's Blogs: Windchill-Eclipse Project Setup this as base information.

Vinay S.
Bengaluru.
12-Amethyst
(To:Vinay_S)

Hi Vinay,

I was talking about adding the import statement for xyz in your def class. It's a bit difficult to visualize what you are tying to achieve. One thing which you can try is turn on the action related loggings in logjMethodserver.properties, add sysouts or debug in your code to understand the call stack.

15-Moonstone
(To:BineshKumar1)

Hi,

I had added all the import statements. I thought the problem was with port. Initially I had written code for default port 80 but client machine was using 8080 then again compiled code for 8080 and replaced jar but still no effect. I am able to get partial output for what I am working on but not exactly how i want. I want the user to come out of the session without closing the webpage. I am able to get it done but to login back, user has to refresh the page few times which is carried out manually I want it to be done in the backend itself.

Vinay S.