抱歉,如果我的問題混淆導致這是我第一次提出問題。如果有什麼我可以做的更清楚,告訴我,這樣我可以改善我的問題。從webservice檢查數據庫netbeans
當前我試圖從netbeans,可以檢查一些數據從數據庫中的Web服務。因爲我是新手,所以我遵循 http://programmerguru.com/webservice-tutorial/how-to-create-java-webservice-in-netbeans/的教程來製作網絡服務。
但是當我試圖用mybattis通常的方式檢查數據庫時,它保留給我java.lang.nulpointerexception。當我嘗試調試它,它給我「不可用變量信息,源代碼編譯沒有-g選項」,並拋出我InvocationTargetException.java
public InvocationTargetException(Throwable target) {
super((Throwable)null); // Disallow initCause
this.target = target;
}
這裏是Web服務
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.bismillah.berkah;
import com.bismillah.berkah.dao.DummyDao;
import com.bismillah.berkah.daoImpl.DummyDaoImpl;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
/**
*
* @author Ari
*/
@WebService(serviceName = "Check4Update")
public class Check4Update {
public DummyDaoImpl ddi;
/**
* This is a sample web service operation
*
* @param InTerminalNumber
* @return
*/
@WebMethod(operationName = "CheckUpdate")
public String hello(@WebParam(name = "InTerminalNumber") String InTerminalNumber) {
String OutError = "";
String OutMessage = "";
if (InTerminalNumber == null) {
return "InTerminalNumber can't be null";
} else {
Map mapdao = new HashMap<String, Object>();
Map map = new HashMap<String, Object>();
map.put("InTerminalNumber", InTerminalNumber);
mapdao = ddi.check4UpdatePatch(map);
OutError = (String) mapdao.get("OutError");
OutMessage = (String) mapdao.get("OutMessage");
return "Error : " + OutError + ", with message : " + OutMessage;
}
}
public void setDdi(DummyDaoImpl ddi) {
this.ddi = ddi;
}
}
這裏是代碼mybattis IMPL
package com.bismillah.berkah.daoImpl;
import com.bismillah.berkah.Check4Update;
import com.bismillah.berkah.config.MyBatisConnectionFactory;
import com.bismillah.berkah.dao.*;
import java.util.Map;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
/**
*
* @author Ari
*/
public class DummyDaoImpl
{
private SqlSessionFactory sqlSessionFactory;
public DummyDaoImpl()
{
sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactory();
}
public Map check4UpdatePatch(Map map)
{
Check4Update c4u = new Check4Update();
c4u.setDdi(this);
SqlSession session = sqlSessionFactory.openSession();
try
{
session.selectOne("dummy.check4UpdatePatch", map);
} catch (Exception ex)
{
ex.toString();
} finally
{
session.close();
}
return map;
}
}
你能告訴我怎麼解決?所以我可以獲得數據?順便說一下,我總是拋出我的網絡服務,在此準確
mapdao = ddi.check4UpdatePatch(map);
再次抱歉,如果我的問題令人困惑的原因,這是我第一次做的問題。如果有什麼我可以做的更清楚,告訴我,這樣我可以改善我的問題。