You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Matthias Korn <ma...@binaervarianz.de> on 2009/09/01 22:21:21 UTC

[Axis2] Including/referencing external libraries

Hi,

my axis2.war 1.4.1 in a Tomcat is running multiple web services who are
all accessing the same database and other common stuff. Thus I created
a Java class handling all this in one place. I want all web services to
use this class.

How can I integrate this into my axis2 setup? Where do I put the
class/library so my services can find it? Does the external
library/class has to meet any specific criteria?

Currently I am getting something along the lines: java.lang.Error:
Unresolved compilation problems: The import <package> cannot be
resolved FooBar cannot be resolved to a type

I tried many (if not all) variations in terms of location and packaging.

The documentation isn't very verbose about this. Actually, I couldn't
find it anywhere....


Hope someone can send me in the right direction.

Thanks,
Matthias

Re: [Axis2] Including/referencing external libraries

Posted by Matthias Korn <ma...@binaervarianz.de>.
Hi,

Am Wed, 2 Sep 2009 10:04:14 +0530
schrieb Amila Suriarachchi <am...@gmail.com>:

> put them to webapps/axis2/WEB-INF/lib

that's what I tried first and it doesn't work! (With the error message
below)

I tried both: just the single class file and packaged in a jar. The
class itself has nothing special. No special inheritance. No
implemented interfaces. Just a simple java class. Is that all correct?

How can I troubleshoot this?

Thanks,
Matthias

> thanks
> Amila.
> 
> On Wed, Sep 2, 2009 at 1:51 AM, Matthias Korn
> <ma...@binaervarianz.de>wrote:
> 
> > Hi,,
> >
> 
> 
> >
> > my axis2.war 1.4.1 in a Tomcat is running multiple web services who
> > are all accessing the same database and other common stuff. Thus I
> > created a Java class handling all this in one place. I want all web
> > services to use this class.
> >
> > How can I integrate this into my axis2 setup? Where do I put the
> > class/library so my services can find it? Does the external
> > library/class has to meet any specific criteria?
> >
> > Currently I am getting something along the lines: java.lang.Error:
> > Unresolved compilation problems: The import <package> cannot be
> > resolved FooBar cannot be resolved to a type
> >
> > I tried many (if not all) variations in terms of location and
> > packaging.
> >
> > The documentation isn't very verbose about this. Actually, I
> > couldn't find it anywhere....
> >
> >
> > Hope someone can send me in the right direction.
> >
> > Thanks,
> > Matthias
> >
> 
> 
> 

Re: [Axis2] Including/referencing external libraries

Posted by Amila Suriarachchi <am...@gmail.com>.
put them to webapps/axis2/WEB-INF/lib

thanks
Amila.

On Wed, Sep 2, 2009 at 1:51 AM, Matthias Korn <ma...@binaervarianz.de>wrote:

> Hi,,
>


>
> my axis2.war 1.4.1 in a Tomcat is running multiple web services who are
> all accessing the same database and other common stuff. Thus I created
> a Java class handling all this in one place. I want all web services to
> use this class.
>
> How can I integrate this into my axis2 setup? Where do I put the
> class/library so my services can find it? Does the external
> library/class has to meet any specific criteria?
>
> Currently I am getting something along the lines: java.lang.Error:
> Unresolved compilation problems: The import <package> cannot be
> resolved FooBar cannot be resolved to a type
>
> I tried many (if not all) variations in terms of location and packaging.
>
> The documentation isn't very verbose about this. Actually, I couldn't
> find it anywhere....
>
>
> Hope someone can send me in the right direction.
>
> Thanks,
> Matthias
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: [SOLVED but UNCLEAR] [Axis2] Including/referencing external libraries

Posted by Matthias Korn <ma...@binaervarianz.de>.
Hi,

Am Wed, 02 Sep 2009 08:37:56 -0400
schrieb Deepal jayasinghe <de...@gmail.com>:

[Referencing external class/library]

> >     Currently I am getting something along the lines:
> > java.lang.Error: Unresolved compilation problems: The import
> > <package> cannot be resolved FooBar cannot be resolved to a type
> >
> >
> > you can also add the common jars to services/lib (you need to
> > create a lib folder)
> >
> > But this error is very strange. I should give a ClassNotFound
> > exception if it can not
> > find the class.
> Is it because some mismatching compile versions?

