struts与spring整合问题 MyEclipse

求大神帮忙。
我在配置struts.xml文件的action如下:


/jsps/reg_member.jsp
toInput
listAction
/jsps/reg_member.jsp
/jsps/update_member.jsp

可以正常运行。
但是我在加入spring的bean之后进行修改:


........


/jsps/reg_member.jsp
toInput
listAction
/jsps/reg_member.jsp
/jsps/update_member.jsp

这样运行程序正常编译运行,但是我访问资源的时候出现action无法匹配到。
然后我检查console中:
defining beans [memberDao,memberService,memberAction,testAction,dataSource,sessionFactory,hibernateTemplate]; root of factory hierarchy

这些bean好像都正常的,所以想问问这个问题何解?

2个回答

好像?你把截图发出来看看呢

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
default-autowire="byName" default-lazy-init="true">

<bean id="memberDao" class="edu.fjnu.zkl.dao.implement.MemberDaoImpl">
    <property name="sessionFactory" ref="sessionFactory"></property> 
</bean>

<bean id="memberService" class="edu.fjnu.zkl.service.implement.MemberServiceImpl">
    <property name="memberDao">
        <ref local="memberDao" />
    </property>
</bean>
<!-- <bean id="memberService" parent="HibernateProxyTemplate"> <property 
    name="target"> <ref bean="memberServiceTarget"/> </property> </bean> -->

<bean id="memberAction" class="edu.fjnu.zkl.action.MemberAction"
    scope="prototype">
    <property name="memberService">
        <ref bean="memberService" />
    </property>
</bean>

<bean id="testAction" class="edu.fjnu.zkl.action.TestAction"></bean>

<?xml version="1.0" encoding="UTF-8" ?><!-- XML声明 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd"><!-- 指定Struts 2配置文件的DTD信息 -->

<!-- 根节点 -->
<!-- http://localhost:8081/hotelsys/test/demo.do 1. StrutsPrepareAndExecuteFilter根据struts.xml配置文件的信息,确定凡是*.do结尾的请求,均归struts处理。
2. 一旦发现.do结尾请求出现,直接拦截,做以下操作: a. http://localhost:8081/hotelsys/test/demo
(去除识别标志) b. /test/demo (获得真正访问资源地址信息) c. /test获得目录,去匹配对应的包的namespace d. demo
获得action的名字,去对应包中查找,如果找到,则创建该action的实例,调用其execute方法一次。 -->


<!-- 设置为开发模式,系统运行速度将降低,但是提供的出错提示更加直观,一般用于系统调试的时候使用 -->

<!--所有以*.do结尾的请求全部归struts处理 ,如果没有显式指定action识别后缀,默认就是action, 比如toInput.action -->
<!-- struts2将自动帮程序员生成网页,提供了多种生成模版 -->

<!-- spring支持包 --> 
<constant name="struts.objectFactory" value="spring" /> 
<!-- 指定以name的方式组合action和service的关系 -->  
<constant name="struts.objectFactory.spring.autoWire" value="name"></constant>

<!-- sms系统基础包 -->
<package name="systempkg" abstract="true" namespace="/"
    extends="struts-default">

    <interceptors>
        <interceptor name="authInterceptor"
            class="edu.fjnu.zkl.interceptor.AuthenIntercetpor" /> 
        <interceptor-stack name="user">
            <interceptor-ref name="authInterceptor" />
            <interceptor-ref name="defaultStack" />
        </interceptor-stack>

        <interceptor-stack name="guess">
            <interceptor-ref name="defaultStack" />
        </interceptor-stack>

    </interceptors>

    <default-interceptor-ref name="user" />

    <global-results>
        <result name="login_page">../jsps/login.jsp</result>
    </global-results>

    <global-allowed-methods>regex:.*</global-allowed-methods>

</package>

<package name="member_pkg" namespace="/student" extends="systempkg">
    <action name="*" class="memberAction" method="{1}">
        <result name="input">/jsps/reg_member.jsp</result>
        <result name="toInputAction" type="redirectAction">toInput</result>
        <result name="listAction" type="redirectAction">listAction </result>
        <result name="list">/jsps/reg_member.jsp</result>
        <result name="update">/jsps/update_member.jsp</result>
    </action>
</package> 
<include file="struts-test.xml" />

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
myeclipse 中struts和spring整合问题
求大神帮忙 我在配置struts.xml文件的action如下: ``` <action name="*" class="edu.fjnu.zkl.action.MemberAction" method="{1}"> <result name="input">/jsps/reg_member.jsp</result> <result name="toInputAction" type="redirectAction">toInput</result> <result name="listAction" type="redirectAction">listAction </result> <result name="list">/jsps/reg_member.jsp</result> <result name="update">/jsps/update_member.jsp</result> </action> ``` 可以正常运行。 但是我在加入spring的bean之后进行修改: ``` <constant name="struts.objectFactory" value="spring" /> <constant name="struts.objectFactory.spring.autoWire" value="name"></constant> ........ <action name="*" class="memberAction" method="{1}"> <result name="input">/jsps/reg_member.jsp</result> <result name="toInputAction" type="redirectAction">toInput</result> <result name="listAction" type="redirectAction">listAction </result> <result name="list">/jsps/reg_member.jsp</result> <result name="update">/jsps/update_member.jsp</result> </action> ``` 这样运行程序正常编译运行,但是我访问资源的时候出现action无法匹配到。 然后我检查console中: ``` defining beans [memberDao,memberService,memberAction,testAction,dataSource,sessionFactory,hibernateTemplate]; root of factory hierarchy ``` 这些bean好像都正常的,所以想问问这个问题何解?
struts整合spring,请教大神们
在myeclipse中已经导入了自带的struts框架,怎么把struts整合到spring中,也就是action交给spring管理
struts2集成spring产生的问题
是了在用strut2集成spring,便是产生了一个问题,在网上找了一下也没找到解决方案,请大家看一下,帮忙解决一下: struts2的版本是:2.1.6, 集成spring的时候用的是struts2-spring-plugin-2.1.6.jar 开发IDE是用的MyEclipse6.0.1, 服务器版本是Tomcat 6.0 然后集成之后,我是想用sping来对struts2的Action进行管理. web.xml的内容如下: ------------------------------------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext.xml,classpath:applicationContext-*.xml </param-value> </context-param> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.jspa</url-pattern> </filter-mapping> <servlet> <servlet-name>velocity</servlet-name> <servlet-class> org.apache.velocity.tools.view.servlet.VelocityViewServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>velocity</servlet-name> <url-pattern>*.vm</url-pattern> </servlet-mapping> <servlet> <servlet-name>dwr</servlet-name> <servlet-class> org.directwebremoting.servlet.DwrServlet </servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dwr</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping> </web-app> ------------------------------------------------------------------------------------------ struts.xml内容如下: ------------------------------------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <!-- 配置国际化信息 --> <constant name="struts.custom.i18n.resources" value="messages" /> <!-- 设置使用的解码集 --> <constant name="struts.i18n.encoding" value="utf-8" /> <package name="pages" namespace="/pages" extends="struts-default"> <action name="display" class="DisplayAction"> <result type="velocity">welcome.vm</result> <result name="showchart" type="velocity">sdv.vm</result> <result name="JSONTree" type="velocity">treedat.vm</result> </action> <action name="treedemo" class="TreedemoAction"> <result type="velocity">treedemo.vm</result> <result name="treeJSON" type="velocity">treedat.vm</result> </action> <action name="inquire" class="DWRInquireProcess"> <result type="velocity">inquiredData.vm</result> </action> </package> </struts> ------------------------------------------------------------------------------------------ struts.properties的内容如下: ------------------------------------------------------------------------------------------ struts.action.extension = jspa struts.objectFactory = spring struts.objectFactory.spring.autoWire = name #for develop reason, we don't want the client browser cache the static content struts.serve.static.browserCache = false #we hope the server auto load the struts.xml file, when it is changed struts.configuration.xml.reload = true ------------------------------------------------------------------------------------------ spring的配置文件applicationContext.xml的内容如下: ------------------------------------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="DisplayAction" class="com.intel.sdv2.action.DisplayPage"> </bean> <bean id="TreedemoAction" class="com.intel.sdv2.action.TreeDemo"></bean> <bean id="DWRInquireProcess" class="com.intel.sdv2.action.DWRFormProcess"> </bean> </beans> ------------------------------------------------------------------------------------------ 项目中用的jar包如下: ------------------------------------------------------------------------------------------ commons-logging-1.1.jar freemarker-2.3.13.jar ognl-2.6.11.jar struts2-core-2.1.6.jar xwork-2.1.2.jar commons-digester-1.8.jar commons-io-1.3.2.jar commons-fileupload-1.2.1.jar json-lib-2.1.jar velocity-1.5.jar velocity-tools-1.4.jar commons-collections-3.2.jar commons-lang-2.2.jar dwr.jar struts2-spring-plugin-2.1.6.jar ------------------------------------------------------------------------------------------ 启动Tomcat时报的错如下: ------------------------------------------------------------------------------------------ 2009-7-29 15:33:14 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info 信息: ... initialized Struts-Spring integration successfully 2009-7-29 15:33:14 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 java.lang.NullPointerException at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209) at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325) at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168) at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61) at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:191) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2009-7-29 15:33:14 org.apache.catalina.core.StandardContext start 严重: Error filterStart 2009-7-29 15:33:14 org.apache.catalina.core.StandardContext start 严重: Context [/SDVWeb2] startup failed due to previous errors 2009-7-29 15:33:14 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext ------------------------------------------------------------------------------------------ 在没用集成Spring之间,一切运行都正常,当我把spring集成进去后,就报这样的错误了。弄不明白是什么原因?请大家看一下,有什么解决方法,谢谢!!!
struts2整合spring struts.xml中的action的class 总说找不到
struts2版本 2.0.14 spring版本 2.5 tomcat 版本6.0.14 IDE:myeclipse6.0 struts2与spring整合中 出现问题 LoginAction.java [code="java"] public class LoginAction extends ActionSupport { private String username; private String password; private LoginService loginService; public LoginService getLoginService() { return loginService; } public void setLoginService(LoginService loginService) { this.loginService = loginService; } public String execute()throws Exception { if (this.getLoginService().isLogin(username,password)) { return "success"; } return "input"; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } [/code] loginServiceImpl [code="java"] public class LoginServiceImpl implements LoginService { public boolean isLogin(String username,String password) { if ("admin".equals(username)&&"123".equals(password)) { return true; } return false; } } [/code] applicationContext.xml [code="java"] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="loginService" class="com.intelsrc.service.impl.LoginServiceImpl"> </bean> <bean id="loginAction" class="com.intelsrc.action.LoginAction" scope="prototype"> <property name="loginService"> <ref bean="loginService" /> </property> </bean> </beans> [/code] struts.xml [code="java"] <struts> <constant name="struts.objectFactory" value="spring" /> <!-- <constant name="struts.objectFactory.spring.autoWire" value="name"/>--> <package name="struts2demo1" extends="struts-default"> <action name="login" class="loginAction"> <result name="failure">/error.jsp</result> <result name="success">/result.jsp</result> <result name="input">/login.jsp</result> </action> </package> </struts> [/code] web.xml [code="java"] <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext*.xml,classpath*:applicationContext-*.xml</param-value> </context-param> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> [/code] jar包 [img]http://dl.iteye.com/upload/attachment/316595/963d104e-df0d-32a7-991c-671253f15dc0.jpg[/img] 运行后出现如下错误信息 [img]http://dl.iteye.com/upload/attachment/316608/0f1bea96-6583-3426-a3b2-a05aecad6bf4.jpg[/img] 大家帮忙看看是什么问题?
求大神教我ssh整合的完整过程,快要被这个问题折磨疯了!
最近在做一个项目,语言用ssh开发,但是ssh环境一直配置不好,已经很久了,struts和spring整合没有问题,hibernate和spring整合也没有问题,就是ssh整合的时候,就出错!你们能教我一下ssh怎么部署,用myeclipse8.5![图片](https://img-ask.csdn.net/upload/201603/15/1457972508_747123.png)
struts2+spring2.5+hibernate整合的问题
<p>ssh整合的时候不报错,但插入的时候数据库也没有数据,控制台把insert语句已经打出来了,这是什么情况,请大侠们帮忙看看 <br><br><br>applicationContext.xml 配置如下:</p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans xmlns="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a>"<br>xmlns:context="<a href="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a>"<br>xmlns:tx="<a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a>"<br>xmlns:aop="<a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br> xsi:schemaLocation="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a><br><a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</a><br><a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a><br><a href="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">http://www.springframework.org/schema/tx/spring-tx-2.5.xsd</a><br><a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a><br><a href="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</a><br><a href="http://www.springframework.org/schema/context">http://www.springframework.org/schema/context</a><br><a href="http://www.springframework.org/schema/context/spring-context-2.5.xsd">http://www.springframework.org/schema/context/spring-context-2.5.xsd</a><br>" default-autowire="byName" default-lazy-init="true"&gt;</p> <p> &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;<br>  &lt;property name="locations"&gt;<br>   &lt;list&gt;<br>    &lt;value&gt;classpath*:jdbc.properties&lt;/value&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;<br>  &lt;property name="driverClassName" value="${jdbc.driver}"/&gt;<br>  &lt;property name="url" value="${jdbc.url}"/&gt;<br>  &lt;property name="username" value="${jdbc.username}"/&gt;<br>  &lt;property name="password" value="${jdbc.password}"&gt;&lt;/property&gt;<br>  <br>  &lt;property name="initialSize" value="5" /&gt;<br>  &lt;property name="maxActive" value="100" /&gt;<br>  &lt;property name="maxIdle" value="30" /&gt;<br>  &lt;property name="maxWait" value="500" /&gt;<br>  &lt;property name="poolPreparedStatements" value="false" /&gt;<br>  &lt;property name="defaultAutoCommit" value="false" /&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;<br>     &lt;property name="dataSource" ref="dataSource"/&gt;<br>     &lt;property name="mappingResources"&gt;<br>       &lt;list&gt;<br>         &lt;value&gt;com/demo/mapping/demo.hbm.xml&lt;/value&gt;<br>       &lt;/list&gt;<br>     &lt;/property&gt;<br>  &lt;property name="hibernateProperties"&gt;<br>   &lt;props&gt;<br>    &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/prop&gt;<br>       &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;<br>   &lt;/props&gt;<br>  &lt;/property&gt;<br>  <br> &lt;/bean&gt;<br> <br> &lt;bean id="dDao" class="com.demo.dao.Impl.demoDaoImpl"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="dService" class="com.demo.service.Impl.demoServiceImpl"&gt;<br>  &lt;property name="dDao" ref="dDao"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean id="txManage" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;  <br>     &lt;property name="sessionFactory" ref="sessionFactory"/&gt;  <br> &lt;/bean&gt;  </p> <p>&lt;/beans&gt;</p> <p> </p> <p>struts.xml 如下:</p> <p> </p> <p>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br>&lt;!DOCTYPE struts PUBLIC<br>    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"<br>    "<a href="http://struts.apache.org/dtds/struts-2.1.7.dtd">http://struts.apache.org/dtds/struts-2.1.7.dtd</a>"&gt;<br>&lt;struts&gt;<br> &lt;package name="demo" namespace="/demo" extends="struts-default"&gt;<br>  &lt;action name="demo" class="com.demo.action.RegisterAction"&gt;<br>   &lt;result name="index"&gt;/demo/demo-index.jsp&lt;/result&gt;<br>   &lt;result name="add"&gt;/demo/demo-add.jsp&lt;/result&gt;<br>   &lt;result name="operate"&gt;/demo/demo-add.jsp&lt;/result&gt;<br>   &lt;result name="save" type="redirectAction"&gt;demo!index.action&lt;/result&gt;<br>   &lt;result name="update" type="redirectAction"&gt;demo!index.action&lt;/result&gt;<br>   &lt;result name="delete" type="redirectAction"&gt;demo!index.action&lt;/result&gt;<br>  &lt;/action&gt;<br> &lt;/package&gt;<br>&lt;/struts&gt;</p> <p> </p> <p>jdbc.properties  如下:</p> <p> </p> <p>jdbc.driver=oracle.jdbc.driver.OracleDriver<br>jdbc.url=jdbc:oracle:thin:@192.168.6.90:1521:orcl<br>jdbc.username=example<br>jdbc.password=123456<br>hibernate.dialect=org.hibernate.dialect.Oracle10gDialect</p> <p> </p> <p>web.xml   如下:</p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;web-app version="2.5" xmlns="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br> xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <br> <a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>"&gt;<br> <br>    &lt;context-param&gt;<br>   &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;<br>   &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt;<br>    &lt;/context-param&gt;<br>  &lt;listener&gt;<br>      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;<br>     &lt;/listener&gt;<br>  &lt;filter&gt;<br>   &lt;filter-name&gt;struts2Filter&lt;/filter-name&gt;<br>   &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;<br>  &lt;/filter&gt;<br>  &lt;filter-mapping&gt;<br>   &lt;filter-name&gt;struts2Filter&lt;/filter-name&gt;<br>   &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br>  &lt;/filter-mapping&gt;<br>&lt;/web-app&gt;<br> </p> <p>dao  接口如下:</p> <p>package com.demo.dao;</p> <p>import java.io.Serializable;<br>import java.util.List;</p> <p>import com.demo.model.Demo;</p> <p>public interface demoDao {<br> <br> public void save(Demo demo);</p> <p> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params);<br> <br> public List&lt;Demo&gt; getDemos();<br> <br> public void delete(Demo demo);<br> <br> public abstract &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; class1, Serializable serializable);<br> <br> public void update(Demo demo);<br>}</p> <p>dao的实现:</p> <p>package com.demo.dao.Impl;</p> <p>import java.io.Serializable;<br>import java.sql.SQLException;<br>import java.util.ArrayList;<br>import java.util.List;</p> <p>import org.hibernate.HibernateException;<br>import org.hibernate.Query;<br>import org.hibernate.Session;<br>import org.springframework.orm.hibernate3.HibernateCallback;<br>import org.springframework.orm.hibernate3.HibernateTemplate;<br>import org.springframework.orm.hibernate3.support.HibernateDaoSupport;<br>import org.springframework.transaction.annotation.Transactional;</p> <p>import com.demo.dao.demoDao;<br>import com.demo.model.Demo;</p> <p>public class demoDaoImpl  extends HibernateDaoSupport implements demoDao{</p> <p> @Transactional<br> public void save(Demo demo) {<br>  this.getHibernateTemplate().save(demo);<br> }</p> <p> @SuppressWarnings("unchecked")<br> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params) {<br>  List&lt;Demo&gt; demos=new ArrayList&lt;Demo&gt;();<br>  demos=this.getHibernateTemplate().executeFind(new HibernateCallback() {<br>     public Object doInHibernate(Session session) throws HibernateException,SQLException {<br>      Query query=session.createQuery(strHql);<br>      for(int i=0;params!=null&amp;&amp;i&lt;params.length;i++){<br>       query.setString(i,params[i].toString());<br>      }<br>      return query.list();<br>   }<br>  });<br>  return demos;<br> }</p> <p> public void delete(Demo demo) {<br>  this.getHibernateTemplate().delete(demo);<br> }</p> <p>  @SuppressWarnings("unchecked")<br>  public &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; clazz, Serializable key) {<br>         T obj = (T) getSession().get(clazz, key);<br>         return obj;<br>     }</p> <p> public void update(Demo demo) {<br>  this.getHibernateTemplate().update(demo);<br> }</p> <p>  @SuppressWarnings("unchecked")<br> public List&lt;Demo&gt; getDemos() {<br>  return this.getHibernateTemplate().find("from Demo where 1=1");<br> }</p> <p> <br>}</p> <p>service接口:</p> <p>package com.demo.service;</p> <p>import java.io.Serializable;<br>import java.util.List;</p> <p>import com.demo.model.Demo;</p> <p>public interface demoService {<br> <br> public void save(Demo demo);<br> <br> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params);<br> <br> public List&lt;Demo&gt; getDemos();<br> <br> public void delete(Demo demo);<br> <br> public &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; class1, Serializable serializable);<br> <br> public String createHql(Demo demo);<br> <br> public void update(Demo demo);<br>}</p> <p>service 的实现:</p> <p>package com.demo.service.Impl;</p> <p>import java.io.Serializable;<br>import java.util.List;</p> <p>import org.springframework.transaction.annotation.Transactional;</p> <p>import com.demo.dao.demoDao;<br>import com.demo.model.Demo;<br>import com.demo.service.demoService;</p> <p>public class demoServiceImpl implements demoService{</p> <p> private demoDao dDao;</p> <p> public demoDao getdDao() {<br>  return dDao;<br> }</p> <p> public void setdDao(demoDao dDao) {<br>  this.dDao = dDao;<br> }</p> <p> public void save(Demo demo) {<br>  dDao.save(demo);<br> }</p> <p> public List&lt;Demo&gt; getDemos(final String strHql,final Object...params) {<br>  return dDao.getDemos(strHql, params);<br> }</p> <p> public void delete(Demo demo) {<br>  dDao.delete(demo);<br> }</p> <p> @Override<br> public String createHql(Demo demo) {<br>  StringBuffer buf=new StringBuffer();<br>  buf.append("from Demo d where 1=1");<br>  if(demo!=null){<br>   buf.append("and d.name like '%"+demo.getName()+"%'");<br>  }<br>  return buf.toString();<br> }</p> <p> @Override<br> public &lt;T&gt; T findByPrimaryKey(Class&lt;T&gt; class1, Serializable serializable) {<br>  return dDao.findByPrimaryKey(class1, serializable);<br> }</p> <p> @Override<br> public void update(Demo demo) {<br>  dDao.update(demo);<br> }</p> <p> @Override<br> public List&lt;Demo&gt; getDemos() {<br>  return dDao.getDemos();<br> }<br>}<br><br>action 如下:</p> <p> </p> <p>package com.demo.action;</p> <p><br>import java.util.List;</p> <p>import com.demo.model.Demo;<br>import com.demo.service.demoService;</p> <p>public class RegisterAction {</p> <p> private Demo demo;<br> private demoService dService;<br> private List&lt;Demo&gt; demos;<br> <br> public Demo getDemo() {<br>  return demo;<br> }<br> public void setDemo(Demo demo) {<br>  this.demo = demo;<br> }<br> public demoService getdService() {<br>  return dService;<br> }<br> public void setdService(demoService dService) {<br>  this.dService = dService;<br> }<br> public List&lt;Demo&gt; getDemos() {<br>  return demos;<br> }</p> <p> public void setDemos(List&lt;Demo&gt; demos) {<br>  this.demos = demos;<br> }<br> <br> public String execute(){<br>  return "index";<br> }</p> <p> public String index(){<br>  //demos=dService.getDemos(dService.createHql(demo),null);<br>  demos=dService.getDemos();<br>  return "index";<br> }<br> public String add(){<br>  return "add";<br> }<br> public String operate(){<br>  demo=dService.findByPrimaryKey(Demo.class,demo.getId());<br>  return "operate";<br> }<br> public String save(){<br>  dService.save(demo);<br>  return "save";<br> }<br> public String delete(){<br>  demo=dService.findByPrimaryKey(Demo.class,demo.getId());<br>  dService.delete(demo);<br>  return "delete";<br> }<br> public String update(){<br>  demo=dService.findByPrimaryKey(Demo.class,demo.getId());<br>  demo.setName(demo.getName());<br>  demo.setAge(demo.getAge());<br>  demo.setAddress(demo.getAddress());<br>  dService.update(demo);<br>  return "update";<br> }<br>}</p> <p> 实体:</p> <p>package com.demo.model;</p> <p>public class Demo {</p> <p> private Long id;<br> private String name;<br> private Integer age;<br> private String address;<br> <br> public Long getId() {<br>  return id;<br> }<br> public void setId(Long id) {<br>  this.id = id;<br> }<br> public String getName() {<br>  return name;<br> }<br> public void setName(String name) {<br>  this.name = name;<br> }<br> public Integer getAge() {<br>  return age;<br> }<br> public void setAge(Integer age) {<br>  this.age = age;<br> }<br> public String getAddress() {<br>  return address;<br> }<br> public void setAddress(String address) {<br>  this.address = address;<br> }<br>}</p> <p>映射文件:demo.hbm.xml</p> <p>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br>&lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"<br>"<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd</a>"&gt;<br>&lt;!-- <br>    Mapping file autogenerated by MyEclipse Persistence Tools<br>--&gt;<br>&lt;hibernate-mapping package="com.demo.model"&gt;<br>    &lt;class name="Demo" table="tb_demo" catalog="example"&gt;<br>        &lt;id name="id" type="java.lang.Long"&gt;<br>            &lt;column name="id" /&gt;<br>            &lt;generator class="sequence"&gt;<br>             &lt;param name="sequence"&gt;seq_demo&lt;/param&gt;<br>            &lt;/generator&gt;<br>        &lt;/id&gt;<br>        &lt;property name="name" type="java.lang.String"&gt;<br>            &lt;column name="tb_name" length="50" not-null="true" unique="true" /&gt;<br>        &lt;/property&gt;<br>        &lt;property name="age" type="java.lang.Integer"&gt;<br>            &lt;column name="tb_age" /&gt;<br>        &lt;/property&gt;<br>        &lt;property name="address" type="java.lang.String"&gt;<br>            &lt;column name="tb_address" length="50" not-null="true" /&gt;<br>        &lt;/property&gt;<br>    &lt;/class&gt;<br>&lt;/hibernate-mapping&gt;</p> <p> </p> <p>页面:</p> <p>demo-add.jsp  如下 :</p> <p>&lt;%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%&gt;<br>&lt;%@ taglib uri="/struts-tags" prefix="s"%&gt;<br>&lt;html&gt;<br> &lt;head&gt;<br>  &lt;title&gt;ssh整合测试&lt;/title&gt;<br>  &lt;script type="text/javascript" src="/SSH1/js/jquery.js"&gt;&lt;/script&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;form method="post" action="demo/demo.action"&gt;<br>  &lt;input type="hidden" id="num" name="demo.id" value="${demo.id}"/&gt;<br>   &lt;table&gt;<br>    &lt;tr&gt;ssh整合数据测试&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td align="right"&gt;姓名:&lt;/td&gt;&lt;td align="left"&gt;&lt;input type="text" name="demo.name" value="${demo.name}"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td align="right"&gt;年龄:&lt;/td&gt;&lt;td align="left"&gt;&lt;input type="text" name="demo.age" value="${demo.age}"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td align="right"&gt;家庭住址:&lt;/td&gt;&lt;td align="left"&gt;&lt;input type="text" name="demo.address" value="${demo.address}"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td colspan="2"&gt;&lt;input type="button" value="保存" id="save"/&gt;&lt;input type="reset" value="重置"/&gt;&lt;/td&gt;&lt;/tr&gt;<br>   &lt;/table&gt;<br>  &lt;/form&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;<br>&lt;script&gt;<br> $("document").ready(function (){<br>  $("#save").click(function(){<br>   if($("#num").val()==null||$("#num").val()==""){<br>    document.forms[0].action="/SSH1/demo/demo!save.action";<br>    document.forms[0].submit();<br>   }else{<br>    alert("eee");<br>    document.forms[0].action="/SSH1/demo/demo!update.action";<br>    document.forms[0].submit();<br>   }<br>  });<br> });<br>&lt;/script&gt;</p> <p> </p> <p>demo-index.jsp  如下:</p> <p>&lt;%@ page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%&gt;<br>&lt;%@ taglib uri="/struts-tags" prefix="s"%&gt;<br>&lt;html&gt;<br> &lt;head&gt;<br>  &lt;title&gt;ssh整合测试&lt;/title&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;form action="demo/demo.action"&gt;<br>   &lt;table&gt;<br>    &lt;tr&gt;&lt;td&gt;&lt;a href="&lt;%=request.getContextPath() %&gt;/demo/demo!add.action"&gt;添加&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;<br>    &lt;tr&gt;&lt;td&gt;序号&lt;/td&gt;&lt;td&gt;姓名&lt;/td&gt;&lt;td&gt;年龄&lt;/td&gt;&lt;td&gt;地址&lt;/td&gt;&lt;td&gt;操作&lt;/td&gt;&lt;/tr&gt;<br>    &lt;s:if test="demos.size()&gt;0"&gt;<br>     &lt;s:iterator value="demos" status="st"&gt;<br>      &lt;tr&gt;<br>       &lt;td&gt;${st.index+1}&lt;/td&gt;<br>       &lt;td&gt;${name}&lt;/td&gt;<br>       &lt;td&gt;${age}&lt;/td&gt;<br>       &lt;td&gt;${address}&lt;/td&gt;<br>       &lt;td&gt;&lt;a href="&lt;%=request.getContextPath() %&gt;/demo/demo!operate.action?demo.id=${id}"&gt;修改&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="&lt;%=request.getContextPath() %&gt;/demo/demo!operate.action?demo.id=${id}"&gt;删除&lt;/a&gt;&lt;/td&gt;<br>      &lt;/tr&gt;<br>     &lt;/s:iterator&gt;<br>    &lt;/s:if&gt;<br>   &lt;/table&gt;<br>  &lt;/form&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</p>
SSH整合问题 Struts2加载出错 用jUnit测试了spring和hibernate没问题
下面是异常信息 ``` 严重: Exception starting filter struts2 Unable to load configuration. - action - file:/E:/Workspaces/MyEclipse%208.6_JAVA31/.metadata/.me_tcat/webapps/MyDemo/WEB-INF/classes/struts.xml:13:50 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: Unable to load configuration. - action - file:/E:/Workspaces/MyEclipse%208.6_JAVA31/.metadata/.me_tcat/webapps/MyDemo/WEB-INF/classes/struts.xml:13:50 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) ... 29 more Caused by: Action class [adminAction] not found - action - file:/E:/Workspaces/MyEclipse%208.6_JAVA31/.metadata/.me_tcat/webapps/MyDemo/WEB-INF/classes/struts.xml:13:50 at com.opensy ```
小白求解,框架整合大神快来
myeclipse添加struts、spring、hibernate框架applicationContext配置文件里报这个错,求大神解答下。 The fully qualified name of the bean's class, except if it serves only as a parent definition for child bean definitions.
Spring hibernate 整合问题
2009-3-17 14:24:38 org.apache.catalina.core.AprLifecycleListener init 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jre1.6.0_04\bin;D:\Program Files\MyEclipse 6.0\eclipse\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_6.0.1.zmyeclipse601200710\tomcat\bin 2009-3-17 14:24:38 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2009-3-17 14:24:38 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 994 ms 2009-3-17 14:24:38 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-3-17 14:24:38 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.13 log4j:WARN No such property [conversionPattern] in org.apache.log4j.TTCCLayout. 2009-3-17 14:24:40 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 2009-03-17 14:24:40 [org.springframework.web.context.ContextLoader]-[INFO] Root WebApplicationContext: initialization started 2009-03-17 14:24:41 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1d0e2c9: display name [Root WebApplicationContext]; startup date [Tue Mar 17 14:24:41 CST 2009]; root of context hierarchy 2009-03-17 14:24:41 [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from URL [file:/E:/Test/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/supermarket/WEB-INF/classes/config/spring/applicationContext.xml] 2009-03-17 14:24:42 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1d0e2c9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5e7663 2009-03-17 14:24:42 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5e7663: defining beans [sessionFactorys,registerOperatorDAO,registerOperatorService,registerOperatorAction]; root of factory hierarchy 2009-03-17 14:24:42 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5e7663: defining beans [sessionFactorys,registerOperatorDAO,registerOperatorService,registerOperatorAction]; root of factory hierarchy 2009-03-17 14:24:42 [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactorys' defined in URL [file:/E:/Test/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/supermarket/WEB-INF/classes/config/spring/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) ... 40 more Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.class$(LocalSessionFactoryBean.java:174) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.java:174) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ... 42 more Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 51 more 2009-3-17 14:24:42 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactorys' defined in URL [file:/E:/Test/workspace/.metadata/.plugins/com.genuitec.eclipse.easie.tomcat.myeclipse/tomcat/webapps/supermarket/WEB-INF/classes/config/spring/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) ... 40 more Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.class$(LocalSessionFactoryBean.java:174) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.java:174) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ... 42 more Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 51 more 2009-3-17 14:24:42 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-3-17 14:24:42 org.apache.catalina.core.StandardContext start 严重: Context [/supermarket] startup failed due to previous errors 2009-3-17 14:24:42 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2009-3-17 14:24:43 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2009-3-17 14:24:43 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-3-17 14:24:43 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/47 config=null 2009-3-17 14:24:43 org.apache.catalina.startup.Catalina start 信息: Server startup in 4940 ms 配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" default-autowire="byName"> <bean name="sessionFactorys" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation" value="classpath:hibernate.cfg.xml"> </property> </bean> <bean name="registerOperatorDAO" class="org.xsd.supermarket.system.operator.operator.impl.OperatorDAOImpl"> <property name="sessionFactorys" ref="sessionFactorys"></property> </bean> <bean name="registerOperatorService" class="org.xsd.supermarket.system.operator.operator.impl.OperatorServicesImpl"> <property name="registerOperatorDAO" ref="registerOperatorDAO"></property> </bean> <bean name="registerOperatorAction" class="org.xsd.supermarket.system.operator.operator.OperatorAction"> <property name="registerOperatorService" ref="registerOperatorService"></property> </bean> </beans> 用到的JAR包如下: <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate/hibernate3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/spring/spring.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/commons-logging-1.0.4.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/freemarker-2.3.13.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/ognl-2.6.11.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/struts2-core-2.1.6.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/struts2-spring-plugin-2.1.6.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts/xwork-2.1.2.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/log4j-1.2.14.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/mysql-connector-java-5.0.5-bin.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/commons-beanutils.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/dom4j-1.6.1.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/jaxen-1.1-beta-7.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/cglib-nodep-2.1_3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/asm-2.2.3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/asm-commons-2.2.3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/asm-util-2.2.3.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/jta.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/tools/aspectjweaver.jar"/>
Spring安装和搭配
新手就问1+1的问题 我myeclipse 是6.0的 它自带了struts 1.*;spring 2.0;hibernate 3.1 我要怎么才可以用上新版本的? 还有是三者整合的时候应该怎么搭配,我看到有的搭配<aop:*></aop:*> 而有的搭配没有<aop>这样的开始,小弟不太明白,请帮忙解决一下! [b]问题补充:[/b] 我知道要下包!下下来后怎么用? [b]问题补充:[/b] 大哥说明白一点行吗?我不懂,myeclipse 下有class包吗? [b]问题补充:[/b] 哪么 struts-config.xml 这个文件怎么生成?用自带的,它会自动生成
ejb中spring代理struts,action请求找不到,can not instance for path
我在tomcat上struts集成spring没有问题, <br />但在ejb中,用jboss出现:HTTP Status 500 - No action instance for path /login could be created <br />strus配置 <br />&lt;!--用户登陆 --&gt; <br />&lt;action <br /> path="/login" <br /> name="loginForm" <br /> scope="request" <br /> type="login" <br /> &gt; <br /> &lt;forward name="main" path="/main.jsp"&gt;&lt;/forward&gt; <br /> &lt;/action&gt; <br /> <br />&lt;!--spring管理struts --&gt; <br /> &lt;controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"&gt; <br />&nbsp; &lt;/controller&gt; <br /> <br /> <br />spring配置文件: <br /> &lt;bean id="login" name="/login" class="com.shipping.web.actions.LoginAction" scope="prototype"/&gt; <br /> <br />用ant部署到jobss没有问题,数据库表正常加载,在myeclipse中测试数据也正常,但是登陆时调用login.do后台出现: <br />11:33:51,500 INFO&nbsp; [STDOUT] 11:33:51,484 ERROR [RequestProcessor] No action instance for path /login could be created <br />java.lang.ClassNotFoundException: login <br /> at java.net.URLClassLoader$1.run(URLClassLoader.java:200) <br /> at java.security.AccessController.doPrivileged(Native Method) <br /> at java.net.URLClassLoader.findClass(URLClassLoader.java:188) <br /> at java.lang.ClassLoader.loadClass(ClassLoader.java:306) <br /> at java.lang.ClassLoader.loadClass(ClassLoader.java:251) <br /> at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:117) <br /> at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143) <br /> at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:292) <br /> at org.springframework.web.struts.DelegatingRequestProcessor.processActionCreate(DelegatingRequestProcessor.java:150) <br /> at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:230) <br /> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) <br /> at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) <br /> at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) <br /> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) <br /> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) <br /> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) <br /> at com.bjsxt.ccs.web.CcsFilter.doFilter(CcsFilter.java:37) <br /> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) <br /> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) <br /> at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) <br /> at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) <br /> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) <br /> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) <br /> at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78) <br /> at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) <br /> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) <br /> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) <br /> at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) <br /> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) <br /> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) <br /> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) <br /> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) <br /> at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) <br /> at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) <br /> at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) <br /> at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) <br /> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) <br /> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) <br /> at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) <br /> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) <br /> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) <br /> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) <br /> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) <br /> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) <br /> at java.lang.Thread.run(Thread.java:619) <br /> <br />找了半天 也没有 找到原因,不知道那位知道,给我点名一下,我将非常感激! <br /> <br /><br /><strong>问题补充:</strong><br />1.在ejb中,把com.shipping.web.actions.LoginAction的类编译后在classes下面,若是把struts的type改成com.shipping.web.actions.LoginAction就能找到路径, <br />而用spring代理时,打包部署到jboss服务器上, type就无法找到,真是郁闷,我jdk是1.6,jboss5.1, struts和spring的jar包也没有少,在tomcat都可以,试过了 <br />2.凡是用spring代理的type都出现 No action instance for path /login could be created ,输入 <br />/login.do 一样找不到的
使用MyEclipse集成SpringMVC+Hibernate运行的时候提示这个错误是为什么啊?
严重: Exception starting filter struts2 Unable to load configuration. - bean - jar:file:/D:/MyEcWorkSpa2015/.metadata/.me_tcat7/webapps/TestSSH/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4830) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5510) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1897) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: Unable to load configuration. - bean - jar:file:/D:/MyEcWorkSpa2015/.metadata/.me_tcat7/webapps/TestSSH/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418) ... 18 more Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/MyEcWorkSpa2015/.metadata/.me_tcat7/webapps/TestSSH/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) ... 20 more Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/MyEcWorkSpa2015/.metadata/.me_tcat7/webapps/TestSSH/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72 - bean - jar:file:/D:/MyEcWorkSpa2015/.metadata/.me_tcat7/webapps/TestSSH/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216) ... 23 more
shh框架整合问题 请教~~~~
我使用的是 hibernate3.1 spring2.0 struts1.2 项目启动tomcat就报错 严重: action: null org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/dlpater/hrms/web/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: class "org.apache.commons.collections.SequencedHashMap"'s signer information does not match signer information of other classes in the same package Caused by: java.lang.SecurityException: class "org.apache.commons.collections.SequencedHashMap"'s signer information does not match signer information of other classes in the same package [b]问题补充:[/b] 我在网上查过 大致也是说这个包的问题 需要重新下载一个 commons-collections.jar包 但是不能不能重新发布 重新发布后 还是会出现同样的问题 那这就不方便了 我总不能每测试一次 就把那包 替换一次吧,有没有什么更彻底点的解决方法呢 我用的 myeclipse6.0 谢谢jinhanjiang的回答 [b]问题补充:[/b] 谢谢totong的解答
ssh框架在整合中出现了问题,求指导。
2015-8-14 15:02:47 org.apache.catalina.core.AprLifecycleListener init 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Users\ThinkPad\AppData\Local\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\bin;D:\Users\ThinkPad\AppData\Local\MyEclipse\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201211011550\tomcat\bin 2015-8-14 15:02:47 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2015-8-14 15:02:47 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 889 ms 2015-8-14 15:02:47 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2015-8-14 15:02:47 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.13 2015-8-14 15:02:49 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2015-8-14 15:02:54 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.enableAopSupport'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext,java.lang.String,com.opensymphony.xwork2.inject.Container). - Class: com.opensymphony.xwork2.inject.ContainerBuilder$4 File: ContainerBuilder.java Method: create Line: 132 - com/opensymphony/xwork2/inject/ContainerBuilder.java:132:-1 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.enableAopSupport'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext,java.lang.String,com.opensymphony.xwork2.inject.Container). at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132) at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507) at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:517) at com.opensymphony.xwork2.inject.ContainerImpl$9.call(ContainerImpl.java:548) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574) at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:546) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:197) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415) ... 29 more Caused by: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.enableAopSupport'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext,java.lang.String,com.opensymphony.xwork2.inject.Container). at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:495) at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:532) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:581) at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:530) at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32) at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130) ... 39 more Caused by: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.enableAopSupport'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext,java.lang.String,com.opensymphony.xwork2.inject.Container). at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.<init>(ContainerImpl.java:345) at com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java:305) at com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java:301) at com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:150) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:76) at com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:116) at com.opensymphony.xwork2.inject.ContainerImpl.getConstructor(ContainerImpl.java:594) at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:491) ... 44 more Caused by: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.enableAopSupport'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext,java.lang.String,com.opensymphony.xwork2.inject.Container). at com.opensymphony.xwork2.inject.ContainerImpl.createParameterInjector(ContainerImpl.java:235) at com.opensymphony.xwork2.inject.ContainerImpl.getParametersInjectors(ContainerImpl.java:225) at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.constructParameterInjector(ContainerImpl.java:353) at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.<init>(ContainerImpl.java:337) ... 53 more 2015-8-14 15:02:54 org.apache.catalina.core.StandardContext start 严重: Error filterStart 2015-8-14 15:02:54 org.apache.catalina.core.StandardContext start 严重: Context [/xiangmu] startup failed due to previous errors 2015-8-14 15:02:54 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. 2015-8-14 15:02:55 com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit> 警告: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path 2015-8-14 15:02:55 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2015-8-14 15:02:55 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2015-8-14 15:02:55 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/50 config=null 2015-8-14 15:02:55 org.apache.catalina.startup.Catalina start 信息: Server startup in 8493 ms
SSH整合问题 NullPointerException
SSH整合的一个小例子,struts2+Spring2+Hibernate3 代码如下: Person.java [code="java"] package com.eva.po; /** * Person entity. * * @author eva */ import java.io.Serializable; public class Person implements Serializable{ private int id; private String name; private int age; private String sex; private String address; /** defult constructor */ public Person() { } /** minimal constructor */ public Person(String name) { this.name = name; } /** full constructor */ public Person(String name,int age,String sex,String address) { this.name = name; this.age = age; this.sex = sex; this.address = address; } //setter and getter } [/code] PersonDAO.java [code="java"] package com.eva.dao; import java.util.List; import com.eva.po.Person; public interface PersonDAO { public void saveOrUpdate(Person person); public void update(Person person); public void delete(Person person); public Person get(String id); public List<Person> findAll(); } [/code] PersonHibernateDAO.java [code="java"] package com.eva.dao.hibernate; import java.util.List; import com.eva.dao.PersonDAO; import com.eva.po.Person; import org.hibernate.SessionFactory; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class PersonHibernateDAO extends HibernateDaoSupport implements PersonDAO { public void delete(Person person) { this.getHibernateTemplate().delete(person); } public List<Person> findAll() { List<Person> persons = this.getHibernateTemplate().find("from Person"); return persons; } public Person get(String id) { Person person = (Person)this.getHibernateTemplate().get(Person.class, id); return person; } public void saveOrUpdate(Person person) { this.getHibernateTemplate().saveOrUpdate(person); } public void update(Person person) { this.getHibernateTemplate().saveOrUpdate(person); } } [/code] PersonService.java [code="java"] package com.eva.service; import java.util.List; import com.eva.dao.hibernate.PersonHibernateDAO; import com.eva.po.Person; public class PersonService { private PersonHibernateDAO personHibernateDAO; public void setPersonHibernateDAO(PersonHibernateDAO personHibernateDAO) { this.personHibernateDAO = personHibernateDAO; System.out.println("personHibernateDAO is null ? --- " + personHibernateDAO == null); } public PersonHibernateDAO getPersonHibernateDAO() { return personHibernateDAO; } public void saveOrUpdate(Person person) { personHibernateDAO.saveOrUpdate(person); } public void update(Person person) { personHibernateDAO.update(person); } public void delete(Person person) { personHibernateDAO.delete(person); } public List<Person> findAll() { return personHibernateDAO.findAll(); } public Person get(String id) { return personHibernateDAO.get(id); } } [/code] LoginAction.java [code="java"] package com.eva.action; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; import com.eva.po.Person; import com.eva.service.PersonService; import com.opensymphony.xwork2.ActionSupport; public class LoginAction extends ActionSupport { private PersonService personService; private Person person; private String id; private List<Person> persons; public LoginAction() { } public Person getPerson() { return person; } public void setPerson(Person person) { this.person = person; } public String getId() { return id; } public void setId(String id) { this.id = id; } public PersonService getPersonService() { return personService; } public void setPersonService(PersonService personService) { this.personService = personService; } public List<Person> getPersons() { return persons; } public void setPersons(List<Person> persons) { this.persons = persons; } public String execute() throws Exception { if (person != null & !person.equals("")) { personService.saveOrUpdate(person); } persons = personService.findAll(); setPersons(persons); System.out.println(persons.size()); return SUCCESS; } public String list() throws Exception { persons = personService.findAll(); setPersons(persons); return SUCCESS; } public String save() throws Exception {; personService.saveOrUpdate(person); return SUCCESS; } public String update() throws Exception { person = personService.get(id); personService.update(person); return SUCCESS; } public String getValue() throws Exception { return SUCCESS; } public String delete() throws Exception{ person = personService.get(id); personService.delete(person); return SUCCESS; } } [/code] applicationContext.xml [code="java"] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <!-- dataSource配置 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> </property> <property name="url"> <value> jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ssh </value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value>sa</value> </property> </bean> <!-- 配置session工厂 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> </props> </property> <property name="mappingResources"> <list> <value>com/eva/po/Person.hbm.xml</value></list> </property> </bean> <!-- 具体的数据库访问类 --> <bean id="dao" class="com.eva.dao.hibernate.PersonHibernateDAO"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- 配置具体的业务逻辑类 --> <bean id="personService" class="com.eva.service.PersonService"> <property name="personHibernateDAO"> <ref bean="dao"/> </property> </bean> <!-- 配置action --> <bean id="loginAction" class="com.eva.action.LoginAction"> <property name="personService"> <ref bean="personService"/> </property> </bean> </beans> [/code] struts.xml [code="java"] <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.i18n.encoding" value="UTF-8" /> <!-- 一定要加,对象工厂是spring --> <constant name="struts.objectFactory" value="spring" /> <!-- 开启开发模式 --> <constant name="struts.devMode" value="true" /> <package name="login" extends="struts-default"> <!-- 保存 --> <action name="Login" method="save" class="com.eva.action.LoginAction"> <result>success.jsp</result> <!-- <result name="error">error.jsp</result> --> </action> <!-- 显示出所有列表 --> <action name="list" method="list" class="com.eva.action.LoginAction"> <result>success.jsp</result> </action> <!-- 删除 --> <action name="delete" method="delete" class="com.eva.action.LoginAction"> <result>success.jsp</result> </action> <!-- 更新 --> <action name="update" method="update" class="com.eva.action.LoginAction"> <result>index.jsp</result> </action> </package> </struts> [/code] Person.hbm.xml [code="java"] <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Mapping file autogenerated by MyEclipse Persistence Tools --> <hibernate-mapping> <class name="org.s2s2h3.po.Person" table="person_" catalog="ssh2"> <id name="id" type="java.lang.String"> <column name="id" length="10" /> <generator class="assigned" /> </id> <property name="name" type="java.lang.String"> <column name="name" length="30" not-null="true" /> </property> <property name="age" type="java.lang.String"> <column name="age" length="10" /> </property> <property name="sex" type="java.lang.String"> <column name="sex" length="10" /> </property> <property name="address" type="java.lang.String"> <column name="address" length="50" /> </property> </class> </hibernate-mapping> [/code] web.xml [code="java"] <?xml version="1.0" encoding="UTF-8"?> <web-app id="person" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>person</display-name> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> <init-param> <param-name>classes</param-name> <param-value>java.lang.Object</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext*.xml</param-value> </context-param> <!-- 添加监听器 --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> </web-app> [/code] index.jsp [code="java"] <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <s:if test="null == person"> Add Person </s:if> <s:else> Update Person </s:else> <s:form action="Login" method="post"> <table> <caption> 客户管理 </caption> <tr> <td> <s:textfield name="person.id" label="ID" /> </td> </tr> <tr> <td> <s:textfield name="person.name" label="NAME" /> </td> </tr> <tr> <td> <s:textfield name="person.age" label="AGE" /> </td> </tr> <tr> <td> <s:textfield name="person.sex" label="SEX" /> </td> </tr> <tr> <td> <s:textfield name="person.address" label="ADDRESS" /> </td> </tr> <tr> <td colspan="2"> <s:submit value="submit" /> <s:reset value="reset" /> </td> </tr> </table> </s:form> </body> </html> [/code] 添加数据之后点提交,会抛空指针错误,原因是LoginAction.java中的personService为空。。。 困惑,希望路过的各位兄弟帮忙看看。。谢过先~~
ssh整合时tomcat部署出现问题高手请进
<p>2010-9-8 0:20:42 org.apache.catalina.core.AprLifecycleListener init <br>信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.6.0_10\bin;D:\apache-tomcat-6.0.24\apache-tomcat-6.0.24\bin <br>2010-9-8 0:20:42 org.apache.coyote.http11.Http11Protocol init <br>信息: Initializing Coyote HTTP/1.1 on http-8080 <br>2010-9-8 0:20:42 org.apache.catalina.startup.Catalina load <br>信息: Initialization processed in 639 ms <br>2010-9-8 0:20:42 org.apache.catalina.core.StandardService start <br>信息: Starting service Catalina <br>2010-9-8 0:20:42 org.apache.catalina.core.StandardEngine start <br>信息: Starting Servlet Engine: Apache Tomcat/6.0.24 <br>2010-9-8 0:20:42 org.apache.catalina.startup.HostConfig deployDirectory <br>信息: Deploying web application directory epet <br>log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). <br>log4j:WARN Please initialize the log4j system properly. <br>2010-9-8 0:20:45 org.apache.catalina.core.ApplicationContext log <br>信息:<span style="color: #ff0000;"> Initializing WebApplicationContext for Struts ActionServlet 'action', module</span> '' <br>2010-9-8 0:20:54 org.apache.catalina.core.ApplicationContext log <br>严重: <span style="color: #ff0000;">action: null <br></span><span style="color: #ff0000;">org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/petDiary' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: <br>PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz': no matching editors or conversion strategy found <br>Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are: <br>PropertyAccessException 1: <br>org.springframework.beans.TypeMismatchException: Failed to convert property value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz': no matching editors or conversion strategy found <br>Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [epet.biz.impl.PetInfoBizImpl] to required type [epet.biz.PetDiaryBiz] for property 'biz': no matching editors or conversion strategy found <br></span>at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) <br>at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) <br>at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815) <br>at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645) <br>at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) <br>at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) <br>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127) <br>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862) <br>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424) <br>at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) <br>at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) <br>at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) <br>at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) <br>at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287) <br>at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) <br>at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:355) <br>at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:296) <br>at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:225) <br>at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158) <br>at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) <br>at javax.servlet.GenericServlet.init(GenericServlet.java:212) <br>at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) <br>at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) <br>at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187) <br>at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496) <br>at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) <br>at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) <br>at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) <br>at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) <br>at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) <br>at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) <br>at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) <br>at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) <br>at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) <br>at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) <br>at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) <br>at org.apache.catalina.core.StandardService.start(StandardService.java:516) <br>at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) <br>at org.apache.catalina.startup.Catalina.start(Catalina.java:593) <br>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br>at java.lang.reflect.Method.invoke(Method.java:597) <br>at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) <br>at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) <br>2010-9-8 0:20:54 org.apache.catalina.core.ApplicationContext log <br>信息: Marking servlet action as unavailable <br>2010-9-8 0:20:54 org.apache.catalina.core.StandardContext loadOnStartup <br>严重: Servlet /epet threw load() exception <br>javax.servlet.UnavailableException <br>at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1169) <br>at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) <br>at javax.servlet.GenericServlet.init(GenericServlet.java:212) <br>at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) <br>at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) <br>at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187) <br>at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496) <br>at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) <br>at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) <br>at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) <br>at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) <br>at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) <br>at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) <br>at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) <br>at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) <br>at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) <br>at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) <br>at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) <br>at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) <br>at org.apache.catalina.core.StandardService.start(StandardService.java:516) <br>at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) <br>at org.apache.catalina.startup.Catalina.start(Catalina.java:593) <br>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br>at java.lang.reflect.Method.invoke(Method.java:597) <br>at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) <br>at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) <br>2010-9-8 0:20:54 org.apache.catalina.startup.HostConfig deployDirectory <br>信息: Deploying web application directory epet.myeclipse.bak <br>log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). <br>log4j:WARN Please initialize the log4j system properly. <br>2010-9-8 0:20:56 org.apache.catalina.startup.HostConfig deployDirectory <br>信息: Deploying web application directory hourse <br>log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). <br>log4j:WARN Please initialize the log4j system properly. <br>2010-9-8 0:20:59 org.apache.coyote.http11.Http11Protocol start <br>信息: Starting Coyote HTTP/1.1 on http-8080 <br>2010-9-8 0:20:59 org.apache.jk.common.ChannelSocket init <br>信息: JK: ajp13 listening on /0.0.0.0:8009 <br>2010-9-8 0:20:59 org.apache.jk.server.JkMain start <br>信息: Jk running ID=0 time=0/47  config=null <br>2010-9-8 0:20:59 org.apache.catalina.startup.Catalina start <br>信息: Server startup in 17017 ms</p> <p> </p> <p> </p> <p> </p> <p>下面是我的applicationContext.xml文件内容</p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans<br> xmlns="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a>"<br> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br> xmlns:aop="<a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a>"<br> xmlns:tx="<a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a>"<br> xsi:schemaLocation="<a href="http://www.springframework.org/schema/beans">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">http://www.springframework.org/schema/beans/spring-beans-2.0.xsd</a><br> <a href="http://www.springframework.org/schema/tx">http://www.springframework.org/schema/tx</a><br> <a href="http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">http://www.springframework.org/schema/tx/spring-tx-2.0.xsd</a><br> <a href="http://www.springframework.org/schema/aop">http://www.springframework.org/schema/aop</a><br> <a href="http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">http://www.springframework.org/schema/aop/spring-aop-2.0.xsd</a>"&gt;<br> &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;<br>  &lt;property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/&gt;<br>  &lt;property name="url" value="jdbc:sqlserver://localhost:1433;DataBaseName=epet;SelectMethod=cursor"&gt;&lt;/property&gt;<br>  &lt;property name="username" value="sa"&gt;&lt;/property&gt;<br>  &lt;property name="password" value="123456"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;<br>  &lt;property name="dataSource"&gt;<br>   &lt;ref local="dataSource"/&gt;<br>  &lt;/property&gt;<br>  &lt;property name="mappingResources"&gt;<br>   &lt;list&gt;<br>   &lt;value&gt;epet/entity/PetInfo.hbm.xml&lt;/value&gt;<br>   &lt;value&gt;epet/entity/PetDiary.hbm.xml&lt;/value&gt;<br>   &lt;/list&gt;<br>  &lt;/property&gt;<br>  &lt;property name="hibernateProperties"&gt;<br>   &lt;props&gt;<br>    &lt;prop key="hibernate.dialect"&gt;<br>     org.hibernate.dialect.SQLServerDialect<br>    &lt;/prop&gt;<br>    &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;<br>   &lt;/props&gt;<br>  &lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="petInfoDAO" class="epet.dao.hibimpl.PetInfoDAOHiblImpl"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean id="petDiaryDAO" class="epet.dao.hibimpl.PetDiaryDAOHibImpl"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="petInfoBiz" class="epet.biz.impl.PetInfoBizImpl"&gt;<br>  &lt;property name="biz" ref="petInfoDAO"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean id="petDiaryBiz" class="epet.biz.impl.PetDiaryBIzImpl"&gt;<br>  &lt;property name="biz" ref="petDiaryDAO"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean name="/pet" class="epet.web.action.PetAction"&gt;<br>  &lt;property name="biz" ref="petInfoBiz"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;bean name="/petDiary" class="epet.web.action.PetDiaryAction"&gt;<br>  &lt;property name="biz" ref="petInfoBiz"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> <br> &lt;bean id="myHibTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;<br>  &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br> &lt;/bean&gt;<br> &lt;tx:advice id="txAdvice" transaction-manager="myHibTxManager"&gt;<br>  &lt;tx:attributes&gt;<br>   &lt;tx:method name="get*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="load*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="search*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="to*" propagation="SUPPORTS" read-only="true"/&gt;<br>   &lt;tx:method name="do*" propagation="REQUIRED"/&gt;<br>   &lt;tx:method name="*" propagation="REQUIRED"/&gt;<br>  &lt;/tx:attributes&gt;<br> &lt;/tx:advice&gt;<br> &lt;aop:config&gt;<br>  &lt;aop:pointcut id="bizMethod" expression="execution(* epet.*.*(..))"/&gt;<br>  &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethod"/&gt;<br> &lt;/aop:config&gt;<br>&lt;/beans&gt;</p> <p> </p>
我整合SSH2的时候启动时候tomcat6.0出现异常
2009-3-19 21:23:34 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\MyEclipse 6.5\bin;D:\Program Files\apache-tomcat-6.0.18\bin 2009-3-19 21:23:34 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2009-3-19 21:23:34 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 1718 ms 2009-3-19 21:23:35 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-3-19 21:23:35 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.18 2009-3-19 21:23:43 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 2009-03-19 21:23:43,125 [org.springframework.web.context.ContextLoader]-[INFO] Root WebApplicationContext: initialization started 2009-03-19 21:23:43,343 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Refreshing org.springframework.web.context.support.XmlWebApplicationContext@6bd9e0: display name [Root WebApplicationContext]; startup date [Thu Mar 19 21:23:43 CST 2009]; root of context hierarchy 2009-03-19 21:23:43,625 [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext.xml] 2009-03-19 21:23:45,031 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@6bd9e0]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5539d8 2009-03-19 21:23:45,484 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5539d8: defining beans [dataSource,sessionFactory,baseDAO,userDAO,userService,userAction]; root of factory hierarchy 2009-03-19 21:23:45,968 [org.hibernate.cfg.Environment]-[INFO] Hibernate 3.2.2 2009-03-19 21:23:45,984 [org.hibernate.cfg.Environment]-[INFO] hibernate.properties not found 2009-03-19 21:23:45,984 [org.hibernate.cfg.Environment]-[INFO] Bytecode provider name : cglib 2009-03-19 21:23:46,015 [org.hibernate.cfg.Environment]-[INFO] using JDK 1.4 java.sql.Timestamp handling 2009-03-19 21:23:46,875 [org.hibernate.cfg.HbmBinder]-[INFO] Mapping class: com.softeem.structs2.pojo.UserInfo -> userinfo 2009-03-19 21:23:46,953 [org.springframework.orm.hibernate3.LocalSessionFactoryBean]-[INFO] Building new Hibernate SessionFactory 2009-03-19 21:23:47,250 [org.hibernate.connection.ConnectionProviderFactory]-[INFO] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider 2009-03-19 21:23:47,984 [org.hibernate.cfg.SettingsFactory]-[INFO] RDBMS: Microsoft SQL Server, version: 9.00.1399 2009-03-19 21:23:47,984 [org.hibernate.cfg.SettingsFactory]-[INFO] JDBC driver: Microsoft SQL Server 2005 JDBC Driver, version: 1.1.1501.101 2009-03-19 21:23:48,062 [org.hibernate.dialect.Dialect]-[INFO] Using dialect: org.hibernate.dialect.SQLServerDialect 2009-03-19 21:23:48,109 [org.hibernate.transaction.TransactionFactoryFactory]-[INFO] Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory 2009-03-19 21:23:48,109 [org.hibernate.transaction.TransactionManagerLookupFactory]-[INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Automatic flush during beforeCompletion(): disabled 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Automatic session close at end of transaction: disabled 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Scrollable result sets: enabled 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] JDBC3 getGeneratedKeys(): enabled 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Connection release mode: auto 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Default batch fetch size: 1 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Generate SQL with comments: disabled 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Order SQL updates by primary key: disabled 2009-03-19 21:23:48,109 [org.hibernate.cfg.SettingsFactory]-[INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 2009-03-19 21:23:48,125 [org.hibernate.hql.ast.ASTQueryTranslatorFactory]-[INFO] Using ASTQueryTranslatorFactory 2009-03-19 21:23:48,125 [org.hibernate.cfg.SettingsFactory]-[INFO] Query language substitutions: {} 2009-03-19 21:23:48,125 [org.hibernate.cfg.SettingsFactory]-[INFO] JPA-QL strict compliance: disabled 2009-03-19 21:23:48,125 [org.hibernate.cfg.SettingsFactory]-[INFO] Second-level cache: enabled 2009-03-19 21:23:48,125 [org.hibernate.cfg.SettingsFactory]-[INFO] Query cache: disabled 2009-03-19 21:23:48,125 [org.hibernate.cfg.SettingsFactory]-[INFO] Cache provider: org.hibernate.cache.NoCacheProvider 2009-03-19 21:23:48,125 [org.hibernate.cfg.SettingsFactory]-[INFO] Optimize cache for minimal puts: disabled 2009-03-19 21:23:48,140 [org.hibernate.cfg.SettingsFactory]-[INFO] Structured second-level cache entries: disabled 2009-03-19 21:23:48,156 [org.hibernate.cfg.SettingsFactory]-[INFO] Statistics: disabled 2009-03-19 21:23:48,156 [org.hibernate.cfg.SettingsFactory]-[INFO] Deleted entity synthetic identifier rollback: disabled 2009-03-19 21:23:48,156 [org.hibernate.cfg.SettingsFactory]-[INFO] Default entity-mode: pojo 2009-03-19 21:23:48,156 [org.hibernate.cfg.SettingsFactory]-[INFO] Named query checking : enabled 2009-03-19 21:23:48,281 [org.hibernate.impl.SessionFactoryImpl]-[INFO] building session factory 2009-03-19 21:23:49,437 [org.hibernate.impl.SessionFactoryObjectFactory]-[INFO] Not binding factory to JNDI, no JNDI name configured 2009-03-19 21:23:49,578 [org.springframework.web.context.ContextLoader]-[INFO] Root WebApplicationContext: initialization completed in 6453 ms 2009-03-19 21:23:50,171 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts-default.xml] 2009-03-19 21:23:50,765 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts-plugin.xml] 2009-03-19 21:23:50,796 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts.xml] 2009-3-19 21:23:50 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 Unable to load configuration. - [unknown location] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location] at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:287) at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:258) at org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java:203) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55) ... 30 more 2009-3-19 21:23:50 org.apache.catalina.core.StandardContext start 严重: Error filterStart 2009-3-19 21:23:50 org.apache.catalina.core.StandardContext start 严重: Context [/loginStruct2] startup failed due to previous errors 2009-3-19 21:23:50 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2009-03-19 21:23:50,843 [org.springframework.web.context.support.XmlWebApplicationContext]-[INFO] Closing org.springframework.web.context.support.XmlWebApplicationContext@6bd9e0: display name [Root WebApplicationContext]; startup date [Thu Mar 19 21:23:43 CST 2009]; root of context hierarchy 2009-03-19 21:23:50,843 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5539d8: defining beans [dataSource,sessionFactory,baseDAO,userDAO,userService,userAction]; root of factory hierarchy 2009-03-19 21:23:50,843 [org.springframework.orm.hibernate3.LocalSessionFactoryBean]-[INFO] Closing Hibernate SessionFactory 2009-03-19 21:23:50,843 [org.hibernate.impl.SessionFactoryImpl]-[INFO] closing 2009-3-19 21:23:51 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2009-3-19 21:23:52 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-3-19 21:23:52 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/47 config=null 2009-3-19 21:23:52 org.apache.catalina.startup.Catalina start 信息: Server startup in 17210 ms ------我选择刚刚接触SSH2,不知道是那个地方出了问题,请各位大哥帮帮我,不胜感激!!!!!! 下面是我上传的 工程图和架包图 applicationContext.xml ,struts.xml,web.xml的配置文件 希望能够有所帮助! 我在这里等这各位大哥的答复 [b]问题补充:[/b] 上面有我上传的配置文件 我看了半天都不知道那里不对,因为我刚刚接触SSH2,还有许多都不太明白,希望您能不能够说详细点,谢谢了 :arrow: [b]问题补充:[/b] 我把WEB.XML文件里面的 <!-- struts2 filter --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 去掉发布就没有错误,好郁闷啊,这个问题困了我2天了,解决不鸟,心里好不爽,所以我一定要解决他,还麻烦各位大哥,大姐的帮助我啊
S2SH整合出现的三大问题,希望大家一起解决,谢谢。
差不多没分了,但还是希望好心人能帮俺解决。 [size=x-large]问题1:[/size] 我的applicationContext.xml放在WEB-INF目录下,在web.xml应该怎样配置,如果放在src目录下又怎样配置?但我无论放在哪里都没能以set方法成功注入,只能通过new FileSystemXmlApplicationContext或new ClassPathXmlApplicationContext("applicationContext.xml")来getBean获取。 我在web.xml里配置: <context-param> <param-name>contextConfigLocation </param-name> <!--三种都不行--> <!-- <param-value>/WEB-INF/classes/applicationContext.xml </param-value> --> <!-- <param-value>WEB-INF/:applicationContext.xml, </param-value> --> <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/applicationContext_*.xml</param-value> </context-param> [size=x-large]问题2:[/size] SSH整合时,连接过多会显示too many Connection,用jdbc时出现这个问题是,可以用ptmt.close()、con.close()就可以解决,但用SSH时怎样关掉连接呢?用Spring配置还是在连接里面用session.close()? 问题3: java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException 我用的是MyEclipse8.6和Tomcat6.0 我已经导入了很多库,其中Struts 2 Spring Libraries中的spring-beans-2.5.6.jar和Spring 3.0 Core Libraries中的org.springframework.core-3.0.1.RELEASE-A.jar都有 org.springframework.beans.FatalBeanException,而且部署以后Tomcat6.0的wabapps目录lib下也有相应的spring-beans-2.5.6.jar包和org.springframework.core-3.0.1.RELEASE-A.jar,但是还是报错: [code="java"] 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:946) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:892) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2011-1-3 13:05:57 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2011-1-3 13:05:57 org.apache.catalina.core.StandardContext start 严重: Context [/UserServiceManage] startup failed due to previous errors 2011-1-3 13:05:58 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. 2011-1-3 13:05:59 org.apache.coyote.http11.Http11AprProtocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2011-1-3 13:05:59 org.apache.coyote.ajp.AjpAprProtocol start 信息: Starting Coyote AJP/1.3 on ajp-8009 2011-1-3 13:05:59 org.apache.catalina.startup.Catalina start 信息: Server startup in 27801 ms [/code]
SSH集成,报错,请指点
我是用myeclipse6.6先引入struts1.3,然后是spring2.0,最后是Hibernate3.2的,让myeclipse把 hibernate配置文件删除,把hibernate的配置信息写在spring的applicationContext.xml中,我配置了 sessionFactory和dataSource,最开始报错,我上网上查要删除asm.jar这个包,还是不好使,我就又看一篇文章,要删除 asm.jar,asm-attrs.jar,cglib-2.1.3.jar,我都删了,就好使了,我就传到svn上了,我剪出下来就好使,可我同事一剪出下来发布到tomcat6.0上就报这个错(但她只要改项目中的任何一个文件,做一点改动,就好使了,每回剪出后都要这样,同事和我的myeclipse和svn得版本都相同,这是为什么啊,请各位大哥大姐帮我研究一下,很着急呀!!!) 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [com/transport/aviation/model/Aviation.hbm.xml] cannot be opened because it does not exist Caused by: java.io.FileNotFoundException: class path resource [com/transport/aviation/model/Aviation.hbm.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2009-8-26 10:43:55 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-8-26 10:43:55 org.apache.catalina.core.StandardContext start 严重: Context [/transport] startup failed due to previous errors 2009-8-26 10:43:55 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2009-8-26 10:43:55 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8090 2009-8-26 10:43:55 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-8-26 10:43:55 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/47 config=null 2009-8-26 10:43:55 org.apache.catalina.startup.Catalina start 信息: Server startup in 20271 ms 补充问题,在svn中我剪出她的和我的都好使,然后发布到tomcat上都好使,她剪出她自己的和我的在她机器上必须改点东西才好使,不管改什么都好使,不改就是不行,我俩不但myeclipse,svn版本一样机器都是一样的
相见恨晚的超实用网站
相见恨晚的超实用网站 持续更新中。。。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
JavaScript 为什么能活到现在?
作者 | 司徒正美 责编 |郭芮 出品 | CSDN(ID:CSDNnews) JavaScript能发展到现在的程度已经经历不少的坎坷,早产带来的某些缺陷是永久性的,因此浏览器才有禁用JavaScript的选项。甚至在jQuery时代有人问出这样的问题,jQuery与JavaScript哪个快?在Babel.js出来之前,发明一门全新的语言代码代替JavaScript...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
吐血推荐珍藏的Visual Studio Code插件
作为一名Java工程师,由于工作需要,最近一个月一直在写NodeJS,这种经历可以说是一部辛酸史了。好在有神器Visual Studio Code陪伴,让我的这段经历没有更加困难。眼看这段经历要告一段落了,今天就来给大家分享一下我常用的一些VSC的插件。 VSC的插件安装方法很简单,只需要点击左侧最下方的插件栏选项,然后就可以搜索你想要的插件了。 下面我们进入正题 Material Theme ...
实战:如何通过python requests库写一个抓取小网站图片的小爬虫
有点爱好的你,偶尔应该会看点图片文字,最近小网站经常崩溃消失,不如想一个办法本地化吧,把小照片珍藏起来! 首先,准备一个珍藏的小网站,然后就可以开始啦! 第一步 我们先写一个获取网站的url的链接,因为url常常是由page或者,其他元素构成,我们就把他分离出来,我找到的网站主页下有图片区 图片区内有标题页,一个标题里有10张照片大概 所以步骤是: 第一步:进入图片区的标题页 def getH...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
相关热词 基于c#波形控件 c# 十进制转十六进制 对文件aes加密vc# c#读取栈中所有的值 c# rsa256加密 好 学c# 还是c++ c# 和java的差距 c# curl网络框架 c# https证书请求 c# 中崎
立即提问