• Getting null pointer exception

  • Do you want to create a native client or integrate with third party applications: webservices are the solution.
Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #10201  by gangadhara.k
 
Hi All,
When i tried to execute the following code i am getting null pointer exception, Please help me to come out of this.

Code
Code: Select all
public static void main(String[] args)throws Exception {
		 try{
			 OKMAuthServiceStub objStub = new OKMAuthServiceStub(); 
			 Login objLogin = (Login) Login.class.newInstance(); 
			 objLogin.setUser("okmAdmin");
			 objLogin.setPassword("admin");				 
			 LoginResponse token =  objStub.login(objLogin);
			 
			 OKMDocumentServiceStub documentService = new OKMDocumentServiceStub();	 
			 Document objDocument = (Document)Document.class.newInstance(); 
			 objDocument.setPath("/okm:root/test");
			 
			 Create objCreate = (Create)Create.class.newInstance();
			 System.out.println("objCreate "+ objCreate);
			 objCreate.setDoc(objDocument);
			 objCreate.setToken(token.toString());
			
			 documentService.create(objCreate);
		 } catch (AxisFault objAxisFault) {  
				objAxisFault.printStackTrace();
		 } catch (RemoteException objRemoteException) { 
				objRemoteException.printStackTrace();
		 }
	} 
Exception on console
Code: Select all
org.apache.axis2.AxisFault: java.lang.NullPointerException
	at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
	at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
	at com.openkm.ws.endpoint.OKMDocumentServiceStub.create(OKMDocumentServiceStub.java:5168)
	at com.openkm.ws.endpoint.BootLoaderTest.main(BootLoaderTest.java:44)
I am able to get the token for the username/password, after that i am getting the above exception. Please let me know if any info needed.

Thanks
Ganga

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.