Yes, that seemed to be the root of the problem although I don't quite
understand it:

Both the service and the library were build with Java 1.5.0_19 on my
development machine. The service alone and the library alone (on the
command line) are running fine on the server (Java 1.6.0_07). The
combination of both does not seem to run. Why is that????

Also, shouldn't there be some form of backward compatibility for
classes compiled in java 1.5. and running on 1.6??? (I'm not very
deeply involved in this whole Java eco system...)

I now just recompiled both the service and the library on the server
and it worked.

Hope someone can clarify this for me!

Best & Thanks,
Matthias

Re: [Axis2] Including/referencing external libraries

Posted by Deepal jayasinghe <de...@gmail.com>.
Amila Suriarachchi wrote:
>
>
> On Wed, Sep 2, 2009 at 1:51 AM, Matthias Korn <matsch@binaervarianz.de
> <ma...@binaervarianz.de>> wrote:
>
>     Hi,
>
>     my axis2.war 1.4.1 in a Tomcat is running multiple web services
>     who are
>     all accessing the same database and other common stuff. Thus I created
>     a Java class handling all this in one place. I want all web
>     services to
>     use this class.
>
>     How can I integrate this into my axis2 setup? Where do I put the
>     class/library so my services can find it? Does the external
>     library/class has to meet any specific criteria?
>
>     Currently I am getting something along the lines: java.lang.Error:
>     Unresolved compilation problems: The import <package> cannot be
>     resolved FooBar cannot be resolved to a type
>
>
> you can also add the common jars to services/lib (you need to create a
> lib folder)
>
> But this error is very strange. I should give a ClassNotFound
> exception if it can not
> find the class.
Is it because some mismatching compile versions?

Re: [Axis2] Including/referencing external libraries

Posted by Matthias Korn <ma...@binaervarianz.de>.
Hi,

Am Wed, 2 Sep 2009 13:28:17 +0530
schrieb Amila Suriarachchi <am...@gmail.com>:

> On Wed, Sep 2, 2009 at 1:51 AM, Matthias Korn
> <ma...@binaervarianz.de>wrote:

[Referencing an external library/class.]

> > Currently I am getting something along the lines: java.lang.Error:
> > Unresolved compilation problems: The import <package> cannot be
> > resolved FooBar cannot be resolved to a type
> 
> you can also add the common jars to services/lib (you need to create
> a lib folder)

I keep getting the same error no matter where I put or not put the
class.

> But this error is very strange. I should give a ClassNotFound
> exception if it can not
> find the class.

So I guess I should be looking into other reasons for this problem.
Could it be compiled with the wrong version (both the service and the
class use the same Java version/compiler)? What else?

What's this error message telling me exactly anyway?

Thanks,
Matthias

> thanks,
> Amila.
> 
> >
> > I tried many (if not all) variations in terms of location and
> > packaging.
> >
> > The documentation isn't very verbose about this. Actually, I
> > couldn't find it anywhere....
> >
> >
> > Hope someone can send me in the right direction.
> >
> > Thanks,
> > Matthias
> >
> 
> 
> 

Re: [Axis2] Including/referencing external libraries

Posted by Amila Suriarachchi <am...@gmail.com>.
On Wed, Sep 2, 2009 at 1:51 AM, Matthias Korn <ma...@binaervarianz.de>wrote:

> Hi,
>
> my axis2.war 1.4.1 in a Tomcat is running multiple web services who are
> all accessing the same database and other common stuff. Thus I created
> a Java class handling all this in one place. I want all web services to
> use this class.
>
> How can I integrate this into my axis2 setup? Where do I put the
> class/library so my services can find it? Does the external
> library/class has to meet any specific criteria?
>
> Currently I am getting something along the lines: java.lang.Error:
> Unresolved compilation problems: The import <package> cannot be
> resolved FooBar cannot be resolved to a type
>

you can also add the common jars to services/lib (you need to create a lib
folder)

But this error is very strange. I should give a ClassNotFound exception if
it can not
find the class.

thanks,
Amila.

>
> I tried many (if not all) variations in terms of location and packaging.
>
> The documentation isn't very verbose about this. Actually, I couldn't
> find it anywhere....
>
>
> Hope someone can send me in the right direction.
>
> Thanks,
> Matthias
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/