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 Johan Lundberg <jo...@NotSoHotMail.com> on 2006/09/21 16:58:21 UTC
[Axis2] context lookup issue
I am using Axis2 nightly build from 31 August and cannot lookup the
java:comp/env context from a created InitialContext created inside a
class in the aar-file
When I do this:
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:comp/env");
I get a NameNotFoundException.
By the way, I am using the distributed axis2.war in tomcat 5.5.17
Any ideas?
johan
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] context lookup issue
Posted by Davanum Srinivas <da...@gmail.com>.
Folks,
Please create a JIRA issue, so that we can track and fix the problem.
thanks,
dims
On 9/21/06, robert lazarski <ro...@gmail.com> wrote:
> Other way around ... I was suggesting you get a reference to some
> class from WEB-INF/classes that your servlet sets up, that you call
> from inside the aar . It shouldn't be your servlet - use a singleton
> perhaps.
>
> I really don't understand why you could get a bound InitalContext
> inside WEB-INF/classes but not inside the aar. I don't think its a 1.0
> versus a nightly issue. It might be the other user didn't get the
> connection instatiated from inside the aar. What I was suggesting is a
> work around ... if the InitialContext works in WEB-INF/classes, store
> it there and then get it via one of the classic ServiceLocator pattern
> implementations. Sorry I don't have any easier ideas.
>
> Robert
>
> On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> > I'm not sure how I could get a reference to the ServiceClass in
> > WEB-INF/classes. Can you be more specific cause I feel a bit isolated
> > inside my aar.
> >
> > also:
> > Gábor Prótár got this working the way I intended it to initially. Check
> > the thread 'Tomcat + Axis2 + MySQL' fist post from 9/19 2006 2:08 PM
> > But he is using the Axis2 release 1.0 and I am using a later nightly
> > build from August 31.
> > Was he just lucky and am I experiencing the expected axis2 behavior?
> >
> > /johan
> >
> >
> >
> > robert lazarski wrote:
> > > Well it might be a classloader issue because an aar uses a different
> > > classloader than a servlet. You can of course have an aar which can
> > > see classes in a higher classloader - for example you can have an aar
> > > whcih references your ServiceClass that is placed in WEB-INF/lib or
> > > WEB-INF/classes ... but the aar itself merely contains just the
> > > services.xml . I'd try that. Or alternatively you can have you Servlet
> > > init a singleton or something and just get your connection from that
> > > inside the service.
> > >
> > > HTH,
> > > Robert
> > >
> > > On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> > >> Hi Robert
> > >>
> > >> I tried to do this from a special servlet in axis2/WEB-INF/classes and
> > >> the lookup works like a charm. Why isn't it accessible from the aar
> > >> classes? feature or bug? If it is a feature, how do I get access to the
> > >> context from initContext.lookup("java:comp/env"); ?
> > >>
> > >> My final goal is to use the tomcat DataSource jdbc pooling.
> > >>
> > >> /johan
> > >>
> > >> robert lazarski wrote:
> > >> > Can you do the same lookup successfully via a non-axis2 class inside
> > >> > WEB-INF/classes ?
> > >> >
> > >> > Robert
> > >> >
> > >> > On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> > >> >> I am using Axis2 nightly build from 31 August and cannot lookup the
> > >> >> java:comp/env context from a created InitialContext created inside a
> > >> >> class in the aar-file
> > >> >>
> > >> >> When I do this:
> > >> >> Context initContext = new InitialContext();
> > >> >> Context envContext = (Context)initContext.lookup("java:comp/env");
> > >> >>
> > >> >> I get a NameNotFoundException.
> > >> >>
> > >> >> By the way, I am using the distributed axis2.war in tomcat 5.5.17
> > >> >>
> > >> >> Any ideas?
> > >> >> johan
> > >> >>
> > >> >>
> > >> >> ---------------------------------------------------------------------
> > >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> > >> >>
> > >> >>
> > >> >
> > >> > ---------------------------------------------------------------------
> > >> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > >> > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >> >
> > >> >
> > >> >
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > >> For additional commands, e-mail: axis-user-help@ws.apache.org
> > >>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] context lookup issue
Posted by robert lazarski <ro...@gmail.com>.
Other way around ... I was suggesting you get a reference to some
class from WEB-INF/classes that your servlet sets up, that you call
from inside the aar . It shouldn't be your servlet - use a singleton
perhaps.
I really don't understand why you could get a bound InitalContext
inside WEB-INF/classes but not inside the aar. I don't think its a 1.0
versus a nightly issue. It might be the other user didn't get the
connection instatiated from inside the aar. What I was suggesting is a
work around ... if the InitialContext works in WEB-INF/classes, store
it there and then get it via one of the classic ServiceLocator pattern
implementations. Sorry I don't have any easier ideas.
Robert
On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> I'm not sure how I could get a reference to the ServiceClass in
> WEB-INF/classes. Can you be more specific cause I feel a bit isolated
> inside my aar.
>
> also:
> Gábor Prótár got this working the way I intended it to initially. Check
> the thread 'Tomcat + Axis2 + MySQL' fist post from 9/19 2006 2:08 PM
> But he is using the Axis2 release 1.0 and I am using a later nightly
> build from August 31.
> Was he just lucky and am I experiencing the expected axis2 behavior?
>
> /johan
>
>
>
> robert lazarski wrote:
> > Well it might be a classloader issue because an aar uses a different
> > classloader than a servlet. You can of course have an aar which can
> > see classes in a higher classloader - for example you can have an aar
> > whcih references your ServiceClass that is placed in WEB-INF/lib or
> > WEB-INF/classes ... but the aar itself merely contains just the
> > services.xml . I'd try that. Or alternatively you can have you Servlet
> > init a singleton or something and just get your connection from that
> > inside the service.
> >
> > HTH,
> > Robert
> >
> > On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> >> Hi Robert
> >>
> >> I tried to do this from a special servlet in axis2/WEB-INF/classes and
> >> the lookup works like a charm. Why isn't it accessible from the aar
> >> classes? feature or bug? If it is a feature, how do I get access to the
> >> context from initContext.lookup("java:comp/env"); ?
> >>
> >> My final goal is to use the tomcat DataSource jdbc pooling.
> >>
> >> /johan
> >>
> >> robert lazarski wrote:
> >> > Can you do the same lookup successfully via a non-axis2 class inside
> >> > WEB-INF/classes ?
> >> >
> >> > Robert
> >> >
> >> > On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> >> >> I am using Axis2 nightly build from 31 August and cannot lookup the
> >> >> java:comp/env context from a created InitialContext created inside a
> >> >> class in the aar-file
> >> >>
> >> >> When I do this:
> >> >> Context initContext = new InitialContext();
> >> >> Context envContext = (Context)initContext.lookup("java:comp/env");
> >> >>
> >> >> I get a NameNotFoundException.
> >> >>
> >> >> By the way, I am using the distributed axis2.war in tomcat 5.5.17
> >> >>
> >> >> Any ideas?
> >> >> johan
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >> >>
> >> >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >> >
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] context lookup issue
Posted by Johan Lundberg <jo...@NotSoHotMail.com>.
I'm not sure how I could get a reference to the ServiceClass in
WEB-INF/classes. Can you be more specific cause I feel a bit isolated
inside my aar.
also:
Gábor Prótár got this working the way I intended it to initially. Check
the thread 'Tomcat + Axis2 + MySQL' fist post from 9/19 2006 2:08 PM
But he is using the Axis2 release 1.0 and I am using a later nightly
build from August 31.
Was he just lucky and am I experiencing the expected axis2 behavior?
/johan
robert lazarski wrote:
> Well it might be a classloader issue because an aar uses a different
> classloader than a servlet. You can of course have an aar which can
> see classes in a higher classloader - for example you can have an aar
> whcih references your ServiceClass that is placed in WEB-INF/lib or
> WEB-INF/classes ... but the aar itself merely contains just the
> services.xml . I'd try that. Or alternatively you can have you Servlet
> init a singleton or something and just get your connection from that
> inside the service.
>
> HTH,
> Robert
>
> On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
>> Hi Robert
>>
>> I tried to do this from a special servlet in axis2/WEB-INF/classes and
>> the lookup works like a charm. Why isn't it accessible from the aar
>> classes? feature or bug? If it is a feature, how do I get access to the
>> context from initContext.lookup("java:comp/env"); ?
>>
>> My final goal is to use the tomcat DataSource jdbc pooling.
>>
>> /johan
>>
>> robert lazarski wrote:
>> > Can you do the same lookup successfully via a non-axis2 class inside
>> > WEB-INF/classes ?
>> >
>> > Robert
>> >
>> > On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
>> >> I am using Axis2 nightly build from 31 August and cannot lookup the
>> >> java:comp/env context from a created InitialContext created inside a
>> >> class in the aar-file
>> >>
>> >> When I do this:
>> >> Context initContext = new InitialContext();
>> >> Context envContext = (Context)initContext.lookup("java:comp/env");
>> >>
>> >> I get a NameNotFoundException.
>> >>
>> >> By the way, I am using the distributed axis2.war in tomcat 5.5.17
>> >>
>> >> Any ideas?
>> >> johan
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] context lookup issue
Posted by robert lazarski <ro...@gmail.com>.
Well it might be a classloader issue because an aar uses a different
classloader than a servlet. You can of course have an aar which can
see classes in a higher classloader - for example you can have an aar
whcih references your ServiceClass that is placed in WEB-INF/lib or
WEB-INF/classes ... but the aar itself merely contains just the
services.xml . I'd try that. Or alternatively you can have you Servlet
init a singleton or something and just get your connection from that
inside the service.
HTH,
Robert
On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> Hi Robert
>
> I tried to do this from a special servlet in axis2/WEB-INF/classes and
> the lookup works like a charm. Why isn't it accessible from the aar
> classes? feature or bug? If it is a feature, how do I get access to the
> context from initContext.lookup("java:comp/env"); ?
>
> My final goal is to use the tomcat DataSource jdbc pooling.
>
> /johan
>
> robert lazarski wrote:
> > Can you do the same lookup successfully via a non-axis2 class inside
> > WEB-INF/classes ?
> >
> > Robert
> >
> > On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> >> I am using Axis2 nightly build from 31 August and cannot lookup the
> >> java:comp/env context from a created InitialContext created inside a
> >> class in the aar-file
> >>
> >> When I do this:
> >> Context initContext = new InitialContext();
> >> Context envContext = (Context)initContext.lookup("java:comp/env");
> >>
> >> I get a NameNotFoundException.
> >>
> >> By the way, I am using the distributed axis2.war in tomcat 5.5.17
> >>
> >> Any ideas?
> >> johan
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] context lookup issue
Posted by Johan Lundberg <jo...@NotSoHotMail.com>.
Hi Robert
I tried to do this from a special servlet in axis2/WEB-INF/classes and
the lookup works like a charm. Why isn't it accessible from the aar
classes? feature or bug? If it is a feature, how do I get access to the
context from initContext.lookup("java:comp/env"); ?
My final goal is to use the tomcat DataSource jdbc pooling.
/johan
robert lazarski wrote:
> Can you do the same lookup successfully via a non-axis2 class inside
> WEB-INF/classes ?
>
> Robert
>
> On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
>> I am using Axis2 nightly build from 31 August and cannot lookup the
>> java:comp/env context from a created InitialContext created inside a
>> class in the aar-file
>>
>> When I do this:
>> Context initContext = new InitialContext();
>> Context envContext = (Context)initContext.lookup("java:comp/env");
>>
>> I get a NameNotFoundException.
>>
>> By the way, I am using the distributed axis2.war in tomcat 5.5.17
>>
>> Any ideas?
>> johan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] context lookup issue
Posted by robert lazarski <ro...@gmail.com>.
Can you do the same lookup successfully via a non-axis2 class inside
WEB-INF/classes ?
Robert
On 9/21/06, Johan Lundberg <jo...@notsohotmail.com> wrote:
> I am using Axis2 nightly build from 31 August and cannot lookup the
> java:comp/env context from a created InitialContext created inside a
> class in the aar-file
>
> When I do this:
> Context initContext = new InitialContext();
> Context envContext = (Context)initContext.lookup("java:comp/env");
>
> I get a NameNotFoundException.
>
> By the way, I am using the distributed axis2.war in tomcat 5.5.17
>
> Any ideas?
> johan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org