Results 1 to 7 of 7
  1. #1
    atiz is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default executable jar encountering exceptions in 1 server but not the other

    Hi all,

    I have a standalone application (executable jar) in the production environment.
    Some exceptions were thrown stating that it cannot find certain class files, but the class files have been placed in the jar file before running it.

    I managed to get the production copy and place it in the UAT environment to test (different server) with the same data and to my surprise, no exceptions were thrown at all.

    Could it be due to some caching problem?

    Thanks for any advice,
    Atiz

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Are you exactly sure that missing class file is added into that your far file?

    What's the exact exception you get there?

  3. #3
    atiz is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default

    Hi Eranga,

    the class file is in the jar file.
    I used the exact same jar file in the UAT envmt, process the same data without any errors.
    Only in the production envmt does this error occurs.

    org.hibernate.MappingException: Unknown entity: com.eds.app.aps.valueobject.mqhaVo

    Therefore, I can conclude that there is nothing wrong with the jar file.
    Perhaps it is due to the operating system caching it somewhere?

    Atiz

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Go to a command line, move to the directory with your JAR, and try

    java -cp jarname.jar;otherpath;etc; -jar jarname
    Last edited by Steve11235; 01-09-2009 at 08:04 PM. Reason: colons turned into smiles

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  6. #6
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I found several posts on other forums indicating problems with class not found when the JAR is not explicitly mentioned on the classpath. I let Eclipse build my JAR files, so I don't know a lot about JAR manifests, but missing attributes in the manifest seemed to contribute to the problem.

    I should have said, "Explicitly specify the JAR file on the classpath."

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Let your IDE to build the jar package is much easier actually.

    But in some cases you may want to build it manually. And I think it's much better if you know how build jar files manually.

    There is header field called Class-Path in menifest file, which is used to define the addition jar files.

    And also you have set the class path in your system to run your jar file anywhere.

Similar Threads

  1. Need Help With Exceptions
    By maggie_2 in forum New To Java
    Replies: 5
    Last Post: 12-15-2008, 08:12 PM
  2. executable
    By smooth in forum New To Java
    Replies: 4
    Last Post: 06-14-2008, 06:12 PM
  3. Executable JAR
    By bugger in forum New To Java
    Replies: 4
    Last Post: 12-05-2007, 06:41 PM
  4. Runtime Exceptions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-12-2007, 11:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •