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 renjith kalappurackal <re...@yahoo.com> on 2007/08/14 19:40:29 UTC

"How can I read file"

Hi All,
   
  I have a problem facing while try to read a file from a web services that is packaged as aar.
  My application  structure is as follows
   
  The server I am using is jboss-3.0.8_tomcat-4.1.24.
  And I wrote code to access file in my local machine as below in lets say Converter.java.
   
  MessageContext ctx = MessageContext.getCurrentMessageContext();
AxisService asrv = ctx.getAxisService();
  fin = (FileInputStream) asrv.getClassLoader().getResourceAsStream(xml)
   
  Where xml being the name of the file lets say (myconfig.xml) And I placed this file in axis2/WEB-INF/classes. And put converter.java in a jar file in C:\jboss-3.0.8_tomcat-4.1.24\tomcat-4.1.x\shared\lib.
  And I deployed my services in axis2.war and placed axis2.war in C:\jboss-3.0.8_tomcat-4.1.24\server\default\deploy\webapps.
   
  This solution worked fine in local environment.
   
  But when I moved the solution to Linux server it failed becuase of NullPointerException in
  AxisService asrv = ctx.getAxisService();
   
      The structure of server is different being Converter.class in shared/lib directory of /home/jboss-3.0.8_tomcat-4.1.24/tomcat-4.1.x/shared/lib. but axis2 is deployed as exploded form under /home/jboss-3.0.8_tomcat-4.1.24/tomcat-4.1.x/webapps/mydomain/ and this erro is happening whenI tried to access my config file that is in /home/jboss-3.0.8_tomcat-4.1.24/tomcat-4.1.x/webapps/mydomain/axis2/WEB-INF/clasess/myconfig.xml from my service class (let say MyService.class) in AAR that 
  /home/wpape/jboss-3.0.8_tomcat-4.1.24/tomcat-4.1.x/webapps/commence/erpsync/axis2/WEB-INF/services/myAAR.aar.          
            This error is happening when MyService.classs after accessing Converter.class in shared/lib try to get the messageContext. I think I did somethign terrible wrong here. Could anyone tell me the best way to access this myconfig.xml in /home/jboss-3.0.8_tomcat-4.1.24/tomcat-4.1.x/webapps/mydomain/axis2/WEB-INF/clasess/ directory from a class thst is placed in ajar in shared/lib that is inturn accessing by my service class in AAR.
   

       
---------------------------------
Luggage? GPS? Comic books? 
Check out fitting  gifts for grads at Yahoo! Search.