• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

axis2 SessionContext.getProperty is null!!!???

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hallo everybody. I have the following code:

----------------------------------------------------
...............
private SessionContext session(){
MessageContext mctx = MessageContext.getCurrentMessageContext();
TransportListener listener = mctx.getTransportIn().getReceiver();
SessionContext session = listener.getSessionContext(mctx);
return session;
}
... ...

public Customer getCustomer() throws AxisFault
{
int custId = ((Integer)session().getProperty(Const.SESSIONCUSTOMER)).intValue(); //getProperty is null!
CustomerInfoServer customerServer = CustomerInfoServer.getCustomerServer();
Customer al = (Customer)customerServer.getCustomer(custId);
System.out.println("Found customer:" + al.getName());
return (Customer)customerServer.getCustomer(custId);
}

----------------------------------------------------------
and i got the erorrs:
---------------------------------------------------------
20.06.2007 10:34:21 org.apache.axis2.rpc.receivers.RPCMessageReceiver invokeBusinessLogic
SCHWERWIEGEND: Exception occurred while trying to invoke service method getCustomer
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:91)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at com.bala.getCustomer(SolverCustomerService.java:153)
... 25 more
---------------------------------------------------
can anyone tell me, how can i write my "session()" function, so that i get the "none-null" property of the session?
Thanks a lot!!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you certain that the session contains an object with key "Const.SESSIONCUSTOMER", whatever that is?
 
xin sa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
first thank you for your antwort.

Yes, i'm sure. I found the Problem can be soluted with
"session().setProperty(Const.SESSIONCUSTOMER,2)" before "getproperty(...)".
because a SessionContext must be filled with somthing first.

but, this number "2" is not, what i want. I want, that it can get the currently Date itself, not a static constance. So, have you idear for this?

thanks
xin
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yes, i'm sure.


But if I understand correctly what you wrote, you shouldn't have been sure, because there wasn't in fact anything in the session; correct?

this number "2" is not, what i want. I want, that it can get the currently Date itself, not a static constance.


Well, if you want to retrieve the current date from the session (why?) instead of a number, then you will first have to put the date into the session, like "session().setProperty(Const.SESSIONCUSTOMER, new Date())". Am I misunderstanding what you are trying to do?
 
reply
    Bookmark Topic Watch Topic
  • New Topic