ClassPathXmlApplicationContext 手动加载spring时遇到的问题

通过ClassPathXmlApplicationContext 加载spring时 在加载到hibernate配置文件的时候就报错了 ,而且有时不报错有时就报错

错误:

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [hibernate.cfg.xml]; nested exception is java.net.ConnectException: Connection timed out: connect
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:416)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
at com.nodeproxy.database.base.ApplicationContextSingleton.getInstance(ApplicationContextSingleton.java:21)
at com.nodeproxy.thread.service.ServiceDownloadThread.run(ServiceDownloadThread.java:23)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:790)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:731)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:656)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:979)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1089)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1002)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
... 18 more

看异常我感觉是hibernate dtd的问题,但是dtd是先从本地找的,我直接用tomcat起项目的话就没有问题,求解

2个回答

nested exception is java.net.ConnectException: Connection timed out: connect
at

hibernate.cfg.xml的问题

你的cfg头是什么?

换成如下试试:

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

yh502564622
yh502564622 所以我也很纠结啊 不过好在没有在出现过这个问题了
接近 7 年之前 回复
jinnianshilongnian
jinnianshilongnian 如果手动加载hibernate配置的话可能要联网去加载dtd文件 ,而网速慢就导致了 连接延迟,没有dtd就不能解析配置 不过hibernate jar包中都有dtd的啊 这个肯定是不需要的 之前使用从没有遇到这种情况
接近 7 年之前 回复
yh502564622
yh502564622 我用ClassPathXmlApplicationContext 加载的时候把hibernate的配置文件也加载了 ,但是在spring的配置文件中又引用了hibernate的配置, 不知道是不是重复了的问题, 我刚让ClassPathXmlApplicationContext 只加载spring的配置就可以了。 如果手动加载hibernate配置的话可能要联网去加载dtd文件 ,而网速慢就导致了 连接延迟,没有dtd就不能解析配置了
接近 7 年之前 回复
yh502564622
yh502564622 谢谢 你提醒了我 我搞定了
接近 7 年之前 回复
jinnianshilongnian
jinnianshilongnian 对, 不是我说的问题, 你在eclipse中运行造成的? 很奇怪 。 既然你和spring集成了,就不需要hibernate.cfg.xml了 你可以把该配置文件卡掉
接近 7 年之前 回复
yh502564622
yh502564622 如果配置错误啊之类的话 那我用tomcat启动也一定会报错的 但是现在tomcat启的话完全正常 而手动加载的话就会包上边那种 连接超时的错误
接近 7 年之前 回复
jinnianshilongnian
jinnianshilongnian 这个之前遇到过 doctype造成 hibernate不能运行
接近 7 年之前 回复
yh502564622
yh502564622 头就是这个 配置肯定没有问题的 因为有时候就能运行哦
接近 7 年之前 回复

打出的异常是IO异常,确定路径是否正确吧

yh502564622
yh502564622 其实我一直认为是网络问题的 但是tomcat起的话又正常 纠结啊
接近 7 年之前 回复
chawei784533
chawei784533 能否确定不是网络问题
接近 7 年之前 回复
yh502564622
yh502564622 对啊 昨天下午一直都是时好时坏的 这个错误让我郁闷的啊
接近 7 年之前 回复
chawei784533
chawei784533 那有时报错有时不报错都是手动启动吗?
接近 7 年之前 回复
yh502564622
yh502564622 我用tomcat起就完全没有问题啊 所以能确定配置没有问题啊
接近 7 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring的ClassPathXmlApplicationContext
我想用dom4j模拟一下spring的ioc,可是最后一句总空指针 是怎么回事rnpublic ClassPathXmlApplicationContext() throws Exception rn SAXReader reader = new SAXReader();rnrn // 构造文档对象rn Document document = reader.read(new File("src/config/spring/demo0/springMethod/beans.xml"));rnrn Element rootElmt = document.getRootElement();// 获取根元素beansrn List list = rootElmt.elements("bean");// 取名字为bean的所有元素rn for (int i = 0; i < list.size(); i++) rn Element element = (Element) list.get(i);rn Attribute attr = element.attribute("id");// 通过id找到这个属性rn// System.out.println(attr.getName() + "=" + attr.getValue());//通过找到的属性的getName()和getValue()找到属性和值rn String clazz = element.attributeValue("class");//通过class找到属性值rn Object o = Class.forName(clazz).newInstance();rn System.out.println(clazz);rn beans.put(attr.getName(), o);rn rn for (Element propertyElement : (List) element.elements("property")) rn String name = propertyElement.attributeValue("name"); // userDAOrn String bean = propertyElement.attributeValue("bean"); // urn Object beanObject = beans.get(bean);// UserDAOImpl instancernrn String methodName = "set" + name.substring(0, 1).toUpperCase()rn + name.substring(1);rn System.out.println("method name = " + methodName);rnrn System.out.println(bean);rn rn Method m = o.getClass().getMethod(methodName,beanObject.getClass().getInterfaces()[0]);rn m.invoke(o, beanObject);rn rnrn rn rn rnrnxml文件:rnrn rn rn rn rnrn
spring手动加载Dispatcherservlet-servlet.xml
由于业务需要,在页面中更换数据库ip地址,rn我用下面的办法重新加载了,applicationContext-*.xmlrnContextLoader contextLoader = new ContextLoader(); rncontextLoader.closeWebApplicationContext(request.getSession().getServletContext()));rncontextLoader.initWebApplicationContext(request.getSession().getServletContext()); rn但是却不知道怎么重新加载Dispatcherservlet-servlet.xml,这个。如果不重新加载它的话,数据源还是以前的那个。请问怎么去初始化它啊?
手动加载spring配置文件
分配置文件在classpath下和web-inf下两种情况的加载: ApplicationContext context = new FileSystemXmlApplicationContext(&quot;WebRoot/WEB-INF/applicationContext.xml&quot;); new ClassPathXmlApplicationContext(&quot;applicationContext...
高分spring 中 ClassPathXmlApplicationContext问题
我把applicationContex.xml放在WEB-INF下面,用ClassPathXmlApplicationContext (rn "/applicationContext-common-business.xml");rn rnClassPathXmlApplicationContext (rn "/WEB-INF/applicationContext-common-business.xml");rnrnClassPathXmlApplicationContext (rn "applicationContext-common-business.xml");rnrn都老是说找不到文件,怎么办.是不是要设置什么rn错误如下:rnrnrnorg.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext-common-business.xml,/applicationContext-portal.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext-common-business.xml,/applicationContext-portal.xml] cannot be opened because it does not existrnjava.io.FileNotFoundException: class path resource [applicationContext-common-business.xml,/applicationContext-portal.xml] cannot be opened because it does not existrn at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:127)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:144)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:99)rn at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:102)rn at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:70)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:87)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:264)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:80)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:65)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:56)rn at com.guanghua.AppContext.(AppContext.java:31)rn at com.guanghua.AppContext.getInstance(AppContext.java:25)
ClassPathXmlApplicationContext
我的电脑重新Ghost一下以后,运行项目就出现这个结果,并弹出对话框,说javaw应用程序出错,未知的软件异常(0xc0000409),位置为(0x10001852),jdk我也重新安装了,MyEclipse也重新安装了,还是出现问题,各位高手帮下忙rnlog4j:WARN No appenders could be found for logge(org.springframework.context.support.ClassPathXmlApplicationContext).rnlog4j:WARN Please initialize the log4j system properly.
ClassPathXmlApplicationContext的问题
我在用application测试的时候,使用application app=new ClassPathXmlApplicationContext();rn但是ClassPathXmlApplicationContext new 不来,大神,这是怎么回事?
加载xml时遇到的问题
D:\xmlnode\ShowTree.cpp(69) : error C2065: 'CLSID_DOMDocument' : undeclared identifierrnD:\xmlnode\ShowTree.cpp(69) : error C2065: 'IID_IXMLDOMDocument' : undeclared identifierrnD:\xmlnode\ShowTree.cpp(71) : error C2065: 'CComVariant' : undeclared identifierrnD:\xmlnode\ShowTree.cpp(71) : error C2146: syntax error : missing ';' before identifier 'varXMLFile'rnD:\xmlnode\ShowTree.cpp(71) : error C2065: 'varXMLFile' : undeclared identifierrn上面的原因是什么呀?rn那位高手指教一下
spring中ClassPathXmlApplicationContext的一点疑惑
MessageSource resources=new ClassPathXmlApplicationContext("WEB-INF/master.xml");rn或("./WEB-INF/master.xml")rn或("master.xml")rn或("../WEB-INF/master.xml")rn或("/WEB-INF/master.xml")都会 报错,如下:rnclass path resource [WEB-INF/master.xml] cannot be opened because it does not existrnrn这是为什么呀
Spring 入门时遇到的问题
java.lang.NoSuchMethodError: org.springframework.context.i18n.LocaleContextHolder.setLocaleContext(Lorg/springframework/context/i18n/LocaleContext;Z)Vrn org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:712)rn org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:684)rn org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)rn org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn/////////////////rn在做页面提交的小例子时遇到了这个问题。rn页面:rnrn rn MyHtml.htmlrn rn rn rn rn rn rnrn rnrn rn 登录rn rn用户名:rnrn rn密 码 :rnrn rn rnrnrnrnrnrnrn////////////////rn配置文件;rnrnrnrn rn rn rn rn org.springframework.web.servlet.view.JstlViewrn rn rn rn /WEB-INF/view/rn rn rn .jsprn rn rn rn rn rn rn rn LoginActionrn rn rn rn rn rn rn net.xiaxin.action.LoginInforn rn rn loginfailrn rn rn mainrn rn rnrn////////////////////////////////rn逻辑处理文件;rnpublic class LoginAction extends SimpleFormController rn private String fail_view;rnrn // SpringFrameWork Developer’s Guide Version 0.6rn // October 8, 2004 So many open source projects. Why not Open yourrn // Documents?rn private String success_view;rnrn protected ModelAndView onSubmit(Object cmd, BindException ex) throws Exception rn LoginInfo loginInfo = (LoginInfo) cmd;// ////////// ⑵rn// net.xiaxin.action.LoginAction;rn// org.springframework.context.i18n.LocaleContextHolder.setLocale(null);rn if (login(loginInfo) == 0) rn HashMap result_map = new HashMap();rn result_map.put("logininfo", loginInfo);rn List msgList = new LinkedList();rn msgList.add("msg1");rn msgList.add("msg2");rn msgList.add("msg3");rn result_map.put("messages", msgList);rn return new ModelAndView(this.getSuccess_view(), result_map); // ////////⑶rn else rn return new ModelAndView(this.getFail_view());rn rn rnrn private int login(LoginInfo loginInfo) rn if ("Erica".equalsIgnoreCase(loginInfo.getUsername())rn && "mypass".equals(loginInfo.getPassword())) rn return 0;rn rn return 1;rn rnrn public String getFail_view() rn return fail_view;rn rnrn public String getSuccess_view() rn return success_view;rn rnrn // SpringFrameWork Developer’s Guide Version 0.6rn // October 8, 2004 So many open source projects. Why not Open yourrn // Documents?rn public void setFail_view(String string) rn fail_view = string;rn rnrn public void setSuccess_view(String string) rn success_view = string;rn rnrnrn/////////////////rn有谁知道。。?谢谢。。
new ClassPathXmlApplicationContext时出异常
[code=Java]ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml");[/code]rn是抛异常rn这是异常信息:rn[code=Java]Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryrn at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:145)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.(AbstractRefreshableApplicationContext.java:84)rn at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.(AbstractRefreshableConfigApplicationContext.java:59)rn at org.springframework.context.support.AbstractXmlApplicationContext.(AbstractXmlApplicationContext.java:58)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:136)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at com.springmodel.A.main(A.java:14)rn[/code]rn这是beans.xml中的信息rn[code=Java]rnrn rn rn rn[/code]
手动加载模架加载
手动加载模架模架教程手动加载模架模架教程手动加载模架模架教程手动加载模架模架教程
Spring 手动注入 不需要@Autowired 加载注入
因项目需要,需要动态得去创建某个类,但是这个类里得mapper缺不可以用;另外一个直连数据库得没问题;是因为当你new一个新的类得时候里面的mapper没有加载进去,只在项目启动的时候@Autowired 进行加载;所以这个时候就需要动态的去把这个mapper加载进去; 新建一个公共类 package com.cnpc.dj.party.common; import org.springfra...
jetty 手动 加载spring mvc demo
NULL 博文链接:https://nbaertuo.iteye.com/blog/366847
java第一次加载项目时遇到的问题
1. 系统报很多js的错误,首先点击项目属性 2. 输入war,找到javascript->validation->Errors/Warnings,将验证javascript的勾选去掉即可 2.
用xmldatadocument加载xml文档时遇到的问题
http://www.prweb.com/xml/sports.xmlrn我要加载上面这个xml文档,如果使用下面这段代码的话,会抛出异常:未找到所需的DTD标记。行2,位置3。rn Dim XmlDoc As New XmlDataDocumentrn Dim RssUrl As String = "http://www.prweb.com/xml/sports.xml"rn XmlDoc.Load(RssUrl)rn而如果先把该xml文件下载到本地,再加载的话就不会抛出异常,代码如下:rn Dim XmlDoc As New XmlDataDocumentrn Dim RssUrl As String = "http://www.prweb.com/xml/sports.xml"rnMy.Computer.Network.DownloadFile(RssUrl, Application.StartupPath & "\tmp.xml")rnXmlDoc.Load(Application.StartupPath & "\tmp.xml")rnrn谁能告诉我这是为什么?rn
加载struts+hibernate+spring项目时遇到的问题
由于刚刚开始作这样的项目rnrn对于一下的rn 严重: Error listenerStartrn2007-4-11 18:56:14 org.apache.catalina.core.StandardContext startrn严重: Context [/auth] startup failed due to previous errorsrnrn提示不知道该怎么解决,还请各位前辈支招
项目集成junit时遇到的加载问题
序       最近接手一个项目,有时候想测试个接口都走界面,第一是麻烦,第二是没法看性能。所以我决定增加junit的单测环境,并写个基类,以后的测试类直接继承这个基类再写测试业务逻辑。     遇到的问题首先是spring的类加载,配置文件里写了两份,但是呢有一份在项目里有没有找到,不知道什么鬼。我想保证单测环境尽量与开发一致,所以有设置bean的加载方式。     首先来看看我的基类,基...
求助!eclipse加载时遇到的问题。
前几天为了解决Servlet问题,我卸载了java se jdk并安装了java ee sdk不知道是不是因为这个,现在打开eclipse的时候总是弹出一下错误提示框“未能复原工作台”。详细信息如下:rnrnrnrn[color=#FF0000]复原工作台时出现了问题。rn 无法复原透视图:Workspace - Java EE。rn 未能创建视图:org.eclipse.ui.navigator.ProjectExplorerrn 未能创建视图:org.eclipse.ui.navigator.ProjectExplorerrn 未能创建视图:org.eclipse.wst.server.ui.ServersViewrn 未能创建视图:org.eclipse.wst.server.ui.ServersViewrn 未能创建视图:org.eclipse.datatools.connectivity.DataSourceExplorerNavigatorrn 未能创建视图:org.eclipse.datatools.connectivity.DataSourceExplorerNavigatorrn 未能创建视图:org.eclipse.wst.common.snippets.internal.ui.SnippetsViewrn 未能创建视图:org.eclipse.wst.common.snippets.internal.ui.SnippetsViewrn 找不到视图:org.eclipse.ui.navigator.ProjectExplorerrn 找不到视图:org.eclipse.wst.server.ui.ServersViewrn 找不到视图:org.eclipse.datatools.connectivity.DataSourceExplorerNavigatorrn 找不到视图:org.eclipse.wst.common.snippets.internal.ui.SnippetsView[/color]
Spring ClassPathXmlApplicationContext报错,求大神帮忙
[img=https://img-bbs.csdn.net/upload/201805/30/1527641391_312592.png][/img]rnrnJAVA用的是 Eclipse Jee Oxygen,SPRING用的是spring-webmvc 3.2.8
spring的基础(一)自己写的ClassPathXmlApplicationContext类
NULL 博文链接:https://cuiran.iteye.com/blog/487385
android手机手动加载wifi驱动的问题
各位大婶,我由于项目需要,要做个android上的wifi和3G并传的程序,就是3G和wifi同时打开。看到网上介绍主要有两种方案rn1。修改wpa_supplicant,使得打开wifi的时候不关闭3G.rn2。绕过系统的framework层,直接加载wifi驱动。rn第一种难度略高,就采用了第二条路。参考的是csdn上ROger__Wong的博客。rn参考教程:[url=http://blog.csdn.net/roger__wong/article/details/8603275][/url]rn我用的是小米1s。加载驱动用的是类似的命令rn[code=c]insmod /system/lib/modules/bcmdhd.ko "firmware_path=/system/etc/firmware/fw_bcm4329.bin nvram_path=/system/etc/firmware/nvram.txt iface_name=eth0"[/code]rn可以看到驱动貌似成功加载了rn[code=c]root@android:/ # lsmodrnbcmdhd 277201 0 - Live 0xbf056000rnroot@android:/ # rn[/code]rn而且用netcfg观察时也能看到rn[code=c]root@android:/ # netcfg rnlo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00rndummy0 DOWN 0.0.0.0/0 0x00000082 6e:12:59:7d:4a:eernrmnet0 UP 10.18.146.148/30 0x00000041 00:00:00:00:00:00rnrmnet1 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnrmnet2 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnrmnet3 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnrmnet4 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnrmnet5 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnrmnet6 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnrmnet7 DOWN 0.0.0.0/0 0x00000000 00:00:00:00:00:00rnsit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00rnip6tnl0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00rneth0 DOWN 0.0.0.0/0 0x00001002 00:90:4c:11:22:33rnroot@android:/ # rn[/code]rn看样子网卡驱动是加载上了。但是用dmesg打印内核信息的时候会看到提示错误如下rn[code=c]<4>[ 976.537405] [DHD] rn<4>[ 976.537411] Dongle Host Driver, version 5.90.125.95.3rn<4>[ 976.537417] Compiled in drivers/net/wireless/bcmdhd on May 31 2012 at 19:33:07rn<6>[ 976.590411] mmc2: new high speed SDIO card at address 0001rn<4>[ 976.594720] [DHD] F1 signature read @0x18000000=0x16044330rn<4>[ 976.595121] [DHD] si_doattach: CHIPID(sih->chip)=4330, sih->chiprev=4rn<4>[ 976.603262] [DHD] DHD: dongle ram size is set to 294912(orig 294912)rn<4>[ 976.603679] [DHD] wl_iw_attach thr:6d4 startedrn<4>[ 976.603816] [DHD] wl_iw_bt_init thr:6d5 startedrn<4>[ 976.603981] [DHD] dhd_attach thr:6d6 startedrn<4>[ 976.604112] [DHD] dhd_attach thr:6d7 startedrn<4>[ 976.604222] [DHD] dhd_attach thr:6d8 startedrn<4>[ 976.604566] [DHD] wifi_get_mac_addrrn<4>[ 976.611230] [DHD] Broadcom Dongle Host Driver: register interface [eth0] MAC: 00:90:4c:11:22:33rn<4>[ 976.611307] [DHD] load firmware from /system/etc/firmware/fw_bcm4329.binrn<4>[ 976.678104] [DHD] dhdsdio_download_nvram: nvram_path=/system/etc/firmware/nvram.txtrn<4>[ 976.679322] [DHD] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.rn<4>[ 976.680510] [DHD] GOT STA FIRMWARErn<4>[ 977.676950] [DHD] dhdsdio_htclk: HT Avail timeout (1000000): clkctl 0x50rn<4>[ 977.677026] [DHD] dhd_bus_init: clock state is wrong. state = 1rn<4>[ 977.677453] [DHD] dev_wlc_ioctl: Error dev_open: -1rn<4>[ 978.676733] [DHD] dev_wlc_ioctl: Error dev_open: -1rn<4>[ 979.676724] [DHD] dev_wlc_ioctl: Error dev_open: -1rn<4>[ 980.676699] [DHD] dev_wlc_ioctl: Error dev_open: -1rn<4>[ 980.676771] [DHD] Set ISCAN for wl_iw_iscan failed with 0rn<4>[ 984.687100] net_ratelimit: 14 callbacks suppressedrn<4>[ 984.687169] [DHD] dhdsdio_htclk: HT Avail timeout (1000000): clkctl 0x50rn<4>[ 984.687238] [DHD] dhd_bus_init: clock state is wrong. state = 1rn<4>[ 984.687420] [DHD] dhd_bus_start failed bus is not readyrn<4>[ 984.687578] [DHD] dhd_open: failed with code -19rn<4>[ 984.687632] [DHD] dev_wlc_ioctl: Error dev_open: -1rn<4>[ 984.687698] [DHD] wl_iw_iscan_get returns error -1rn<6>[ 1001.215910] max17043 update new athdrn<6>[ 1001.216919] max17043 set athd:0x0e67 soc:9rn<6>[ 1001.216975] max17043 soc:9 9 v:3756rn<3>[ 1001.217082] battery capacity very low = 9rn<3>[ 1001.224542] battery capacity very low = 9rn<6>[ 1061.215709] max17043 soc:9 9 v:3787rn<3>[ 1061.215844] battery capacity very low = 9rn<3>[ 1061.223442] battery capacity very low = 9rn<6>[ 1121.215930] max17043 update new athdrn<6>[ 1121.216939] max17043 set athd:0x0c67 soc:10rn[/code]rn而且用将网卡状态由down调整到up的时候提示问题rn[code=c]root@android:/ # netcfg eth0 uprnaction 'up' failed (Operation not permitted)rn1|root@android:/ # rn[/code]rn内核新手,不明白问题到底该如何解决,恳请各位大牛不吝赐教,指条明路!谢谢各位
spring在加载properties时出现的问题
在spring.xml中将redis.properties Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dsd' defined in class path resource [spring
模拟spring中的ClassPathXmlApplicationContext类的实现
NULL 博文链接:https://gaojiewyh.iteye.com/blog/409606
flex spring加载时异常
这几天用flex+red5做聊天案例,过程中发现经常有spring framework的异常 因为red5版本不一样,所有导入的lib也应该不一样了,这次开发的时候一不小心用的是red5-server-1.0的lib包,但是却放入了red5-1.0.0-RC1中,因为后者的red5配置文件和前者还是有点差别的,所以后者加载的时候检查发现找不到spring的包,必然错误。 red5-se...
模态框加载高德地图时,遇到的加载失败问题
模态框加载高德地图时,遇到的加载失败问题本文中将简单说一下[bootstrap][6]框架中模态框在实际应用中遇到的问题及解决方案:Qusetion 项目中使用[bootstrap][6]模态框,当点击按钮触发模态框后,在模态框中加载一个新页面,要求新页面加载出高德地图 代码如下: index.html页面代码 <!DOCTYPE html> <html> <head>
手动安装postgis时遇到的坑
在使用源代码安装postgis的过程中, 需要先安装proj-4.9.1,geos-3.5.0,libxml2-2.6.30, 最后再安装postgis. 以下是安装过程中遇到的坑.
项目中使用new ClassPathXmlApplicationContext()获得spring上下文对象的问题
问题背景:在我们的web程序中,用spring来管理各个实例(bean), 有时在程序中为了使用已被实例化的bean, 通常会用到这样的代码: ApplicationContext appContext = new ClassPathXmlApplicationContext(&quot;classpath:META-INF/spring/applicationContext-com...
在仿写spring时遇到的问题
[b][color=#FF0000]BeanDefinition类[/color][/b]package cn.junit;rnrnimport java.util.ArrayList;rnimport java.util.List;rnrnpublic class BeanDefinition rn private String id; // 元素中的 id 属性rn private String className; // 元素中的 class 属性rn private List propertyDefinitions=rn new ArrayList(); // 元素下的元素的集合rn rn rn public BeanDefinition()rn rn public BeanDefinition(String id,String className)rn this.id=id;rn this.className=className;rn rn rn rn public String getId() rn return id;rn rn public void setId(String id) rn this.id = id;rn rn public String getClassName() rn return className;rn rn public void setClassName(String className) rn this.className = className;rn rnrn public List getPropertyDefinitions() rn return propertyDefinitions;rn rnrn public void setPropertyDefinitions(List propertyDefinitions) rn this.propertyDefinitions = propertyDefinitions;rn rnrnrn[b][color=#FF0000]rnItcastClassPathXMLApplicationContext 自定义的类,仿spring框架,此处主要是测试getBean()方法[/color][/b]rnrnpackage cn.junit;rnrnimport java.net.URL;rnimport java.util.ArrayList;rnimport java.util.HashMap;rnimport java.util.List;rnimport java.util.Map;rnrnrnimport org.dom4j.Document;rnimport org.dom4j.Element;rnimport org.dom4j.XPath;rnimport org.dom4j.io.SAXReader;rnrnrnpublic class ItcastClassPathXMLApplicationContext rn private List beanDefines=new ArrayList(); // 因为 元素很多,所以有集合rn private Map sigletons=new HashMap(); // 为了存放读出来的bean对象rn rn public ItcastClassPathXMLApplicationContext(String filename)rn this.readXML(filename); // 读取配置文件rn this.instanceBeans(); // 实例化Bean对象rn rnrn rn /**rn * 完成bean的实例化rn */rn private void instanceBeans() rn // TODO Auto-generated method stubrn // 通过反射技术把这个bean给反射出来rn for(BeanDefinition beanDefinition :beanDefines)rn try rn if(beanDefinition.getClassName()!=null && !"".equals(beanDefinition.getClassName().trim()))rn // 通过Class.forName()找到这个类的名字,再通过newInstance()方法new一个实例出来rn System.out.println("if语句为真");rn sigletons.put(beanDefinition.getId(), Class.forName(beanDefinition.getClassName()).newInstance());rn elsern System.out.println("if语句为假");rn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rn rnrn /**rn * 读取xml配置文件rn * @param filenamern */rn private void readXML(String filename) rn // TODO Auto-generated method stubrn SAXReader saxReader=new SAXReader(); // 创建一个读取器rn Document document=null;rn tryrn URL xmlpath=this.getClass().getClassLoader().getResource(filename); // 取得这个类的类装载器,通过类装载器取得类路径下的filename这个文件rn document=saxReader.read(xmlpath); // 读取这个文件的内容,并赋给一个documentrn Map nsMap=new HashMap();rn nsMap.put("ns", "http://www.springframework.org/schema/beans"); // 加入命名空间rn XPath xsub=document.createXPath("//ns:beans/ns:bean");// 创建beans/bean查询路径rn xsub.setNamespaceURIs(nsMap);rn //xsub.setNamespaceURIs(nsMap);// 设置命名空间rn List beans =xsub.selectNodes(document);// 获取文档下所有bean节点rn for(Element element:beans)rn String id=element.attributeValue("id");// 获取id属性值)rn String clazz=element.attributeValue("class");//获取class属性值rn BeanDefinition beanDefine=new BeanDefinition(id,clazz);rn beanDefines.add(beanDefine);rn rn catch(Exception e)rn e.printStackTrace();rn rn rn rn /**rn * 模拟Spring的getBean方法rn * @param beanNamern * @return 返回一个在配置文件中元素中的id属性的对象rn */rn public Object getBean(String beanName)rn return this.sigletons.get(beanName);rn rnrnrnrn在测试的时候报这个错rnjava.lang.NoClassDefFoundError: org/jaxen/JaxenExceptionrn at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)rn at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207)rn at cn.junit.ItcastClassPathXMLApplicationContext.readXML(ItcastClassPathXMLApplicationContext.java:61)rn at cn.junit.ItcastClassPathXMLApplicationContext.(ItcastClassPathXMLApplicationContext.java:21)rn at cn.junit.springtest2.instanceSpring(springtest2.java:18)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)rn at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)rn at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)rn at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)rn at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)rn at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)rn at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)rn at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)rn at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)rn at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)rnrn我用的junit测试的,不知道哪位大虾能指点一下为什么错了啊?我这是在视频里看到的代码,已确认和视频里的代码一样.但不知哪里错了.
使用Spring security时遇到的问题
创建springboot 项目,选择jpa, Thymeleaf,security这三个依赖。 项目创建好之后,加上如下访问: @RestController public class UserController { @RequestMapping(&quot;/&quot;) public String info(){ return &quot;hello security&quot;; } } 启动启动类时,报错...
使用Spring 发送邮件时遇到的问题
使用Spring 发送邮件时遇到的问题
测试时遇到的问题——关于spring
&quot;exception&quot;: &quot;org.springframework.web.HttpMediaTypeNotSupportedException&quot;,&quot;message&quot;: &quot;Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported&quot;,发起请求后返回以上错误信息。网上查询答案主要有以下几种:    1. b...
手动发布程序遇到的问题
现在有一个web程序,用myeclipse5.5中的工具发布该程序,没有任何错误。如果我将程序复制到tomcat下的时候访问会出现Servlet execution throws exception。青高手指教啊,比较着急。谢谢!rnrn rn
Spring Jackson 反序列化Date时遇到的问题
Spring Jackson 反序列化Date时遇到的问题
使用spring @@Resource注解时遇到的问题
初次使用spring Annotation  配置IoC 在使用@Resource 是eclipse工具显示 Resource cannot be resolved to a type 手动导入javax.annotation.Resource后问题解决 原因是受访问限制
实验Spring cloud feion时遇到的问题
此问题暂时未解决启动项目的时候报错:java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationAttributes.getAliasedString(Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/String; at org...
配置spring 项目时遇到的问题
今天在做一个小项目时,使用了spring,但是在项目启动过程中,一直会把我的一个监听启动2次,这个监听实现了2个接口,其中一个是spring的ApplicatinListener@Component public class BlackManagerInitListener implements ServletContextListener, ApplicationListener { pr
Spring发送邮件时遇到的错误
Spring发送邮件时发生如下异常: Exception in thread "main" org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException Caused by: jav
加载dll遇到的问题
软件是由installshield打包 运行setup安装后提示 文件IDAPI32.CNF没有发现在SUPPORTDIR上rnrn 利用SUPPORTDIR调用安装过程文件失败rnrnszDllName=SUPPORTDIR ^ "SASInstall.dll "; rn nResult=UseDLL ( szDllName ); rn iResult=CallDLLFx ( szDllName , "Test " , lvValue , szResult ); rn UnUseDLL ( szDllName ); rnrn 可不可以在重写个dll直接放在打包好的,原来的dll删除. 怎样写呢?
加载内核模块遇到的问题
总结以下前一阵做的一个大作业(hack掉部分系统调用)遇到的各类问题 首先是加载内核模块时报错: Nov 26 19:42:05 baijiaao kernel: helloworld: Unknown symbol __x86_indirect_thunk_rax (err 0) Nov 26 19:59:46 baijiaao kernel: helloworld: disagrees ...
ClassPathXmlApplicationContext 载入多个配置文件问题
在/web-inf/classes/下有两个配置文件,分别是applicationContext-beans.xml,applicationContext-actions.xmlrn为什么用BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext-*.xml");载入的时候会出错啊 ?
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件