NullPointerException on calling Sceduler.scheduleJob

Hi,
I am new to the Quartz API.
On calling Sceduler.scheduleJob () method I am getting NullPointerException. I am not bale to figure out why this is happening.
Please see my Context Listener class below.
package com.ustri.batman.listener;
import java.text.ParseException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
import com.ustri.batman.reporter.ReportJob;
import com.ustri.batman.reporter.WIPReportJob;
public class ReportListener implements ServletContextListener {
     Scheduler sched;
     Scheduler wipSched;
     public void contextDestroyed(ServletContextEvent arg0) {
          // TODO Auto-generated method stub
          System.out
          .println("************inside context destroy********************");
          if (sched != null) {
               try {
                    sched.shutdown();
                    wipSched.shutdown();
               } catch (SchedulerException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
          System.out
          .println("************scheduler shut down********************");
     public void contextInitialized(ServletContextEvent arg0) {
          // TODO Auto-generated method stub
          System.out
                    .println("************inside context init********************");
          StdSchedulerFactory schedFact = new StdSchedulerFactory();
          try {
               sched = schedFact.getScheduler();
               JobDetail jobDetail = new JobDetail("Weekely Report",
                         "Report Generation", ReportJob.class);
               CronTrigger trigger = new CronTrigger("Weekely Report",
                         "Report Generation");
               trigger.setCronExpression("0 * * * * ?");
               JobDetail wipJobDetail = new JobDetail("WIP Report",
                         "WIP Report Generation", WIPReportJob.class);
               CronTrigger wipTrigger = new CronTrigger("WIP Report",
               "WIP Report Generation");
               wipTrigger.setCronExpression("0 * 15 ? * 7 *");
               sched.scheduleJob(jobDetail, trigger);
               wipSched.scheduleJob(wipJobDetail, wipTrigger);
               sched.start();
               wipSched.start();
               System.out
                         .println("**********************************scheduler started*********************************");
          } catch(NullPointerException e) {
                    e.printStackTrace();
          catch (SchedulerException e) {
               System.out.println("************* Caught SchedulerException ");
               e.printStackTrace();
          } catch (ParseException e) {
               System.out.println("************* ParseException ");
               e.printStackTrace();
Please help.
Thanks,
Neelambary

All,
I am currently reading 'commands' from a db and placing them into a job>scheduler + trigger.
I can perform this, But I always get a NullPointerException. The code will run, but it will not do so without producing this error:
Exception in thread "main" java.lang.NullPointerException
     at mybeans.SchedulerScheduler.runScheduler(SchedulerScheduler.java:61)
     at mybeans.SchedulerScheduler.main(SchedulerScheduler.java:31)
line 61 is :job.getJobDataMap().put("command", hash.get("command" + i).toString());
line 31 is:           scheduler.runScheduler();
My code is 2 classes.
1. is Command, which implements Job
public class Command implements Job {
     static Log log = LogFactory.getLog(EmailScheduler.class);
     public void execute(JobExecutionContext context){
          //every job has its own job detail.
          JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
          //System.out.println(jobDataMap.size());
          //String userid = jobDataMap.get("userid").toString();
          //String command = jobDataMap.get("command").toString();
          //iterate over key/value pairs.
          Iterator iter = jobDataMap.keySet().iterator();
          while(iter.hasNext()){
               Object key = iter.next();
               Object value = jobDataMap.get(key);
               System.out.println(key + " " + value);
               log.info("Key " + key + " - Value " + value);
          System.out.println("User id is: " + jobDataMap.get("userid") + "command is :" + jobDataMap.get("command") );
}//class end.
2. SchedulerScheduler which reads the db and schedules the jobs.
public class SchedulerScheduler {
     private JobPoll jobPoll;
     static Log log = LogFactory.getLog(EmailScheduler.class);
     public static void main(String[] args)throws SchedulerException {
          SchedulerScheduler scheduler = new SchedulerScheduler();
          scheduler.runScheduler();
     public void runScheduler(){
          Scheduler scheduler = null;
          try{
          //lets get our jobs from jobs db
               jobPoll = new JobPoll();
               Hashtable hash = jobPoll.pollJobs();
               int hashSize = hash.size();
          scheduler = StdSchedulerFactory.getDefaultScheduler();
          scheduler.start();
//System.out.println("Scheduling started at : " + new Date());
          //Now we have our jobs in a Hashtable, let's schedule them.
          //1st, add our hash to jobdetails and jobs.
               for(int i =0; i<hashSize; i++){
               JobDetail job = new JobDetail("eassistjob" + Integer.toString(i), "eassistgroup" + Integer.toString(i), Command.class);
                    job.getJobDataMap().put("command", hash.get("command" + i).toString());
                    job.getJobDataMap().put("userid", hash.get("userid" + i).toString());
          //create a trigger.=immediate start, runs twice, every 100,000 milliseconds(100seconds).
          Trigger trigger = TriggerUtils.makeImmediateTrigger(-1, 10000);
          trigger.setName("JobPollTrigger" + Integer.toString(i));
          //scheduler.addJob(job, false);
          scheduler.scheduleJob(job, trigger);
}catch(SchedulerException se){
     log.error(se);
M

Similar Messages

  • NullPointerException in calling Scheduler.scheduleJob()

    Hi,
    I am new to the Quartz API.
    On calling Sceduler.scheduleJob () method I am getting NullPointerException. I am not bale to figure out why this is happening.
    Please see my Context Listener class below.
    package com.ustri.batman.listener;
    import java.text.ParseException;
    import javax.servlet.ServletContextEvent;
    import javax.servlet.ServletContextListener;
    import org.quartz.CronTrigger;
    import org.quartz.JobDetail;
    import org.quartz.Scheduler;
    import org.quartz.SchedulerException;
    import org.quartz.impl.StdSchedulerFactory;
    import com.ustri.batman.reporter.ReportJob;
    import com.ustri.batman.reporter.WIPReportJob;
    public class ReportListener implements ServletContextListener {
         Scheduler sched;
         Scheduler wipSched;
         public void contextDestroyed(ServletContextEvent arg0) {
              // TODO Auto-generated method stub
              System.out
              .println("************inside context destroy********************");
              if (sched != null) {
                   try {
                        sched.shutdown();
                        wipSched.shutdown();
                   } catch (SchedulerException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
              System.out
              .println("************scheduler shut down********************");
         public void contextInitialized(ServletContextEvent arg0) {
              // TODO Auto-generated method stub
              System.out
                        .println("************inside context init********************");
              StdSchedulerFactory schedFact = new StdSchedulerFactory();
              try {
                   sched = schedFact.getScheduler();
                   JobDetail jobDetail = new JobDetail("Weekely Report",
                             "Report Generation", ReportJob.class);
                   CronTrigger trigger = new CronTrigger("Weekely Report",
                             "Report Generation");
                   trigger.setCronExpression("0 * * * * ?");
                   JobDetail wipJobDetail = new JobDetail("WIP Report",
                             "WIP Report Generation", WIPReportJob.class);
                   CronTrigger wipTrigger = new CronTrigger("WIP Report",
                   "WIP Report Generation");
                   wipTrigger.setCronExpression("0 * 15 ? * 7 *");
                   sched.scheduleJob(jobDetail, trigger);
                   wipSched.scheduleJob(wipJobDetail, wipTrigger);
                   sched.start();
                   wipSched.start();
                   System.out
                             .println("**********************************scheduler started*********************************");
              } catch(NullPointerException e) {
                        e.printStackTrace();
              catch (SchedulerException e) {
                   System.out.println("************* Caught SchedulerException ");
                   e.printStackTrace();
              } catch (ParseException e) {
                   System.out.println("************* ParseException ");
                   e.printStackTrace();
    Please help.
    Thanks,
    Neelambary

    You have the line:
    sched = schedFact.getScheduler();
    to get an instance of the sched scheduler but I don't see one for the wipSched scheduler which would cause the line:
    wipSched.scheduleJob(wipJobDetail, wipTrigger);
    to throw a null pointer exception becuase wipSched is never initialized.

  • Bug in Oracle JDBC Driver: NullPointerException when calling clearParameters

    There is a bug in the latest version of the JDBC driver that throws a NPE when calling PreparedStatement.clearParameters(). I don't need a response to this, since I have a workaround (just catching and ignoring the exception), but it should probably be fixed. I speculate that the problem only occurs when you try to call clearParameters() more than once on the same PS, but I haven't confirmed it.
    It is probably an easy fix. Following is the stack trace:
    java.lang.NullPointerException
    at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
    at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
    at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
    at com.solarmetric.datasource.PreparedStatementCache$CachePreparedStatement.close(PreparedStatementCache.java:293)
    at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementBatch(SQLExecutionManagerImpl.java:666)
    at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:514)
    at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:406)
    at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:273)
    at com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:421)
    at com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:549)
    at com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:412)
    at com.sun.jdotck.api.persistencemanager.MakePersistentAssignsObjectId.testMakePersistentAssignsObjectId2(Unknown Source)
    at com.sun.jdotck.api.persistencemanager.MakePersistentAssignsObjectId.testMakePersistentAssignsObjectId(Unknown Source)
    at com.sun.jdotck.api.persistencemanager.MakePersistentAssignsObjectId.runTest(Unknown Source)
    at com.sun.jdotck.api.persistencemanager.PersistenceManagerTest.run(Unknown Source)
    at com.solarmetric.kodo.compatibility.JDOCompatabilityTestSuite$1.runTest(JDOCompatabilityTestSuite.java:493)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:524)
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

    Take a look at the method that is causing the NullPointerException:
    public void clearItem(int i)
    if (!m_dynamic && m_vector == null && i < m_vector.size())
    m_vector.removeElementAt(i);
    if (m_items != null && i >= m_items.length)
    return;
    m_items[i] = null;
    return;
    A NullPointerException will be thrown whenever clearParameters() is called when no parameters have yet been bound.
    The first IF statement should read:
    if (!m_dynamic && m_vector != null && i < m_vector.size())
    A simple workaround would be to make sure that your parameter list is never empty before calling clearParameters(). Is there a patch for this anywhere?

  • Java.lang.NullPointerException when calling getServletContext

    Hi All,
    When calling getServletContext from my servlet, i'm getting the following exception to my web client:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
         javax.servlet.GenericServlet.getServletContext(GenericServlet.java:159)
         amdocs.checklist.UserPage.service(UserPage.java:126)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         amdocs.checklist.LoginFilter.doFilter(LoginFilter.java:65)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
    My code is:
    ServletContext sc = getServletContext();
    RequestDispatcher rd = getServletContext().getRequestDispatcher("/Header");
    rd.include(request, response);
    It couldn't pass the call of getServletContext, Any idea why?
    Thanks.

    I haven't looked at the source yet, but I remember the api specs talking about the init(ServletConfig) method being called by the container.
    The servlet will the set up it's references to objects (eg. the ServletContext) and calls the init() method.
    So, if you override the init(ServletConfig) method the references will never be set up, and you will get null calling getServletContext().
    So always use the init() method for any initialization of servlets.

  • Intermittent NullPointerException while calling connection.prepareStatement("insert into mytable (myuid, foo) values (SEQ_M_MSG_UID.nextval,?)");

    Hello,
    I am intermittently getting a nullpointer exception while parsing a
    query to make a preparedStatement. I am using WebLogic5.1 sp9.
    Oracle 817. Java 1.3.1 The code is very simple (although the
    setTypeMap(getTypeMap) stuff is there for ugly historical reasons, it
    has been included for completeness). Any insight into this problem
    would be greatly appreciated.
    My only current theory is that it is related to the nextval being
    passed in the string to the prepareStatement.
    The exception only happens 1 in 2000 calls. This code usually
    succeeds. The code is executing in the context of a stateless session
    bean. There may be upto 200 client threads calling this method
    concurrently from various systems.
    ...dAmOn
    CODE:
    final String lQuery = "insert into SB_MESSAGE (M_MSG_UID,
    M_MSG_GUID, M_REQUESTOR_GUID, M_MSG_GROUP, M_MSG_REQ_GUID,
    M_DEVICE_UID, M_ACCT_UID, M_TASK_ID, M_COMPLETION_STATUS,
    M_LAST_STATE, M_FILTER_NAME, M_FINAL_ATTEMPT, M_START_TIME,
    M_COMPLETED_TIME, M_TLM_DT)
    values(SEQ_M_MSG_UID.nextval,?,?,?,?,?,?,?,?,?,?,'F',?,?,?) ";
    PreparedStatement lPs = null;
    Driver driver =
    (Driver)Class.forName("weblogic.jdbc20.jts.Driver").newInstance();
    Connection connection =
    driver.connect("jdbc20:weblogic:jts:myPool", null);
    connection.setTypeMap(connection.getTypeMap());
    // ** This line leads to the stack trace following the line **
    lPs = connection.prepareStatement(lQuery);
    Stack Trace:
    java.sql.SQLException: java.lang.NullPointerException
    at oracle.jdbc.driver.OracleConnection.nativeSQL(OracleConnection.java:762)
    at oracle.jdbc.driver.OracleStatement.expandSqlEscapes(OracleStatement.java:4790)
    at oracle.jdbc.driver.OracleStatement.parseSqlKind(OracleStatement.java:4779)
    at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
    at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:165)
    at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:604)
    at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:485)
    at weblogic.jdbc.common.internal.ConnectionEnv.getStatementHolderForCachedPrepared(ConnectionEnv.java:99)
    at weblogic.jdbcbase.jts.Connection.prepareStatement(Connection.java:138)

    Hi. That's clearly an Oracle driver bug. I suggest downloading the latest driver from
    Oracle, and making sure it's ahead of all weblogic stuff in the server's weblogic.classpath,
    by editing the startWeblogic script.
    Joe
    Damon Weinstein wrote:
    Hello,
    I am intermittently getting a nullpointer exception while parsing a
    query to make a preparedStatement. I am using WebLogic5.1 sp9.
    Oracle 817. Java 1.3.1 The code is very simple (although the
    setTypeMap(getTypeMap) stuff is there for ugly historical reasons, it
    has been included for completeness). Any insight into this problem
    would be greatly appreciated.
    My only current theory is that it is related to the nextval being
    passed in the string to the prepareStatement.
    The exception only happens 1 in 2000 calls. This code usually
    succeeds. The code is executing in the context of a stateless session
    bean. There may be upto 200 client threads calling this method
    concurrently from various systems.
    ...dAmOn
    CODE:
    final String lQuery = "insert into SB_MESSAGE (M_MSG_UID,
    M_MSG_GUID, M_REQUESTOR_GUID, M_MSG_GROUP, M_MSG_REQ_GUID,
    M_DEVICE_UID, M_ACCT_UID, M_TASK_ID, M_COMPLETION_STATUS,
    M_LAST_STATE, M_FILTER_NAME, M_FINAL_ATTEMPT, M_START_TIME,
    M_COMPLETED_TIME, M_TLM_DT)
    values(SEQ_M_MSG_UID.nextval,?,?,?,?,?,?,?,?,?,?,'F',?,?,?) ";
    PreparedStatement lPs = null;
    Driver driver =
    (Driver)Class.forName("weblogic.jdbc20.jts.Driver").newInstance();
    Connection connection =
    driver.connect("jdbc20:weblogic:jts:myPool", null);
    connection.setTypeMap(connection.getTypeMap());
    // ** This line leads to the stack trace following the line **
    lPs = connection.prepareStatement(lQuery);
    Stack Trace:
    java.sql.SQLException: java.lang.NullPointerException
    at oracle.jdbc.driver.OracleConnection.nativeSQL(OracleConnection.java:762)
    at oracle.jdbc.driver.OracleStatement.expandSqlEscapes(OracleStatement.java:4790)
    at oracle.jdbc.driver.OracleStatement.parseSqlKind(OracleStatement.java:4779)
    at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:209)
    at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:165)
    at oracle.jdbc.driver.OracleConnection.privatePrepareStatement(OracleConnection.java:604)
    at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:485)
    at weblogic.jdbc.common.internal.ConnectionEnv.getStatementHolderForCachedPrepared(ConnectionEnv.java:99)
    at weblogic.jdbcbase.jts.Connection.prepareStatement(Connection.java:138)

  • NullPointerException: when call "drawImage" function?

    hello all:
    I met a java.lang.NullPointerException when I try to call drawImage in
    my program.
    My program structure:
    1>JFrame / JPanel / ImagePane(which extends JComponent)
    a object of class ImagePane stays on top of a object of JPanel which stays on JFrame.
    2>code of class ImagePane
    <pre>
    public class ImagePane extends JComponent {
    Image pic = null;
    Image canvas = null;
    int width = -1;
    int height = -1;
    public ImagePane() {
    ImageIcon bird = ZoomUtil.createImageIcon("birdView.jpg");
    width = bird.getIconWidth(); // ImageIcon width
    height = bird.getIconHeight(); // ImageIcon height
    // the image birdView.jpg is successfully loaded by java
    // b/c I can get correct width and height
    pic = bird.getImage();
    canvas = createImage(width, height);
    canvas.getGraphics().drawImage(pic, width, height, null);
    // the above line get nullPointerException, when I ran program.
    public void paint(Graphics g) {
    g.drawImage(pic, 5, 5, 200, 250, null);
    </pre>
    Main program looks like:
    JPanel jPanel1 = new JPanel();
    ImagePane imagePaneA = new ImagePane();
    jPanel1.add(imagePaneA, BorderLayout.CENTER);
    thank you for any suggestion!
    -Daniel

    hello all:
    I had made my code without NullPointerException, but I still cannot
    get any image drawed?!
    any helps are welcome!
    public class ImagePane extends JComponent {
    Image pic = null;
    Image canvas = null;
    int width = -1;
    int height = -1;
    public ImagePane() {
    ImageIcon bird = ZoomUtil.createImageIcon("birdView.jpg");
    width = bird.getIconWidth(); // ImageIcon width
    height = bird.getIconHeight(); // ImageIcon height
    pic = bird.getImage();
    public void paint(Graphics g) {
    setVisible(true);
    canvas = createImage(width, height);
    if (canvas == null) {
    System.err.println("canvas is null"); // correct
    return;
    if (g.drawImage(canvas, 0, 0, this)) {
    System.err.println("drawImage true"); // correct
    else {
    System.err.println("drawImage false");
    }

  • NullPointerException while calling a Remote Method

    I have got the following exception wh�le calling a remote method,
    do you have any idea?
    java.lang.NullPointerException
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
         at distributedchess.server.ChessGameImpl_Stub.applyAction(ChessGameImpl_Stub.java:53)

    Looks to me like your server has a bug in a remote method.

  • My servlet throws java.lang.NullPointerException when calling service()

    i can't determine which part exactly is null and the exception log is:
    Jun 28, 2009 1:28:11 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet CheckLog threw exception
    java.lang.NullPointerException
    at LoginSer.processRequest(LoginSer.java:37)
    at LoginSer.doPost(LoginSer.java:85)
    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.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    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:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    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:619)
    and here is the code can anyone help me please:
    import java.io.*;
    import java.net.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import com.microsoft.sqlserver.jdbc.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.ws.Dispatch;
    public class RegForm extends HttpServlet {
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            String fName=request.getParameter("fName");
            String lName=request.getParameter("lName");
            String addr=request.getParameter("address");
            int x=0;
            if(!(fName.equals(null) && lName.equals(null) && addr.equals(null))){
            try {
                  Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                String url="jdbc:sqlserver://localhost:1433;databaseName=MyDB1;userName=sa;password=iszecson;";
                Connection conn=DriverManager.getConnection(url);
                Statement st=conn.createStatement();
            //System.out.println("----> "+conn.toString());  
          int rs=st.executeUpdate("insert into Employee (FirstName,LastName,Address) values ('"+fName+"','"+lName+"','"+addr+"')");
             x=rs; 
            } catch (Exception ex) {
                ex.printStackTrace();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Added</title>");
            out.println("</head>");
            out.println("<body>");
            out.println(x+" rows affected");
            out.println("</body>");
            out.println("</html>");
            out.close();
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        }

    abulseed wrote:
    if(!(fName.equals(null) && lName.equals(null) && addr.equals(null))){
    Is this line 37?
    If so, if any of fName, lName or addr are null you will get a NullPointerException.
    This is not how you check whether something is null.
    Use '=='.

  • NullPointerException while calling a webservice

    Hello,
    I want to use a this webservice:
    http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=37
    I have implement it, but I can not use it.
    Here my Code from the ComponentController:
                   AtomicModel model = new AtomicModel();
                   Request_GetAtomicNumber req = new Request_GetAtomicNumber(model);
                   GetAtomicNumber number = new GetAtomicNumber(model);
                              number.setElementName("");
                   req.setGetAtomicNumber(number);
                   wdContext.nodeRequest_GetAtomicNumber().bind(req);
    I become an Nullpointer-Exception at runtime, if i want to set "ElementName". But you can see, that the class GetAtomicNumber is already defined.
    In other projects I had done the same with other webservices and it works...
    Where is my mistake???
    Thanks,
    Peter

    Looks to me like your server has a bug in a remote method.

  • Why are Java SASLFactories missing when called via PL/SQL but not from JRE?

    Hi
    This may be quite a technical point about SASL and JCE Providers etc OR it may just be a question about how Oracle PL/SQL interfaces with Java.
    The background is that I am trying to get a Java opensource library to run in Oracle DB - this is for specialized communication from Database to other servers.
    The library uses a SASL mechanism to authenticate with the server and this (appears) to rely on JCE Providers installed and provided by the JRE.
    I have some Java code working which uses the library - this runs OK in NetBeans/Windows environment and also using Linux/Oracle JRE directly such as:
      +# $ORACLE_HOME/jdk/bin/java -classpath "./MyMain.jar:./OtherSupport.jar" package.TestClient+
    However it refuses to work (throws a NullPointerException) when called from PL/SQL.
      +FUNCTION send_a_message (iHost IN VARCHAR2,+
         iPort IN NUMBER,
        +iLogin IN VARCHAR2,+
        +iPasswd IN VARCHAR2,+
         iRecipient IN VARCHAR2,
         iMessage IN VARCHAR2) RETURN NUMBER
       AS LANGUAGE JAVA
       NAME package.TestClient.sendATextMessage(java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String) return int';
    In the Java code this is:
       public static int sendATextMessage(String iHost,
         int iPort,
         String iLogin,
         String iPasswd
         String iRecipient,
         String iMessage)
    I've tracked the issue down to there being no SaslClientFactories (via Sasl.getSaslClientFactories()) showing when called from PL/SQL whereas 3 are available when run from within Java directly. This via:
       Enumeration<SaslClientFactory> facts = Sasl.getSaslClientFactories();
       System.out.println("Found Sasl Factories [" & (facts != null)  & "] size[" & Collections.list(facts).size() & "]");
    So, is there some aspect of Java initialisation that I'm missing when calling from PL/SQL (which means SASL factories aren't getting loaded into JRE) or is there something different in SASL setup?
    Any pointers appreciated.
    Thanks
    Dave

    Ok, after a bit of reading and general hacking about I have got this working.
    What I hadn't initially understood/remembered is that for a Stored Procedure the JVM installed on file system with Oracle isn't actually used - java code is loaded into the database and hence a different set of base functions are available. The following is a good explanation of this http://docs.oracle.com/cd/B14117_01/java.101/b12021/appover.htm#BGBIBDAJ
    So "out of the box" the Oracle Database appears to come loaded with only two of the Sun security providers i.e. no com.sum.security.SASL
    >
    OBJECT_NAME             OBJECT_TYPE     STATUS   TIMESTAMP
    com/sun/security/auth/NTSid  JAVA CLASS    VALID   2013-02-14:14:08:57
    com/sun/security/jgss/GSSUtil    JAVA CLASS    VALID   2013-02-14:14:08:57
    >
    This is from:
    >
    SELECT
      object_name,
      object_type,
      status,
      timestamp
    FROM
      user_objects
    WHERE
      (object_name NOT LIKE 'SYS_%' AND
       object_name NOT LIKE 'CREATE$%' AND
       object_name NOT LIKE 'JAVA$%' AND
       object_name NOT LIKE 'LOADLOB%') AND
       object_type LIKE 'JAVA %' AND
       object_name LIKE 'com/sun/security%'
    ORDER BY
      object_type,
      object_name;
    >
    My solution (which may well be a work-around) is the following:
    1) Downloaded JDK Source and extracted "com.sun.security.sasl" java code to my project
    2) Added following code to my Stored Procedure ()
    >
    Enumeration<SaslClientFactory> saslFacts = Sasl.getSaslClientFactories();
    if (!saslFacts.hasMoreElements()) {
      System.out.println("Sasl Provider not pre-loaded");
      int added = Security.addProvider(new com.sun.security.sasl.Provider());
      if (added == -1) {
        System.out.println("Sasl Provider could not be loaded");
        System.exit(added);
      else {
        System.out.println("Sasl Provider added");
    >
    3) Built my JAR file with the sasl package embedded (note: could only find Java 6 code, so had to comment out some GSS lines - but wasn't intending to use these)
    4) Loaded JAR to oracle via "loadjava".
    5) Add permissions (only found this out after a couple of failed runs)
    >
    call dbms_java.grant_permission('XMPP', 'SYS:java.security.SecurityPermission', 'putProviderProperty.SunSASL', '' );
    call dbms_java.grant_permission('XMPP', 'SYS:java.security.SecurityPermission', 'insertProvider.SunSASL', '' );
    >
    6) Run gives the following:
    >
    Sasl Provider not pre-loaded
    Sasl Provider added
    ...etc...
    >
    It works!. I confess I'm not sure of the implications of this for multiple calls/performance and if it will need to be added for each stored procedure call - may post back.
    For completeness I should point out that after my load the Security providers look like this:
    >
    OBJECT_NAME             OBJECT_TYPE     STATUS   TIMESTAMP
    com/sun/security/auth/NTSid    JAVA CLASS    INVALID  2013-02-15:09:11:36
    com/sun/security/jgss/GSSUtil    JAVA CLASS    INVALID  2013-02-15:09:11:37
    com/sun/security/sasl/Provider    JAVA CLASS    VALID    2013-02-15:10:03:21
    >
    i.e. the original couple are "INVALID" !
    Dave
    Edited by: 946763 on Feb 26, 2013 2:35 AM

  • Getting Java.Lang.NullPointerException

    Hi,
    I am getting java.lang.NullPointerException when calling the 'validate' method. Appreciate any help.
    Thanks
    import com.sun.net.ssl.internal.ssl.Provider;
    import java.io.*;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.security.Security;
    import java.text.DateFormat;
    public class PSCASClient{
    public static String validate(String fullUrl, String ticket, String altVal) throws IOException {
    String validateURL = null;
    if (altVal.equals("N")) {
    validateURL = "https://login.uconn.edu/cas/validate";
    else
    validateURL = "https://login.uconn.edu/cas/validate";
    try
    Security.addProvider(new Provider());
    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
    int ticketParamIndex = fullUrl.lastIndexOf("&ticket=");
    String service = null;
    if (ticketParamIndex != -1) {
    // service = URLEncoder.encode(fullUrl.substring(0, ticketParamIndex)); /* This method is deprecated - JA */
    service = URLEncoder.encode(fullUrl.substring(0, ticketParamIndex), service);
    else {
    // service = URLEncoder.encode(fullUrl); /* This method is deprecated - JA */
    service = URLEncoder.encode(fullUrl, service);
    URL u = new URL(validateURL + "?ticket=" + ticket + "&service=" + service);
    BufferedReader in = new BufferedReader(new InputStreamReader(u.openStream()));
    if (in == null) {
    return null;
    String line1 = in.readLine();
    String line2 = in.readLine();
    if (line1 != null && line2 != null && line1.equals("yes"))
    String user = line2;
    user = user.toUpperCase();
    return user;
    else {
    return null;
    catch(Exception e)
    logMessage("ERROR: Exception attempting validate: " + e);
    return null;
    public static void logMessage(String message){
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
    Date now = new Date();
    try
    BufferedWriter os = new BufferedWriter(new FileWriter("/tmp/pscas_signon_log.txt", true));
    os.write(formatter.format(now));
    os.write(message);
    os.write("\n");
    os.close();
    catch(IOException _ex) { }

    Hi,
    I am getting java.lang.NullPointerException when
    calling the 'validate' method. Appreciate any help.
    Thanks
    import com.sun.net.ssl.internal.ssl.Provider;
    import java.io.*;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.security.Security;
    import java.text.DateFormat;
    public class PSCASClient{
    public static String validate(String fullUrl, String
    ticket, String altVal) throws IOException {
    String validateURL = null;
    if (altVal.equals("N")) {
    validateURL = "https://login.uconn.edu/cas/validate";
    else
    validateURL = "https://login.uconn.edu/cas/validate";
    try
    Security.addProvider(new Provider());
    System.setProperty("java.protocol.handler.pkgs",
    "com.sun.net.ssl.internal.www.protocol");
    int ticketParamIndex =
    fullUrl.lastIndexOf("&ticket=");
    String service = null;
    if (ticketParamIndex != -1) {
    // service = URLEncoder.encode(fullUrl.substring(0,
    ticketParamIndex)); /* This method is deprecated - JA
    service = URLEncoder.encode(fullUrl.substring(0,
    ticketParamIndex), service);
    else {
    // service = URLEncoder.encode(fullUrl); /* This
    method is deprecated - JA */
    service = URLEncoder.encode(fullUrl, service);
    URL u = new URL(validateURL + "?ticket=" + ticket +
    "&service=" + service);
    BufferedReader in = new BufferedReader(new
    InputStreamReader(u.openStream()));
    if (in == null) {
    return null;
    String line1 = in.readLine();
    String line2 = in.readLine();
    if (line1 != null && line2 != null &&
    line1.equals("yes"))
    String user = line2;
    user = user.toUpperCase();
    return user;
    else {
    return null;
    catch(Exception e)
    logMessage("ERROR: Exception attempting validate: " +
    e);
    return null;
    public static void logMessage(String message){
    SimpleDateFormat formatter = new
    SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
    Date now = new Date();
    try
    BufferedWriter os = new BufferedWriter(new
    FileWriter("/tmp/pscas_signon_log.txt", true));
    os.write(formatter.format(now));
    os.write(message);
    os.write("\n");
    os.close();
    catch(IOException _ex) { }
    }I am using the package jsse.jar. The following lines may be causing the error.
    try
    Security.addProvider(new Provider());
    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
    int ticketParamIndex = fullUrl.lastIndexOf("&ticket=");
    String service = null;
    if (ticketParamIndex != -1) {
    // service = URLEncoder.encode(fullUrl.substring(0, ticketParamIndex)); /* This method is deprecated - JA */
    service = URLEncoder.encode(fullUrl.substring(0, ticketParamIndex), service);
    else {
    // service = URLEncoder.encode(fullUrl); /* This method is deprecated - JA */
    service = URLEncoder.encode(fullUrl, service);
    URL u = new URL(validateURL + "?ticket=" + ticket + "&service=" + service);

  • Jax-ws 2.2.8 and ws-addressing: Client throwing java.lang.NullPointerException on receipt of HTTP 202 when using non-anonymous ReplyTo address

    Server: JBoss EAP 6.2.0
    Client: JDK 1.7.0_51 x64
    JAX-WS: RI 2.2.8 ( via -Djava.endorsed.dirs )
    I am getting a java.lang.NullPointerException when calling the operation on the WS endpoint from the client when using non-anonymous replyTo address.
    I have simplified the scenario into a small test case that hopefully others can replicate. Since the exception is happening on the client instead of the server, I would think that the container used is irrelevant, but I have specified it nonetheless.
    1) WebService:
    package test.webservice;
    import java.util.Random;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.xml.ws.soap.Addressing;
    @WebService(targetNamespace="http://services.nowhere.org/")
    @Addressing(required=true)
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
    public class RandomTest {
        @WebMethod
        public long nextRandom(@WebParam boolean forceException) throws Exception {
            if( forceException ) {
                throw new Exception("Some exception");
            Random rand = new Random();
            return rand.nextLong();
    2) Generated WSDL by JBossEAP 6.2.2:
    <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://webservice.test/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="RandomTestService" targetNamespace="http://webservice.test/">
      <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.test/" elementFormDefault="unqualified" targetNamespace="http://webservice.test/" version="1.0">
      <xs:element name="nextRandom" type="tns:nextRandom"/>
      <xs:element name="nextRandomResponse" type="tns:nextRandomResponse"/>
      <xs:complexType name="nextRandom">
        <xs:sequence/>
      </xs:complexType>
      <xs:complexType name="nextRandomResponse">
        <xs:sequence>
          <xs:element name="return" type="xs:long"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
      </wsdl:types>
      <wsdl:message name="nextRandom">
        <wsdl:part element="tns:nextRandom" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="nextRandomResponse">
        <wsdl:part element="tns:nextRandomResponse" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="RandomTest">
        <wsdl:operation name="nextRandom">
          <wsdl:input message="tns:nextRandom" name="nextRandom" wsam:Action="http://webservice.test/RandomTest/nextRandomRequest" wsaw:Action="http://webservice.test/RandomTest/nextRandomRequest">
        </wsdl:input>
          <wsdl:output message="tns:nextRandomResponse" name="nextRandomResponse" wsam:Action="http://webservice.test/RandomTest/nextRandomResponse" wsaw:Action="http://webservice.test/RandomTest/nextRandomResponse">
        </wsdl:output>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="RandomTestServiceSoapBinding" type="tns:RandomTest">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsaw:UsingAddressing wsdl:required="true"/>
        <wsp:PolicyReference URI="#RandomTestServiceSoapBinding_WSAM_Addressing_Policy"/>
        <wsdl:operation name="nextRandom">
          <soap:operation soapAction="" style="document"/>
          <wsdl:input name="nextRandom">
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output name="nextRandomResponse">
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="RandomTestService">
        <wsdl:port binding="tns:RandomTestServiceSoapBinding" name="RandomTestPort">
          <soap:address location="http://localhost:8080/servertest/RandomTest"/>
        </wsdl:port>
      </wsdl:service>
        <wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="RandomTestServiceSoapBinding_WSAM_Addressing_Policy"><wsam:Addressing><wsp:Policy/></wsam:Addressing></wsp:Policy>
    </wsdl:definitions>
    3) ant build.xml to generate the client code from WSDL
    <?xml version="1.0" encoding="UTF-8"?>
    <project default="build" basedir="..">
        <property name="jaxws.classpath" location="C://jaxws-2.2.8/jaxws-ri/lib/*.jar"/>
        <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
               <classpath path="${jaxws.classpath}"/>
        </taskdef>
        <target name="build" >
            <!-- For these to work, the JAR files in tools/jaxws-ri must be included in Ant's classpath -->
            <wsimport wsdl="http://localhost:8080/servertest/RandomTest?wsdl"
                   verbose="true"
                   sourcedestdir="src"
                   destdir="bin"
                   keep="true">
                   <xjcarg value="-enableIntrospection"/>
            </wsimport>
        </target>
    </project>
    4) Client code
    4a) ClientTest.java - Actual client run from client
    package test.wsclient;
    import java.util.ArrayList;
    import java.util.List;
    import javax.xml.ws.BindingProvider;
    import javax.xml.ws.Endpoint;
    import javax.xml.ws.handler.Handler;
    import javax.xml.ws.soap.AddressingFeature;
    import org.nowhere.services.RandomTest;
    import org.nowhere.services.RandomTestService;
    public class ClientTest {
        public static void main(String args[]) throws Exception {
            ClientTest app = new ClientTest();
            app.testAddressing();
        public void testAddressing() throws Exception {
            String REPLY_TO_ADDRESS = "http://localhost:8082/servertest/RandomCallback";
            String FAULT_TO_ADDRESS = "http://localhost:8082/servertest/RandomCallbackFault";
            RandomTestService service = new RandomTestService();
            RandomTest port = service.getRandomTestPort(new AddressingFeature());
            BindingProvider provider = (BindingProvider) port;
            // pass the replyTo address to the handler
            provider.getRequestContext().put("ReplyTo", REPLY_TO_ADDRESS);
            provider.getRequestContext().put("FaultTo", FAULT_TO_ADDRESS);
            // Register handlers to set the ReplyTo and FaultTo on the SOAP request sent to the WS endpoint
            List<Handler> handlerChain = new ArrayList<Handler>();
            handlerChain.add(new ClientHandler());
            provider.getBinding().setHandlerChain(handlerChain);
            // Start endpoint to receive callbacks from WS
            Endpoint endpoint = Endpoint.publish(REPLY_TO_ADDRESS, new CallbackSEI());
            try {
                port.nextRandom(false);
            } catch( Exception ex ) {
                ex.printStackTrace();
            } finally {
                Thread.sleep(10000);
            endpoint.stop();
            System.exit(0);
    4b) ClientHandler.java - Used to set the wsa ReplyTo address and FaultTo address when sending SOAP request from client to server
    package test.wsclient;
    import java.util.Set;
    import javax.xml.namespace.QName;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPHeader;
    import javax.xml.ws.handler.MessageContext;
    import javax.xml.ws.handler.MessageContext.Scope;
    import javax.xml.ws.handler.soap.SOAPHandler;
    import javax.xml.ws.handler.soap.SOAPMessageContext;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class ClientHandler implements SOAPHandler<SOAPMessageContext> {
        public ClientHandler() {};
        @Override
        public Set<QName> getHeaders() {
            return null;
        @Override
        public void close(MessageContext arg0) {
        @Override
        public boolean handleFault(SOAPMessageContext context) {
            return true;
        protected void setAnAddress(SOAPHeader header, String tagName, String address) {
            NodeList nodeListReplyTo = header.getElementsByTagName(tagName);
            NodeList nodeListAddress = nodeListReplyTo.item(0).getChildNodes();
            for (int i = 0; i < nodeListAddress.getLength(); i++) {
                Node node = nodeListAddress.item(i);
                if ("Address".equals(node.getLocalName())) {
                    node.setTextContent(address);
                    break;
        protected String getMessageID(SOAPHeader header) {
            NodeList nodeListMessageId = header.getElementsByTagName("MessageID");
            return nodeListMessageId.item(0).getTextContent();
        @Override
        public boolean handleMessage(SOAPMessageContext context) {
            Boolean isOutbound = (Boolean) context.get(SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY);
            if (isOutbound) {
                try {
                    SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
                    SOAPHeader header = envelope.getHeader();
                    /* extract the generated MessageID */
                    String messageID = getMessageID(header);
                    context.put("MessageID", messageID);
                    context.setScope("MessageID", Scope.APPLICATION);
                    /* change ReplyTo address */
                    setAnAddress(header, "ReplyTo", (String) context.get("ReplyTo"));
                    setAnAddress(header, "FaultTo", (String) context.get("FaultTo"));
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
            return true;
    4c) CallbackSEI.java - endpoint on the client for server to send the SOAP response back to the client
    package test.wsclient;
    import javax.annotation.Resource;
    import javax.jws.Oneway;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.xml.ws.Action;
    import javax.xml.ws.RequestWrapper;
    import javax.xml.ws.WebServiceContext;
    import javax.xml.ws.soap.Addressing;
    @WebService
    @Addressing
    //@HandlerChain(file = "/handler-chain.xml")
    public class CallbackSEI {
        @Resource
        private WebServiceContext context;
         * If there is no namespace specified in the method below, then the CallbackSEI needs to be in the same package as the
         * WS endpoint.
        @Oneway
        @Action(input="http://services.nowhere.org/RandomTest/nextRandomResponse")
        @RequestWrapper(localName="nextRandomResponse", targetNamespace="http://services.nowhere.org/")
        public void handleNotification(@WebParam(name="return")long random) {
            System.out.println("Asynch response received");
            System.out.println( random );
            //System.out.println("This response relates to the message ID: "+ getMessageID());
    In summary:
    Server is listening on port 8080
    Client will listen in port 8082 for the callback from the server for the SOAP response
    Now when I run the client, I see that the proper behaviour as far as ws-addressing is concerned. That is:
    client  -- SOAP request ( on port 8080 ) --> server
    client <-- HTTP 202 ( empty HTTP body )  --- server
    client <-- SOAP response ( on port 8082 )  --- server
    All well and good, except that I am getting a NullPointerException on the client side when I call the operation.
    With debugging of the SOAP request and responses, I get the following output:
    ---[HTTP request - http://localhost:8080/servertest/RandomTest]---
    Accept: text/xml, multipart/related
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "http://services.nowhere.org/RandomTest/nextRandomRequest"
    User-Agent: JAX-WS RI 2.2.8 svn-revision#13980
    <?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8080/servertest/RandomTest</To><Action xmlns="http://www.w3.org/2005/08/addressing">http://services.nowhere.org/RandomTest/nextRandomRequest</Action><ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://localhost:8082/servertest/RandomCallback</Address>
    </ReplyTo><FaultTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://localhost:8082/servertest/RandomCallbackFault</Address>
    </FaultTo><MessageID xmlns="http://www.w3.org/2005/08/addressing">uuid:bcd2f6ef-3034-49e8-b837-dbd6a772fb93</MessageID></S:Header><S:Body><ns2:nextRandom xmlns:ns2="http://services.nowhere.org/"><arg0>false</arg0></ns2:nextRandom></S:Body></S:Envelope>--------------------
    ---[HTTP response - http://localhost:8080/servertest/RandomTest - 202]---
    null: HTTP/1.1 202 Accepted
    Content-Length: 0
    Content-Type: text/xml;charset=UTF-8
    Date: Fri, 18 Jul 2014 08:34:36 GMT
    Server: Apache-Coyote/1.1
    java.lang.NullPointerException
        at com.sun.proxy.$Proxy38.nextRandom(Unknown Source)
        at test.wsclient.ClientTest.testAddressing(ClientTest.java:43)
        at test.wsclient.ClientTest.main(ClientTest.java:18)
    ---[HTTP request]---
    Cache-control: no-cache
    Host: localhost:8082
    Content-type: text/xml; charset=UTF-8
    Content-length: 704
    Connection: keep-alive
    Pragma: no-cache
    User-agent: Apache CXF 2.7.7.redhat-1
    Accept: */*
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><Action xmlns="http://www.w3.org/2005/08/addressing">http://services.nowhere.org/RandomTest/nextRandomResponse</Action><MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:65d8d7fc-09e4-494a-a9c5-0a01faf4d7e6</MessageID><To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8082/servertest/RandomCallback</To><RelatesTo xmlns="http://www.w3.org/2005/08/addressing">uuid:bcd2f6ef-3034-49e8-b837-dbd6a772fb93</RelatesTo></soap:Header><soap:Body><ns2:nextRandomResponse xmlns:ns2="http://services.nowhere.org/"><return>2870062781194370669</return></ns2:nextRandomResponse></soap:Body></soap:Envelope>--------------------
    Asynch response received
    2870062781194370669
    As you can see from the output above, the proxy is throwing an Exception when it receives the HTTP 202 response.
    Any ideas ?

    I think I have found when I get this error and probably I have found a bug. I will appreciate if someone can confirm this.
    In my BPEL project setup, my BPEL process's wsdl file imports another wsdl from different namespace. Here is sample snippet -
    <wsdl:definitions targetNamespace="http://namespace/1">
    <wsdl:import namespace="http://namespace/2" location="resources/another.wsdl"/>
    <plnk:partnerLinkType....../>
    </wsdl:definitions>
    Please let me know. I checked the bundled samples with Oracle BPEL PM and did not find any similar case where process wsdl imports another wsdl.
    Thank you.
    Meghana

  • Error when calling getAllServerPools() using WebService API

    Hi,
    I try to get All the Server Pool created on my Oracle VM Manager with the WebService API, but i'm get an error.
    Here is the code (I used the wsimport to create proxy class Oracle VM 2.2.0):
    - 1.Get "AdminService Webservice" --> OK
    private AdminService_Service adminServiceService=null;
    private AdminService adminService=null;
    try
    this.adminServiceService=new AdminService_Service(new URL(url + WS.CONTEXT_PATH +WS.ADMINSERVICEWS),new QName(WS.QNAME, WS.ADMINSERVICE));
    catch (MalformedURLException e)
    // TODO Auto-generated catch block
    e.printStackTrace();
    this.adminService=this.adminServiceService.getAdminServiceSoapHttpPort();
    bindProvider = (BindingProvider) this.adminService;
    requestContext = bindProvider.getRequestContext();
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url + WS.CONTEXT_PATH +WS.ADMINSERVICEPORT);
    requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
    requestContext.put(BindingProvider.USERNAME_PROPERTY, userName);
    requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
    - 2. Login to OracleVM Manager with an administrator user account--> OK
    LoginElement loginElmnt=new LoginElement();
    loginElmnt.setAccountName(userName);
    loginElmnt.setPassword(encyptPassword(password));
    LoginResponseElement res=this.adminService.login(loginElmnt);
    String loginToken=res.getResult();
    --> Admin Session token: 510175389-1257996206446
    -3. Get the "ServerPoolService Webserice" --> OK
    private ServerPoolService serverPoolService=null;
    private ServerPoolService_Service serverPoolSrvService=null;
    try
    this.serverPoolSrvService=new ServerPoolService_Service(new URL(url + WS.CONTEXT_PATH +WS.SERVERPOOLSERVICEWS),new QName(WS.QNAME, WS.SERVERPOOLSERVICE));
    catch (MalformedURLException e)
    // TODO Auto-generated catch block
    e.printStackTrace();
    this.serverPoolService=this.serverPoolSrvService.getServerPoolServiceSoapHttpPort();
    bindProvider = (BindingProvider) this.serverPoolService;
    requestContext = bindProvider.getRequestContext();
    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url + WS.CONTEXT_PATH +WS.SERVERPOOLSERVICEPORT);
    requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
    requestContext.put(BindingProvider.USERNAME_PROPERTY, userName);
    requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
    -4. Get the AllServerPool --> KO
    GetAllServerPoolsElement getAllServerPool=new GetAllServerPoolsElement();
    GetAllServerPoolsResponseElement getAllserverPoolResp=null;
    ServerPool serverPool=new ServerPool();
    List<ServerPool> serverPoolArr=new ArrayList<ServerPool>();
    i have the java.lang.NullPointerException when calling:
    getAllserverPoolResp=this.serverPoolService.getAllServerPools(getAllServerPool);
    What is the problem ?
    Thanks in advance,
    Christophe.

    just a silly bug....

  • Java client error - initPlugins NullPointerException

    I am writing my first java PAPI client and getting a NullPointerException when calling processService.createSession.
    I have included the following in my build classpath: ftlib.jar, ftpapi.jar, fuegocore.jar, Opta2000.jar
    And, I am including the following in the runtime classpath: fuegoclient-papi.jar, Opta2000.jar
    I get the following exception:
    {color:#ff0000}Exception in thread "main" java.lang.NullPointerException
    at fuego.boot.Loader.initPlugins(Loader.java:638)
    at fuego.boot.Loader.initPlugins(Loader.java:630)
    at fuego.papi.ProcessService.getFactory(ProcessService.java:660)
    at fuego.papi.ProcessService.create(ProcessService.java:429)
    at com.myco.papitest.Test1.main(Test1.java:23){color}
    The code I'm using looks like this:
    {color:#0000ff}Properties svcCfg = new Properties();
    svcCfg.setProperty(ProcessService.DIRECTORY_ID, "default");
    svcCfg.setProperty(ProcessService.DIRECTORY_PROPERTIES_FILE, "c:/bea/papi/conf/directory.properties");
    svcCfg.setProperty(ProcessService.DIRECTORY_PROPERTIES_URL, "jdbc:inetdae7://qasql:1433?database=ALBPM_FDI_1&tds9=false");
    svcCfg.setProperty(ProcessService.WORKING_FOLDER, "c:/temp");
    try {
    ProcessService processService = ProcessService.create(svcCfg);
    ProcessServiceSession session = processService.createSession("myusrname", "mypwd", "qafuego");
    session.close();
    processService.close();
    } catch (CommunicationException e) {
    System.out.println("Could not connect to Directory Service");
    e.printStackTrace();
    } catch (OperationException e) {
    System.out.println("Could not perform the requested operation");
    e.printStackTrace();
    {color}
    I've tried every combination of setting up the svcCfg properties I can think of with no luck so far.
    The current contents of c:/bea/papi/conf/directory.properties is:
    {color:#0000ff}provider.mssqlserver.anonymous-user=sa
    provider.mssqlserver.anonymous-password=mysapwd
    {color}
    Any advice would be greatl appreciated!
    Thanks,
    Todd
    Edited by: user10039463 on Feb 27, 2009 8:20 AM

    I would recommend including all libraries from bea/albpm5.7/enterprise/client/papi/lib on your classpath when running. If using the weblogic or websphere version the path is bea/albpm5.7/j2eewl/client/papi/lib

  • Newbie in EJB3 - what is wrong with my code?

    I am trying to learn EJB 3 and wrote this code using Netbeans.
    Stateless Bean:
    package ejb;
    import javax.ejb.Stateless;
    @Stateless
    public class HelloBean implements HelloRemote {
        public String sayhello(){
            String s = "Hello";
            return s;
    }Interface:
    package ejb;
    import javax.ejb.Remote;
    @Remote
    public interface HelloRemote {
        public String sayhello();
    }Client application:
    public class Client {
        @EJB
        private static HelloRemote sess;
        public static void main(String[] args) throws Exception{
                    InitialContext initialContext = new InitialContext();
                    String result = sess.sayhello();
                    System.out.println(result);
    }I get a NullPointerExeption when I run the client application but do not know why. Can anyone help?
    Thank you.

    public class Client {
    @EJB
    private static HelloRemote sess;
    public static void main(String[] args) throws Exception{
    InitialContext initialContext = new InitialContext();
    String result = sess.sayhello();
    System.out.println(result);
    }I get a NullPointerExeption when I run the client application but do not know why. Can anyone help?Same reason anyone anywhere under any circumstances gets a NullPointerException. Calling a Method on a null reference. Try adding the following:
    InitialContext initialContext = new InitialContext();
    System.out.println("sess="+sess);
    String result = sess.sayhello();You very well may be SHOCKED to learn that sess is null.

Maybe you are looking for

  • Web is not working

    My wiki server is offline after i did a server update. i do not have any idea on where shall i start in the troubleshooting process. attached is the screenshot of the overview of my web service. Appreciate for any useful advice

  • HT201303 how do i delete my credit card information

    i recently got rid of my credit card and i need the payment option to simply be the gift cards i buy how do i delet my information

  • Can't send email with wifi

    I have the Apple mail set up , but cannot send or receive email. I used to be able to send when I was using my cell phone as a modem, but since I am on wifi, I can't even send email. I also have my Netscape webmail set up to use like it is Pop email.

  • Airplay mirroring and external monitor

    I have an Macbook Pro 15 that I just bought.  I am airplay mirroring to a external monitor.  I have a bluetooth keyboard and touchpad.  When I close the lid on the Macbook after I get the mirroring started, the external monitor goes blank.  When I op

  • Country taken off of subscription list

    I was wondering why Sierra Leone was taken off of the subscription list. I call there a lot and without the subscription, there are cheaper companies to call with. I feel like skype is losing lots of business by deleting this subscription. Is there a