obtain the MessageContext first ..then get the ServletContext from the 
MessageContext e.g.

        org.apache.axis2.context.MessageContext msgContext 
=jaxwsMessageContext.getAxisMessageContext();

        // If we are running within a servlet container, then JAX-WS requires 
that the
        // servlet related properties be set on the MessageContext
        javax.servlet.ServletContext servletContext = 
(ServletContext)jaxwsMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);

//then if you want the context name
 String context= servletContext.getServletContextName(); //Returns the name of 
this web application corresponding to this ServletContext as specified in the 
deployment
 descriptor for     
                                                                               
//this web  application by the display-name element.

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Tue, 1 Dec 2009 12:18:08 -0800
> From: [email protected]
> To: [email protected]
> Subject: Axis2 and ApplicationContext
> 
> 
> Hi,
> 
> I tried searching for ApplicationContext on the this site and found this
> thread:
> 
> http://old.nabble.com/Axis2-service-and-spring-problem%2C-can%27t-find-Spring%27s-ApplicationContext.-ts22842176.html#a22842176
> 
> Basically I have an Axis2 skeleton class. In that class is the following
> code:
> 
> ApplicationContext ctx = new
> ClassPathXmlApplicationContext("my-beans2.xml");
> 
> myDAO theDAO = (myDAO) ctx.getBean("myDAO");
> 
> 
> The problem is that this doesn't apparently work if in Axis2. Standalone
> this code worked fine.
> 
> I know that the Spring jars are in the classpath so I can't think of any
> reason why I would get this error. Since this is a textbook way of getting
> the application context I don't understand why this is happening.
> 
> The problem that appears in the log is:
> 
> [ERROR] org/springframework/context/ApplicationContext
> java.lang.NoClassDefFoundError:
> org/springframework/context/ApplicationContext
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Unk nown Source)
> at java.lang.Class.getConstructor0(Unknown Source)
> at java.lang.Class.newInstance0(Unknown Source)
> etc etc
> 
> So at the end of the other thread there was the suggestion to create your
> own ApplicationContextHolder class.  The problem is if I have my beans in a
> file, such as my-beans2.xml, how can I create an ApplicationContextHolder
> that reads from that file and gives me access to the beans?
> 
> 
> Thanks,
> 
> Andy 
> 
> -- 
> View this message in context: 
> http://old.nabble.com/Axis2-and-ApplicationContext-tp26598402p26598402.html
> Sent from the Axis - User mailing list archive at Nabble.com.
> 
                                          
_________________________________________________________________
Get gifts for them and cashback for you. Try Bing now.
http://www.bing.com/shopping/search?q=xbox+games&scope=cashback&form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_Shopping_Giftsforthem_cashback_1x1

Reply via email to