myBatis中的莫名其妙的java.lang.NullPointerException,求指教

xml:

<!-- ognl访问静态方法的表达式 为@class@method(args),以下为调用Ognl.isNotEmpty()方法,还有其它方法如isNotBlank()可以使用,具体请查看Ognl类 -->



AND SRLNO = '${h_srlno}'


AND URGEDATE = '${h_date}'

    </where>
</sql>
<select id="findBySrlnoDate" parameterType="java.util.HashMap" resultType="com.mf.cntrtmng.entity.BsnsOverdueUrge">
    SELECT 
        <include refid="selectId" />
        FROM bsns_overdue_urge 
        <include refid="querywheresrlnodate"/>
</select>

DAO:
public BsnsOverdueUrge findBySrlnoDate(Map params) throws DataAccessException;

Serviceimpl:
public boolean exist(Map params) {
System.out.println("=====搜索出来的");
System.out.println(params);
if(bsnsOverdueUrgeDao.findBySrlnoDate(params)==null)
return true;
else
return false;
}

错误日志:
=====搜索出来的
{h_srlno=JH201505281535107052, h_date=20150601}
2015-06-01 15:19:42,922 DEBUG http-bio-8080-exec-3 - Creating a new SqlSession
2015-06-01 15:19:42,922 DEBUG http-bio-8080-exec-3 - Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d41567b]
2015-06-01 15:19:42,924 DEBUG http-bio-8080-exec-3 - JDBC Connection [jdbc:mysql://localhost:3306/microfinance?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true, UserName=root@localhost, MySQL-AB JDBC Driver] will be managed by Spring
2015-06-01 15:19:42,925 DEBUG http-bio-8080-exec-3 - ooo Using Connection [jdbc:mysql://localhost:3306/microfinance?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true, UserName=root@localhost, MySQL-AB JDBC Driver]
2015-06-01 15:19:42,928 DEBUG http-bio-8080-exec-3 - ==> Preparing: select count(1) from (SELECT NO, SRLNO, CLNTNO, URGEID, URGENAME, URGEDATE FROM bsns_overdue_urge WHERE SRLNO = 'JH201505281535107052' AND URGEDATE = '20150601') tmp_count
2015-06-01 15:19:42,929 DEBUG http-bio-8080-exec-3 - ==> Parameters:
2015-06-01 15:19:42,930 DEBUG http-bio-8080-exec-3 - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d41567b]
2015-06-01 15:19:42,930 DEBUG http-bio-8080-exec-3 - Initiating transaction rollback
2015-06-01 15:19:42,931 DEBUG http-bio-8080-exec-3 - Rolling back JDBC transaction on Connection [jdbc:mysql://localhost:3306/microfinance?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true, UserName=root@localhost, MySQL-AB JDBC Driver]
2015-06-01 15:19:42,932 DEBUG http-bio-8080-exec-3 - Transaction synchronization rolling back SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d41567b]
2015-06-01 15:19:42,932 DEBUG http-bio-8080-exec-3 - Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d41567b]
2015-06-01 15:19:42,933 DEBUG http-bio-8080-exec-3 - Releasing JDBC Connection [jdbc:mysql://localhost:3306/microfinance?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true, UserName=root@localhost, MySQL-AB JDBC Driver] after transaction
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.lang.NullPointerException

The error may exist in file [E:\SpringSource.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\microfinance20150203\WEB-INF\classes\com\mf\cntrtmng\entity\mapper\bsnsoverdueurge-mapper.xml]

The error may involve com.mf.cntrtmng.dao.BsnsOverdueUrgeDao.findBySrlnoDate-Inline

The error occurred while setting parameters

Cause: java.lang.NullPointerException

2015-06-01 15:19:42,933 DEBUG http-bio-8080-exec-3 - Returning JDBC Connection to DataSource
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
at com.sun.proxy.$Proxy11.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
at com.sun.proxy.$Proxy114.findBySrlnoDate(Unknown Source)
at com.mf.cntrtmng.service.impl.BsnsOverdueUrgeServiceImpl.exist(BsnsOverdueUrgeServiceImpl.java:128)
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:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy115.exist(Unknown Source)
at com.mf.aftrmng.controller.LoanWarnController.showUrgeInfo(LoanWarnController.java:310)
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:597)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.mf.interceptor.HeadInterceptor.doFilter(HeadInterceptor.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

从日志里面打印的SQL,可以在数据库中搜索,怎么返回值变成了count(),我不是在xml中配置的返回值类型为一个对象类型么“resultType="com.mf.cntrtmng.entity.BsnsOverdueUrge"?”然后包了莫名其妙的空指针错误,求大神帮忙看看,小弟感激不尽~~

1

3个回答


FROM bsns_overdue_urge
这两个引用的sql也贴下

0
yllcxsj
yllcxsj <include refid="selectId" /> FROM bsns_overdue_urge <include refid="querywheresrlnodate"/>
大约 4 年之前 回复

去掉拦截器就可以访问

0

sql里的字段与实体类里要对应,大小写也要注意

-3
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
错误:java.lang.NullPointerException,求指教!
jsp+sql2000+Tomcat 5.0,ie浏览器打开用户登录界面,提示以下错误rnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjava.lang.NullPointerExceptionrn com.bean.LoginBean.login(LoginBean.java:20)rn com.servlet.LoginServlet.doGet(LoginServlet.java:41)rn com.servlet.LoginServlet.doPost(LoginServlet.java:76)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn我纯菜鸟,请问高手怎么解决啊?rnrn
莫名其妙的java.lang.NullPointerException错误,急!!!
本人用eclipse+tomcat5.0.28开发一个项目,在本机上一切正常,现在我把workstation下面的项目文件夹webapp拷贝(就是简单的拷贝)到一台服务器上发布,环境和开发用机一摸一样,首页也能进去,接下去就报错:rnrnjava.lang.NullPointerExceptionrn gongjiao.Userbean.getGroup(Userbean.java:537)rn org.apache.jsp.page.board_jsp._jspService(board_jsp.java:75)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn----------------rn按照出错的说明好像指userbean.getgroup取到了空值, rnrn我反复检查,没有取空,而且我在开发机上一切正常,为什么换了一台机器,就有问题呢,请大侠赐教!!rn
莫名其妙!WSAD又报java.lang.NullPointerException。
实在不知道哪里错了,很是苦恼。唉~~rn代码如下:rnclass Create_SavernString key;rnString file_path;rnString project_code;rnString project_name;rnString unit_code;rnString area_code;rnString area_name;rnrnVector files;rnint count;rnHashtable[] ht;rnrnprivate DataSource ds;rnprivate Connection conn = null;rnprivate Statement stmt = null;rnprivate ResultSet rs = null;rnprivate InitialContext ic = null;rn rnpublic Create_Save(ConnMailDB connmaildb) rn super();rn ds = connmaildb.getDataSource();rn conn = connmaildb.getConnection();rn stmt = connmaildb.getStatement();rn ic = connmaildb.getInitialContext();rnrnpublic void getDirInfo()rn rn tryrn rn ResultSet info_rs = stmt.executeQuery("select count(*) from sub_project");rn if(info_rs.next()) rn rn count = rs.getInt("count(*)"); //一到这就报java.lang.NullPointerExceptionrnrn ht = new Hashtable[count];rn rn elsern rn System.out.println("找不到上报文件的保存路径信息!");rn return;rn rn info_rs = stmt.executeQuery("select project_code,project_name from sub_project");rn if(info_rs.next())rn rn for(int i=0;i
mybatis求指教
用mybatis执行一个查询,用浏览器第一次访问,没有问题,一刷新,就出错了,错误如下rnorg.apache.ibatis.exceptions.PersistenceException: rn### Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed.rn### The error may exist in com/test/cms/backmanager/DAO/implement/Channel.xmlrn### The error may involve com.test.cms.model.Channel.searchChannelrn### The error occurred while executing a queryrn### Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed.rnrnrn重启服务器,出现如下错误rnAn internal error has occurred.rnjava.lang.NullPointerExceptionrnrn用debug发现这条代码有错rn[code=Java]list = session.selectList("com.test.cms.model.Channel.searchChannel", map);[/code]rnrnrn对应的配置文件如下rn[code=XML]rn select * from t_channelrn rn where name like #namern rn limit #offset,#pagesizern rnrn rn select count(*) from t_channelrn rn where name like #namern rn rn[/code]rn小弟刚学,菜的很,求高手帮个忙,解决一下,万分感谢……
MyBatis 遇到java.lang.NullPointerException
014-06-07 15:11:25,794 [com.psa.pd.sera.biz.process.VesselProcessor.retrieveConnectionByServiceInfoUIList(VesselProcessor.java:356)] ERROR - Unknown exceptionrnorg.apache.ibatis.exceptions.PersistenceException: rn### Error querying database. Cause: java.lang.NullPointerExceptionrn### Cause: java.lang.NullPointerExceptionrn at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
java.lang.NullPointerException问题,请指教
情况描述如下:rn编译正常,运行抛出空指针异常。rn总共三个文件,一个CreateDBServlet.java文件,一个web.xml文件,一个自己配的ch08.xml文件。我把数据库驱动包已经放到相应目录下了,具体代码如下:rnrnCreateDBServlet.javarn-------------------------------------------------------------------------------------------------rnpackage org.sunxin.lesson.jsp.bookstore;rnrnimport javax.servlet.*;rnimport javax.servlet.http.*;rnimport java.io.*;rnimport java.sql.*;rnrnrnpublic class CreateDBServlet extends HttpServletrn private String url1;rn private String user;rn private String password;rnrn public void init() throws ServletExceptionrn String driverClass = getInitParameter("driverClass");rn url1 = getInitParameter("url1");rn user = getInitParameter("user");rn password = getInitParameter("password");rn rn tryrn Class.forName(driverClass); //加载并注册驱动程序rn rn catch(ClassNotFoundException ce)rn throw new UnavailableException("加载数据库驱动失败");//如果没找到驱动程序,抛出不可异常rn rn rn rn public void doGet(HttpServletRequest req,HttpServletResponse resp)throws ServletException , IOExceptionrn Connection conn = null;rn Statement stmt = null;rn tryrn conn = DriverManager.getConnection(url1,user,password);rn stmt = conn.createStatement();rn stmt.executeUpdate("create database bookstore");rn stmt.executeUpdate("use bookstore");rn stmt.executeUpdate("create table bookinfo(id INT not null primary key,title VARCHAR(50) not null ,author VARCHAR(50) not null,bookconcern VARCHAR(100) not null,publish_date DATE not null,price FLOAT(4,2) not null,amount SMALLINT,remark VARCHAR(200))ENGINE = InnoDB");rn stmt.addBatch("insert into bookinfo values(1,'Java从入门到精通','张三','张三出版社','2004-6-1' ,34.00,35,null)");rn stmt.addBatch("insert into bookinfo values(2,'JSP深入编程','李四','李四出版社','2004-10-1' ,56.00,20,null)");rn stmt.addBatch("insert into bookinfo values(3,'J2EE高级编程','王五','王五出版社','2005-3-1',78.00,10,null)");rn stmt.executeBatch();rn rn PrintWriter out = resp.getWriter();rn out.println("success!");rn out.close();rn rn catch(SQLException se)rn se.printStackTrace();rn rn finallyrn if(stmt!=null)rn tryrn stmt.close();rn rn catch(SQLException se)rn se.printStackTrace();rn rn stmt = null;rn rn if(conn!=null)rn tryrn conn.close();rn rn catch(SQLException se)rn se.printStackTrace();rn rn conn = null;rn rn rn rn rn-----------------------------------------------------------------------------------------------------------------rnweb.xml代码如下:rn-----------------------------------------------------------------------------------------------------------------rnrnrnrn Set Character Encodingrn SetCharacterEncodingFilterrnrnrnrn Set Character Encodingrn /*rnrnrnrn CreateDBServletrn org.sunxin.lesson.jsp.bookstore.CreateDBServletrnrnrn rn dirverClassrn com.mysql.jdbc.Driverrn rn rn rn urlrn jdbc:mysql://localhost:3306/mysqlrn rn rn rn userrn rootrn rn rn rn passwordrn rootrn rnrnrnrn CreateDBServletrn /createdbrnrnrnrn--------------------------------------------------------------------------------------------------------rnch08.xml代码如下:rn--------------------------------------------------------------------------------------------------------rn
Tapestry莫名其妙的问题,求大虾指教。
我先把代码摘抄如下:rnNodeTest.javarnrnpackage com.test.tools;rnrnimport java.io.File;rnimport java.io.Serializable;rnrnpublic class NodeTest implements Serializablernrn /**rn * rn */rn private static final long serialVersionUID = 4737690332317229958L;rn rn private String _sTestString;rnrn public NodeTest(String name) rn _sTestString = name;rn // TODO Auto-generated constructor stubrn //this.name = name;rn rnrn rn public static void main(String[] args)rn NodeTest n = new NodeTest("test");rn System.out.println(n.getSTestString());rn rnrnrn public String getSTestString() rn return _sTestString;rn rnrnrn public void setSTestString(String testString) rn _sTestString = testString;rn rnrn rnrnrnrnTableListTest.java rnrnpackage com.test.tapestry.compentent;rnrnimport java.util.ArrayList;rnimport java.util.Iterator;rnimport java.util.List;rnimport java.util.Set;rnrnimport org.apache.tapestry.IRequestCycle;rnimport org.apache.tapestry.annotations.InjectComponent;rnimport org.apache.tapestry.contrib.table.components.TableView;rnimport org.apache.tapestry.html.BasePage;rnrnimport com.test.tapestry.global.GetTableList;rnimport com.test.tapestry.global.TableNode;rnimport com.test.tools.NodeTest;rnrnpublic abstract class TableListTest extends BasePage rnrnrn @InjectComponent("table")rn public abstract TableView getTable();rnrn @SuppressWarnings("unchecked")rn public List getListValues() rn ArrayList _list = GetTableList.getTable("ResourceDir",null);rn Iterator e = _list.iterator();rn List _NodeTestLists=new ArrayList();rn while(e.hasNext())rn NodeTest t = (NodeTest)e.next();rn System.out.println("得到文件"+t.getSTestString());rn _NodeTestLists.add(new NodeTest(t.getSTestString()));rn rn System.out.println(_NodeTestLists);rn return _NodeTestLists;rn rnrnrn public boolean getCheckboxSelected() rn return getSelectedNodes().contains(getCurrentNode());rn rnrn @SuppressWarnings("unchecked")rn public void setCheckboxSelected(boolean bSelected) rn NodeTest currNodeTest = getCurrentNode();rn Set setSelectedNodeTests = getSelectedNodes();rn System.out.println("执行选择添加");rn System.out.println(setSelectedNodeTests);rn if (bSelected)rn setSelectedNodeTests.add(currNodeTest);rn elsern setSelectedNodeTests.remove(currNodeTest);rn System.out.println("选择的文件"+setSelectedNodeTests);rn setSelectedNodes(setSelectedNodeTests);rn rnrnrn @SuppressWarnings("unchecked","unchecked")rn public void delNodes(IRequestCycle objCycle) rnrn rnrn public abstract NodeTest getCurrentNode();rnrn public abstract Set getSelectedNodes();rnrn public abstract void setSelectedNodes(Set set); rnrnrnrnTableList.htmlrnrnrn rnrnrn rn rn rn rn rn rn rn rn rn rnrnrn rn rn rn rn rn rn rn rn rn rn rnrn rn rnrnrnrnrnTableList.pagernrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrn问题是TableListTest的setCheckboxSelected函数中,执行断点debug时,如果NodeTest如上面所列,则执行NodeTest currNodeTest = getCurrentNode();时currNodeTest值为null,而同样的代码,不做任何改动,仅将NodeTest继承于File,则currNodeTest值为得到的列表中的值。真是莫名其妙,我已经三天都难以释怀了,网上也查了不少,始终没有找到答案,请各位指教,不胜感激。
莫名其妙的问题,请指教
我有一个ASP和.NET混用的程序,在从ASP程序进入.NET程序时常出现下面的错误,无法跟踪,面且在不退出程序的情况下多点几下.NET的链接(次数不确定)连续出现下面的错误后又会莫名其妙的正常运行!rnrn“/skjc”应用程序中的服务器错误。rn--------------------------------------------------------------------------------rnrn配置错误 rn说明: 在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。 rnrn分析器错误信息: 访问被拒绝:“xxxx”。rnrn源错误: rnrnrn行 170: rn行 171: rn行 172: rn行 173: rn行 174:rn rnrn源文件: c:\winnt\microsoft.net\framework\v1.0.3705\Config\machine.config 行: 172 rnrnrn--------------------------------------------------------------------------------rn版本信息: Microsoft .NET 框架版本:1.0.3705.0; ASP.NET 版本:1.0.3705.0
莫名其妙的故障,请指教........
hWnd 句柄竟然为空 !!!!!rnrnrnrnint WINAPI WinMain( HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpszCmdLine, int nCmdShow )rnrnrn MessageBox( NULL, "APP start", "", 1 );rnrn HWND hWnd;rn MSG Msg;rn WNDCLASS wc;rn char * lpszClassName = "窗口";rn char * lpszTitle = "My_Windows";rnrn wc.style = CS_HREDRAW | CS_VREDRAW;rn wc.lpfnWndProc = WndProc;rn wc.cbClsExtra = 0;rn wc.cbWndExtra = 0;rn wc.hInstance = hInstance;rn wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );rn wc.hCursor = LoadCursor( NULL, IDC_ARROW );rn wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );rn wc.lpszMenuName = NULL;rn wc.lpszClassName = lpszClassName;rnrn if( !RegisterClass( &wc ) )rn rn MessageBeep( 0 );rn return FALSE;rn rnrn hWnd = CreateWindow( lpszClassName, lpszTitle, WS_VISIBLE | WS_MINIMIZEBOX, 50, 50, 450, 450, NULL,NULL, hInstance, NULL );rnrn if( !hWnd )rn rn MessageBox( NULL, "hWnd = NULL", "", 1 );rn return 0 ;rn rnrn ShowWindow( hWnd, SW_SHOW ); rn UpdateWindow( hWnd );rnrn while( GetMessage( &Msg, NULL, 0, 0 ) )rn rn TranslateMessage( &Msg );rn DispatchMessage( &Msg );rn rnrn return Msg.wParam;rnrn
java.lang.NullPointerException 求帮忙 。。。。。
大神们给我看看为啥空指针吧n2015-05-25 16:20:32,830 ERROR [500.jsp] 72 - <>njava.lang.NullPointerExceptionn at org.hibernate.hql.ast.util.SessionFactoryHelper.findSQLFunction(SessionFactoryHelper.java:365)n at org.hibernate.hql.ast.tree.IdentNode.getDataType(IdentNode.java:289)n at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:165)n at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:831)n at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:619)n at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:672)n at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)n at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)n at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)n at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)n at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)n at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:101)n at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:80)n at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)n at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)n at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)n at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)n at com.iflytek.iframework.orm.hibernate.HibernateGenericDao.createQuery(HibernateGenericDao.java:436)n at com.iflytek.iframework.orm.hibernate.HibernateGenericDao.findPage(HibernateGenericDao.java:223)n at net.zx.hxjr.zzjggl.interfaces.AbstractZzjggl.getPage(AbstractZzjggl.java:33)n at net.zx.hxjr.zzjggl.interfaces.AbstractZzjggl$$FastClassByCGLIB$$c3aea1a3.invoke()n at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)n at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:628)n at net.zx.hxjr.zzjggl.service.ZzjgManager$$EnhancerByCGLIB$$efd93d18.getPage()n at net.zx.hxjr.zzjggl.controller.ZzjgController.zzjgList(ZzjgController.java:38)n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)n at java.lang.reflect.Method.invoke(Method.java:597)n at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)n at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)n at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)n at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)n at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)n at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)n at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)n at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)n at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)n at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)n at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)n at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)n at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)n at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)n at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)n at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)n at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)n at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)n at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)n at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)n at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)n at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)n at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)n at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)n at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)n at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)n at org.mortbay.jetty.Server.handle(Server.java:324)n at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)n at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)n at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)n at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)n at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)n at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)n at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)nn2015-05-25 16:20:35,638 ERROR [500.jsp] 72 - <>![![图片说明](https://img-ask.csdn.net/upload/201505/25/1432544386_412533.png)图片说明](https://img-ask.csdn.net/upload/201505/25/1432544371_665958.png)
java.lang.NullPointerException 空指针异常 求解决
java.lang.NullPointerExceptionrn com.psger.dao.UserBeanDao.getUserBeanByUsername(UserBeanDao.java:33)rn com.psger.servlet.LoginServlet.doPost(LoginServlet.java:68)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn com.psger.servlet.EncodingFilter.doFilter(EncodingFilter.java:25)rnrnpackage com.psger.dao;rnrnimport java.sql.Connection;rnimport java.sql.PreparedStatement;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.util.ArrayList;rnimport java.util.List;rnrnimport com.psger.entity.UserBean;rnrnrnrnpublic class UserBeanDao rn rn private Connection conn = null;rn private PreparedStatement pstmt = null;rn private ResultSet rs = null;rn rn UserBean user = null;rn rn /**rn * 根据用户名取得用户对象rn * @param username 传入的用户名rn * @return 查询到的用户对象rn */rn public UserBean getUserBeanByUsername(String userName) rn //UserBean user = null;rn String sql = "SELECT * FROM tb_user WHERE userName=?";rn rn conn = CommonDao.getConn();rn try rn pstmt = conn.prepareStatement(sql);rn pstmt.setString(1, userName);rn rn rs = pstmt.executeQuery();rn if(rs.next())rn user = new UserBean();rn user.setUserId(rs.getInt("userId"));rn user.setUserName(rs.getString("userName"));rn user.setUserPassword(rs.getString("userPassword"));rn user.setUserSex(rs.getString("userSex"));rn user.setUserAge(rs.getInt("userAge"));rn user.setTelephone(rs.getString("telephone"));rn user.setAddress(rs.getString("address"));rn user.setRoleId(rs.getInt("roleId"));rn rn rn catch (SQLException e) rn e.printStackTrace();rn finallyrn CommonDao.shutDown();rn rn return user;rn rn rn /**rn * 获取所有用户列表,同时通过多表连接查询出权限rn * @return rn */rn public List getAllUsers()rn List user_list = new ArrayList();rn rn String sql = "select u.*,r.roleName from TB_USER u,TB_ROLE r where u.roleId=r.roleId order by userId";rn conn = CommonDao.getConn();rn try rn pstmt = conn.prepareStatement(sql);rn rs = pstmt.executeQuery();rn rn while (rs.next())rn user = new UserBean();rn rn user.setUserId(rs.getInt("userId"));rn user.setUserName(rs.getString("userName"));rn user.setUserPassword(rs.getString("userPassword"));rn user.setUserSex(rs.getString("userSex"));rn user.setUserAge(rs.getInt("userAge"));rn user.setTelephone(rs.getString("telephone"));rn user.setAddress(rs.getString("address"));rn user.setRoleId(rs.getInt("roleId"));rn user.setRoleName(rs.getString("roleName"));rn rn user_list.add(user);rn rn catch (SQLException e) rn e.printStackTrace();rn finally rn CommonDao.shutDown();rn rn rn return user_list;rn rnrn /**rn * @param idrn * @return 根据用户id,返回对应用户信息rn */rn public UserBean getUserInfoById(String id) rn rn String sql = "select u.*,r.roleName from TB_USER u,TB_ROLE r where u.roleId=r.roleId and u.userId=?";rn rn conn = CommonDao.getConn();rn try rn pstmt = conn.prepareStatement(sql);rn pstmt.setString(1,id);rn rn rs = pstmt.executeQuery();rn rn if (rs.next())rn user = new UserBean();rn rn user.setUserId(rs.getInt("userId"));rn user.setUserName(rs.getString("userName"));rn user.setUserPassword(rs.getString("userPassword"));rn user.setUserSex(rs.getString("userSex"));rn user.setUserAge(rs.getInt("userAge"));rn user.setTelephone(rs.getString("telephone"));rn user.setAddress(rs.getString("address"));rn user.setRoleId(rs.getInt("roleId"));rn user.setRoleName(rs.getString("roleName"));rn rnrn rn catch (SQLException e) rn e.printStackTrace();rn finally rn CommonDao.shutDown();rn rn return user;rn rn /**rn * @pramat namern * @return 根据用户名返回用户信息rn */ rn public UserBean getUserInfoByName(String name)rn rn String sql = "select u.*,r.roleName from TB_USER u,TB_ROLE r where u.roleId=r.roleId and u.userName=?";rn rn conn = CommonDao.getConn();rn try rn pstmt = conn.prepareStatement(sql);rn pstmt.setString(1,name);rn rn rs = pstmt.executeQuery();rn rn if (rs.next())rn user = new UserBean();rn rn user.setUserId(rs.getInt("userId"));rn user.setUserName(rs.getString("userName"));rn user.setUserPassword(rs.getString("userPassword"));rn user.setUserSex(rs.getString("userSex"));rn user.setUserAge(rs.getInt("userAge"));rn user.setTelephone(rs.getString("telephone"));rn user.setAddress(rs.getString("address"));rn user.setRoleId(rs.getInt("roleId"));rn user.setRoleName(rs.getString("roleName"));rn rn rn catch (SQLException e) rn e.printStackTrace();rn finally rn CommonDao.shutDown();rn rn return user;rn rn rn /**rn * 根据权限名获得权限IDrn */rn public int getIdByRoleName(String name)rn rn int id = 0; rn String sql = "select roleId from tb_role where roleName=?";rn rn// rs = CommonDao.query(sql,name);rn try rn conn = CommonDao.getConn();rn pstmt = conn.prepareStatement(sql); rn pstmt.setString(1,name );rn rs = pstmt.executeQuery();rn if (rs.next()) rn id = rs.getInt("roleId");rn rn rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn finallyrn CommonDao.shutDown();rn rn rn return id;rn rn rn rnrn /**rn * 添加用户信息rn * rn */rn public boolean addUserInfo(UserBean ub)rn String sql ="insert into TB_USER values(?,?,?,?,?,?,?,?)";rn rn// System.out.println(ub.getUserId());rn// System.out.println(ub.getUserName());rn// System.out.println(ub.getUserPassword());rn// System.out.println(ub.getUserSex());rn// System.out.println(ub.getUserAge());rn// System.out.println(ub.getTelephone());rn// System.out.println(ub.getAddress());rn// System.out.println(ub.getUserId());rnrn rn String[] info =ub.getUserId()+"",ub.getUserName(),ub.getUserPassword(),ub.getUserSex(),rn ub.getUserAge()+"",ub.getTelephone(),ub.getAddress(),ub.getRoleId()+"";rn rn return CommonDao.update(sql, info)>0;rn rn rnrn rn rn /**rn * 修改用户信息rn * rn */rn public boolean updateUserInfo(UserBean ub)rn rn String sql = "UPDATE TB_USER set userName=?,userSex= ?,userAge=?,telephone=?,address=? WHERE userId=?";rn rn String[] info=ub.getUserName(),ub.getUserSex(),rn ub.getUserAge()+"",ub.getTelephone(),ub.getAddress(),ub.getUserId()+""; rn return CommonDao.update(sql, info)>0;rn rn /**rn * 根据用户id,删除用户信息rn * rn */rn public boolean deleteUserById(String id) rn rn String sql = "delete from TB_USER where userId=?";rn rn return CommonDao.update(sql, new String[]id)>0;rn rn rn /**rn *@param userbeanrn *@return 根据用户id,修改密码rn */rn public boolean updateUserPasswd(UserBean userbean)rn rn String sql = "update TB_USER set userPassword=? where userId=?";rn rn return CommonDao.update(sql, new String[]userbean.getUserPassword(),userbean.getUserId()+"")>0 ? true : false;rn rnrnrnrn/**rn * rn */rnpackage com.psger.servlet;rnrnimport java.io.IOException;rnimport java.util.List;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnimport javax.servlet.http.HttpSession;rnrnrnimport com.psger.dao.RoleRightDao;rnimport com.psger.dao.UserBeanDao;rnimport com.psger.entity.RightBean;rnimport com.psger.entity.UserBean;rnrn/**rn * @author Psgerrn * rn */rn@SuppressWarnings("serial")rnpublic class LoginServlet extends HttpServlet rnrn public void doGet(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rnrn this.doPost(request, response);rn rnrn public void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rnrn // 处理乱码rn request.setCharacterEncoding("UTF-8");rnrn String flag = request.getParameter("flag");rn rn String path ="./index.jsp";rnrn HttpSession session = request.getSession();// 用户存放用户信息rn if (flag.equals("loginIn")) rn // 接收用户的输入rn String username = request.getParameter("username");rn String userpass = request.getParameter("password");rn String input = request.getParameter("checkCode");rn String rand = (String) session.getAttribute("rCode");rnrn // 服务端验证rn if (username == null || "".equals(username.trim())) rn response.sendRedirect(path);rn rn if (userpass == null || "".equals(userpass.trim())) rn response.sendRedirect(path);rn rn if (!input.equals(rand)) rn String msg = " ";rn request.setAttribute("err", msg);rn request.getRequestDispatcher(path).forward(request,response);rn return;rn rnrn // 调用ado层,根据用户名取得用户对象rn UserBeanDao userDao = new UserBeanDao();rn UserBean user = userDao.getUserBeanByUsername(username);rnrn // 判断rn boolean result = false;rn if (user != null) // 用户名存在rn if (user.getUserPassword().equals(userpass)) // 密码也对rn // 登录成功rn result = true;rn rn rnrn if (result) rn // 登录成功rn // HttpSession session = request.getSession();rn session.setAttribute("USER", user);rn session.setAttribute("user_name", user.getUserName());// 用于防止非法登录rnrn // 读取该用户所拥有的菜单权限rn RoleRightDao roleRightDao = new RoleRightDao();rn List list = roleRightDao.getRightsByRoleId(userrn .getRoleId());rnrn // 把list传入到firmest里去rn session.setAttribute("rightList", list);rnrn response.sendRedirect("/supermarket/jsp/main.jsp");rnrn else rn String msg = " ";rn request.setAttribute("err", msg);rn request.getRequestDispatcher(path).forward(request,response);rn rn else if (flag.equals("loginOut")) rn session.invalidate();rnrn request.getRequestDispatcher("/jsp/logout.jsp").forward(request,rn response);rn return;rn rnrnrn rnrnrn
java.lang.NullPointerException 求高手帮忙
程序运行到下面这个位置的时候报了一个:java.lang.NullPointerExceptionrnrn[code=Java] // 从指定文件名读入配置信息rn public ConfDataLoader(String fileName) rn try rn URL fileURL = this.getClass().getClassLoader().getResource(fileName);rn rn //FileInputStream fin = new FileInputStream(fileName);rn config.load(fileURL.openStream()); // 载入文件rn //fin.close();rn catch (Exception ex) rn ex.printStackTrace();rn rn fn = fileName;rn [/code]rnrn求高手帮忙!
报错java.lang.NullPointerException,求指点
在输出单个建站性价比时OK,但后面就报错了,应该是134,135行有错,但不知道怎么改,请教大神rn[code=java]import java.util.*;rnrnclass site implements Cloneablern rn char name;rn int cost ;rn int sale ;rn site[] relations;rn rn rn site(char a,int c,int b)rn rn this.name = a;rn this.cost = c;rn this.sale = b;rn rn rn site(site s)rn this.name = s.name;rn this.cost = s.cost;rn this.sale = s.sale;rn this.relations = s.relations;rnrnrn rn rn void set_relations(site[] s)rn this.relations = s;rn rn rn int saleadditor()rn int sum = this.sale;rn for(int i = 0;i
莫名其妙的win2k问题?高手指教!
我的计算机装的是windows 2000 professional,当我把系统装好后(计算机有两块网卡,adsl,用这台代理其他上网)打开“网络和拨号连接”能够看到两个本地连接,等我在系统上安装了好多的应用程序后,再打开“网络和拨号连接”时发现看不到本地连接的图标了(奇怪:>),但是我的网络运行一切正常,就是进行一些网络设置时麻烦,自己又不知道怎么找原因,请问有没有高手遇到了同样的问题,怎么解决?rn 谢谢!!!!!!!rn 急呀!!!!!!!rn 解决问题后我再加分!:)
感觉莫名其妙,请高手指教
const int max=15;rn#include "Node.h"rnclass Meragernrn public:rn Merage(int a[]);rn void Merage_sort();rn void dis();rn private:rn Node *head,*hh;rn;rnMerage::Merage(int a[])rnrn int i;rn Node*p=new Node(a[0]);rn head=p;rn for(i=1;inext=new Node(a[i]);rn p=p->next;rn rnrnrnvoid Merage::dis()rnrn cout<data<<' ';rn p=p->next;rn rn cout<<"End"<
实在是莫名其妙,有请各位指教。
一台小型机服务器,多个拨号网点本地有oracle服务器。数据通讯采用db link 直接交换数据。其间碰到一些怪事:就是上报很慢或者经常发生死锁。rn无论怎么改进过程都无效,最后实在没有办法的办法采用动态sql才基本解决。rn具体情况:rn 一上报过程主要代码:(其它情况类似)rn create or replace procedure up_sale(gsdm varchar2,bmdm varchar2,qsrq date,jsrq date) asrn beginrn delete from tablename@dblinkname rn where gsdm00=gsdm and bmdm00=bmdm rn and trunc(ywrq00)>=trunc(qsrq)rn and trunc(ywrq00)<=trunc(jsrq);rn insert into tablename@dblinkname(col1,col2...)rn select col1,col...rn from tablenamern where gsdm00=gsdm and bmdm00=bmdm rn and trunc(ywrq00)>=trunc(qsrq)rn and trunc(ywrq00)<=trunc(jsrq);rn commit;rnexception when others thenrnrollback;rnend;rn/rnrn就是以上最简单的几句代码会非常之慢,或者发生死锁。rn实在是匪夷所思.rn后我将其改为动态sql执行正常.rn谁能给我个比较合理的解释rn rn
出现Exception in thread "main" java.lang.NullPointerException求指教,急急急
public class txtTOarray rn public static void main(String[] args)rn try rn File file = new File("D:\\array1.txt");rn BufferedReader in;rn FileReader fr=new FileReader(file);rn in = new BufferedReader(fr);rn int n=200;rn int[][] arr=new int[n][];rn String line=""; //一行数据rn int row=0;rn try rn while((line = in.readLine())!= null)rn String[] temp = line.split("\t"); rn for(int j=0;j
新手求指教,mybatis一对多查询
User和Order是一对多关系,现在数据库里一个User有多个Order,[b]主键名字都是id[/b],要根据User的id查出User,并且它所有的Order,在User的xml中,resultMap里id的c[code=text][/code]olumn属性写id,collection里边的column属性(Order)也写id,这样查出来的Order只有Order的id和User的id相同的一条数据,我知道解决办法一个是起别名,除了这个还有其他方法吗,不要说数据库的主键别叫一样的名字- -,不知道我有没有表述清楚,求大神指教,不胜感激。rn
hibernate和mybatis怎么取舍,求指教。
一直用jpa+hibernate, 简单查询就用JpaRepository,复杂的自己写JPQL,感觉还够用。但是最近mybatis好像很火。n网上评论大都是hibernate优化比较复杂,上手慢,mybatis比较容易使用。n有两件事不明白:n1 hibernate复杂在哪里呢,一般项目中需要涉及到很多方面的优化吗?n2 看了下mybatis的手册,有了点一知半解。感觉配置挺多的,真的那么好用吗?还有用mybatis就不用优化吗?nhelp~~
求指教求指教!
我自己写了个jsp,登入用的,一点登入就出现The server encountered an internal error () that prevented it from fulfilling this request.这是什么问题呀?真心求解压?
myBatis的错误: Error querying database. Cause: java.lang.NullPointerException
[code=csharp] rnrn rn selectrn rn mis_id,mis_name,appendix,mis_db_id,mor_db_id,log_db_idrn rn rn count(1) as record_countrn rn from CFG_MIS arn rn 1 = 1rn rn rn[/code]rnrn异常:Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: rn### Error querying database. Cause: java.lang.NullPointerExceptionrn### The error may exist in com/powere2e/smms/dao/sql/h2/CfgMisMapper.xmlrn### The error may involve com.powere2e.smms.dao.h2.CfgMisDao.searchCfgMisrn### The error occurred while executing a queryrn### Cause: java.lang.NullPointerException
java.lang.NullPointerException
各位大哥帮小弟看看啊~谢谢啊rnjavax.servlet.ServletExceptionrn org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn com.zjhcsoft.idap.struts.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:104)rnrnrnroot cause rnrnjava.lang.NullPointerExceptionrn com.zjhcsoft.idap.database.agent.IdapMainAgent.insertNumber(IdapMainAgent.java:331)rn com.zjhcsoft.idap.struts.IdapUserUpload.IdapUserImportAction.execute(IdapUserImportAction.java:129)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn com.zjhcsoft.idap.struts.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:104)rnrn
java.lang.NullPointerException???
小弟我正在做个聊天程序,服务器已经连接上了,当运行登录界面后就出现如下错误,请各位大侠指点下,不胜感激……rnException in thread "AWT-EventQueue-0" java.lang.NullPointerExceptionrn at New.login_mouseClicked(New.java:125)rn at New$1.mouseClicked(New.java:60)rn at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)rn at java.awt.Component.processMouseEvent(Unknown Source)rn at javax.swing.JComponent.processMouseEvent(Unknown Source)rn at java.awt.Component.processEvent(Unknown Source)rn at java.awt.Container.processEvent(Unknown Source)rn at java.awt.Component.dispatchEventImpl(Unknown Source)rn at java.awt.Container.dispatchEventImpl(Unknown Source)rn at java.awt.Component.dispatchEvent(Unknown Source)rn at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)rn at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)rn at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)rn at java.awt.Container.dispatchEventImpl(Unknown Source)rn at java.awt.Window.dispatchEventImpl(Unknown Source)rn at java.awt.Component.dispatchEvent(Unknown Source)rn at java.awt.EventQueue.dispatchEvent(Unknown Source)rn at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)rn at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)rn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rn at java.awt.EventDispatchThread.run(Unknown Source)rnrn
java.lang.NullPointerException?
报错“java.lang.NullPointerException“是怎么回事啊?rn
java.lang.NullPointerException ????????
==============连接数据库的Bean======================rnpackage bbsclass;rnimport java.sql.*;rnrnpublic class bbsconnrn String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";rn String sConnStr = "jdbc:odbc:bbs";rn Connection conn = null;rn ResultSet rs = null;rnrnpublic bbsconn() rntry rn Class.forName(sDBDriver); rnrncatch(java.lang.ClassNotFoundException e) rn System.err.println("bbsreg(): " + e.getMessage());rnrnrnrnpublic ResultSet executeQuery(String sql) rnrs = null;rntry rn conn = DriverManager.getConnection(sConnStr); rn Statement stmt = conn.createStatement();rn rs = stmt.executeQuery(sql);rn rncatch(SQLException ex) rn System.err.println("aq.executeQuery: " + ex.getMessage());rn System.err.println("aq.executeQuerystrSQL: " + sql);rnrnreturn rs;rnrn.....rnrn=========只是知执行一个查询的过程==========================rnimport bbsclass.bbsconn;rnimport java.io.PrintStream;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnrnpublic class TestBbs implements java.io.Serializablernrn bbsconn bbsCon=null;rn ResultSet rs;rn rn public void TestBbs()rn rn bbsCon = new bbsconn();rn rs=null;rn rnrn public boolean search()rn rn ResultSet rs = null;rn tryrn rn rs = bbsCon.executeQuery("select * from user");rn if (rs.next())rn rn return true;rn rn elsern return false;rn rn catch (SQLException e)rn rn System.err.println(e.getMessage());rn System.out.println(e.getMessage());rn return false;rn rn rnrn public static void main(String[] args)rn rn TestBbs testBbs = new TestBbs();rn if (testBbs.search())rn rn System.out.print("有数据!");rn rn elsern rn System.out.print("没有数据!");rn rn rnrnrn执行TestBbs 的时候总是报:rnjava.lang.NullPointerExceptionrn at TestBbs.search(TestBbs.java:22)rn at TestBbs.main(TestBbs.java:40)rnException in thread "main" Normal Terminationrn我该怎么处理???? rnrnrnrnrnrnrnrn