axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <>
Subject Re: java.lang.NullPointerException when attempting to access resources in an .aar file.
Date Mon, 03 Dec 2007 22:34:25 GMT
MessageContext has 2 methods which may help

there is no getCurrentContextMessage method

----- Original Message -----
From: "Sanjay Vivek" <>
To: <>
Sent: Monday, December 03, 2007 11:34 AM
Subject: java.lang.NullPointerException when attempting to access resources
in an .aar file.

Hi everyone,

I'm attempting to deploy a Web Service from a simple Java class by
creating a service archive and deploying it to WSAS (Web Services
Application Server).

However, I'm having trouble invoking this service. The structure of my
service is given below (which I then deployed as an .aar file):

- GrouperWS
    - services.xml
  - lib
     - *.jar

  - conf
    - sources.xml

  - test
    - GrouperWS.class requires sources.xml for it to initialize properly. I
tried to access the sources.xml using the code below but I'm getting
java.lang.NullPointerException errors when I try to invoke
loadResource(). What am I doing wrong? Any help would be greatly

package test;


import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;

import edu.internet2.middleware.grouper.SubjectFinder;
import edu.internet2.middleware.subject.Subject;
import edu.internet2.middleware.subject.SubjectNotFoundException;
import edu.internet2.middleware.subject.SubjectNotUniqueException;

public class GrouperWS {

private final static String GROUPER_PROPERTIES = "conf/sources.xml";

public String loadResource() throws AxisFault{

MessageContext context =
AxisService service = context.getAxisService();
ClassLoader loader = service.getClassLoader();
      InputStream stream =

             if (stream != null) {
            try {
                 String  subjectId = "";
                 Subject subject      =
                 String user = subject.getId();
                 return user;
                 //System.err.println("Found User: " + user);

               catch (SubjectNotFoundException   eSNF) {
                 // No matching subject id found
                 String subjNotFoundError=eSNF.getMessage();
                 return subjNotFoundError;
               catch (SubjectNotUniqueException  eSNU) {
                 // More than one subject with this subject id was
                 String uniqueError=eSNU.getMessage();
                 return uniqueError;

             } else {
                   return "An error occured";


Sanjay Vivek
Web Analyst
Middleware Team
University of Newcastle Upon Tyne

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message