Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Architecture & Framework
» Spring Framework
打印话题 寄给朋友 订阅主题 |
作者 | 请教Spring错误问题 |
Platformer
发贴: 5 积分: 0 |
于 2006-05-22 09:57
这是我写的测试代码: package com.towset.sshdlib.util; import org.hibernate.Session; import org.hibernate.Transaction; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.towset.sshdlib.business.IEleBookService; import com.towset.sshdlib.business.service.EleBookImp; import com.towset.sshdlib.business.IBookMarkService; import com.towset.sshdlib.business.service.BookMarkImp; import com.towset.sshdlib.business.IBorrowInfoService; import com.towset.sshdlib.business.service.BorrowInfoImp; import com.towset.sshdlib.model.BookConern; import com.towset.sshdlib.model.BookMark; import com.towset.sshdlib.model.BorrowBookInfo; import com.towset.sshdlib.model.ElectionBook; import com.towset.sshdlib.model.UserInfo; public class Test { IEleBookService service; EleBookImp ebi; // IBookMarkService ibmark; // BookMarkImp bmark; // IBorrowInfoService ibinfo; // BorrowInfoImp binfo; ElectionBook eb = new ElectionBook(); BookConern bc = new BookConern(); UserInfo ui=new UserInfo(); BookMark bm=new BookMark(); BorrowBookInfo bbi=new BorrowBookInfo(); public void save(){ ApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"daoBean.xml","serviceBean.xml"}); // ApplicationContext context= // new ClassPathXmlApplicationContext("bean.xml"); // ebi=(EleBookImp)context.getBean("ieleBookService"); service=(IEleBookService)context.getBean("ieleBookService"); // Session se = HibernateUtil.currentSession(); // Transaction tx = se.beginTransaction(); bc.setCname("renyou"); bc.setCisbn("345"); bc.setCtel("1357"); bc.setCaddress("shanghai"); bc.setCremark("haode"); eb.setEthesis("zero"); eb.setEresponsible("wang"); eb.setEisbn("12423"); eb.setEurl("d:/TowSet"); eb.setEsort("kexue"); eb.setEclegree(2); eb.setEremark("chenggong"); eb.setBconern(bc); System.out.println("bao"); // se.save(eb); // tx.commit(); // HibernateUtil.closeSession(); // ebi.createObject(eb); service.createObject(eb); } public ElectionBook getEleBookByIsbn(Long isbn){ ApplicationContext context= new ClassPathXmlApplicationContext(new String[]{"daoBean.xml","serviceBean.xml"}); ebi=(EleBookImp)context.getBean("eleBookService"); return eb=ebi.findById(isbn); } public void deleteElebook(String isbn){ ApplicationContext context= new ClassPathXmlApplicationContext(new String[]{"daoBean.xml","serviceBean.xml"}); ebi=(EleBookImp)context.getBean("eleBookService"); ebi.deleteObject(isbn); } public static void main(String[] args) { // TODO 自动生成方法存根 Test te = new Test(); te.save(); } } ----------------------------------------------提示以下错误信息------------------------------ [web] WARN [main] Configurator.configure(126) | No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/SSHdlib1/WebRoot/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml bao Exception in thread "main" java.lang.NullPointerException at com.towset.sshdlib.business.service.BaseService.createObject(BaseService.java:22) at com.towset.sshdlib.business.service.BaseService$$FastClassByCGLIB$$f6752a3d.invoke(<generated> at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643) at com.towset.sshdlib.business.service.EleBookImp$$EnhancerByCGLIB$$acc686d5.createObject(<generated> at com.towset.sshdlib.util.Test.save(Test.java:72) at com.towset.sshdlib.util.Test.main(Test.java:90) 我找了好长时间但还是找不到,希望各位大大帮帮小弟!~ 请求JAVA学习方向????? |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
12544 | 请教Spring错误问题 | Platformer | 4237 | 2006-05-22 09:57 |
11620 | Re:请教Spring错误问题 | Davis129 | 100 | 2006-05-30 10:50 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |