[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.java.programmer

classpath issue

Eric Douglas

6/14/2016 8:30:00 PM

What am I missing if I run a JNLP which has this line in it

<jar href="Public/httpclient-4.5.1.jar"/>

and I get this error:

Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest

Obviously that class exists, so the error must mean something other than what it says?
8 Answers

Lew

6/14/2016 8:35:00 PM

0

On Tuesday, June 14, 2016 at 1:30:10 PM UTC-7, Eric Douglas wrote:
> What am I missing if I run a JNLP which has this line in it
>
> <jar href="Public/httpclient-4.5.1.jar"/>
>
> and I get this error:
>
> Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
>
> Obviously that class exists, so the error must mean something other than what it says?

It just doesn't exist anywhere that your environment can find it.

Hint: The error means *exactly* what it says.

--
Lew

Eric Douglas

6/14/2016 8:51:00 PM

0

On Tuesday, June 14, 2016 at 4:35:41 PM UTC-4, Lew wrote:
> On Tuesday, June 14, 2016 at 1:30:10 PM UTC-7, Eric Douglas wrote:
> > What am I missing if I run a JNLP which has this line in it
> >
> > <jar href="Public/httpclient-4.5.1.jar"/>
> >
> > and I get this error:
> >
> > Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
> >
> > Obviously that class exists, so the error must mean something other than what it says?
>
> It just doesn't exist anywhere that your environment can find it.
>
> Hint: The error means *exactly* what it says.
>
> --
> Lew

It's in the resources section, same place it found all the other jars.

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

6/14/2016 10:53:00 PM

0

On 6/14/2016 4:29 PM, Eric Douglas wrote:
> What am I missing if I run a JNLP which has this line in it
>
> <jar href="Public/httpclient-4.5.1.jar"/>
>
> and I get this error:
>
> Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
>
> Obviously that class exists, so the error must mean something other than what it says?

Java does not find the class. If the class is in the jar file, then the
most obvious explanation is that Java can not get the jar file.

Is the path correct?

If served via HTTP can you see if the jar file is actually downloaded?

Arne


Andreas Leitgeb

6/14/2016 11:21:00 PM

0

Eric Douglas <e.d.programmer@gmail.com> wrote:
> What am I missing if I run a JNLP which has this line in it
> <jar href="Public/httpclient-4.5.1.jar"/>
> and I get this error:
> Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
> Obviously that class exists, so the error must mean something other than what it says?

It may be worth looking for "Root cause"s, or "nested exceptions".
They might point out what really went wrong - maybe some kind of
download error specific to that one jar file.

If you saw the exception in a logfile, then root causes or nested
exceptions follow right after the stack-trace of the outermost
exception, and there may be more than one root cause.

If you saw it in the error-details dialog of a jnlp-application,
then there is problably another tab for nested exceptions, besides
the one with the main exception, and one showing the jnlp-document,...

Stanimir Stamenkov

6/14/2016 11:27:00 PM

0

Tue, 14 Jun 2016 13:29:56 -0700 (PDT), /Eric Douglas/:

> What am I missing if I run a JNLP which has this line in it
>
> <jar href="Public/httpclient-4.5.1.jar"/>
>
> and I get this error:
>
> Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
>
> Obviously that class exists, so the error must mean something other than what it says?

See if there are previous errors that prevented the class from
loading (errors during class initialization). I've had such
experiences, and subsequent references to the class confusingly have
been reported as NoClassDefFoundError.

--
Stanimir

Roedy Green

6/15/2016 8:30:00 AM

0

On Tue, 14 Jun 2016 13:29:56 -0700 (PDT), Eric Douglas
<e.d.programmer@gmail.com> wrote:

><jar href="Public/httpclient-4.5.1.jar"/>

did you mean "public".

See
http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEF...

It has so many causes.

IIRC there is a way of embedding something in your jar that directs
java to also look in another jar. That might work where JNLP fails.


Are there idiotic rules all jars must be signed with the same cert?

Eric Douglas

6/15/2016 3:06:00 PM

0

On Wednesday, June 15, 2016 at 4:30:20 AM UTC-4, Roedy Green wrote:
> did you mean "public".
>
> See
> http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEF...
>
> It has so many causes.
>
> IIRC there is a way of embedding something in your jar that directs
> java to also look in another jar. That might work where JNLP fails.
>
>
> Are there idiotic rules all jars must be signed with the same cert?

No I meant Public, the name of the folder under the folder the web service is pointing to, the same folder all the other jars are in which it does find as it does some processing before it gets this error. The codebase= points to the local domain web server, setup on IIS.

You can see that class is in the jar. This is a publicly available jar.
http://mvnrepository.com/artifact/org.apache.httpcomponents/httpcl...

It's a Java Console error, not a JNLP dialog error.
The message is:
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
at ... (my custom class from another jar in the same path)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods..HttpUriRequest
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 25 more

All jars referenced by the JNLP are signed, by the same cert.

I can run this Java program from a command line using a -cp classpath referencing exactly the same list of jars in the JNLP resources section without error.

Lew

6/15/2016 7:25:00 PM

0

On Tuesday, June 14, 2016 at 1:51:25 PM UTC-7, Eric Douglas wrote:
> On Tuesday, June 14, 2016 at 4:35:41 PM UTC-4, Lew wrote:
> > On Tuesday, June 14, 2016 at 1:30:10 PM UTC-7, Eric Douglas wrote:
> > > What am I missing if I run a JNLP which has this line in it
> > >
> > > <jar href="Public/httpclient-4.5.1.jar"/>
> > >
> > > and I get this error:
> > >
> > > Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
> > >
> > > Obviously that class exists, so the error must mean something other than what it says?
> >
> > It just doesn't exist anywhere that your environment can find it.
> >
> > Hint: The error means *exactly* what it says.
> >
> > --
> > Lew
>
> It's in the resources section, same place it found all the other jars.

What resources section? You haven't shown us any of that.

Nevertheless, whatever unfounded claims you make, the compiler and runtime see what they see for real. The error does mean exactly what it says. For you to decide otherwise is for you never to diagnose the problem.

--
Lew