• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

HELP accessing Class Path Xml ApplicationContext in aar file

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
i am using axis and my webservice is packaged as an aar file inside my axis archive. Right now i am using a startup servlet class SpringInit which implements ServiceLifeCycle and i initilize the ClassPathXmlApplicationContext when the startup method is called when the services are initialized. This is a pretty standard way of doing it as mentioned in teh axis documentation and mentoined below.

Now the issue is how can i get hold of application context in my webservice code for example generally in a normal spring app we put spring context file under WEB-INF classes folder and use singleton class such as mentioned below


If i try this code in my webservice it says applicationContext.xml file not found which is correct sicne the aar file is not packaged as regular J2ee spec. The classpathpahtxml context has to initialized using the axisSerive class loader.
Could any body tell me whats the best practice of getting hold of the application context in the webserivce code.

FYI, as of now in order for my code to work i have a static variable and i have set that varibale when the starup method initilaized the class path xml context.
Hence my new startup method has this extra code where i set teh static variable applicationContext of ProjectApplicationContext Class like this

ProjectApplicationContext.applicationContext = appCtx;

Is this correct or totally against teh code best practices and land me in trouble. Please let me knwo


Thanks
Rashid
 
Darvesh Niz
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any body please have any update on this

Thanks
 
Darvesh Niz
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will appreciate if anybody can give some input on this.
Rashid
 
reply
    Bookmark Topic Watch Topic
  • New Topic