jdk tomcat struts2

LeoooB 发布于 2013/06/25 23:41
阅读 1K+
收藏 0

我运行 struts2 编出来的程序时报错了,,,可是环境变量我配置也没问题,却出现运行时异常,这就说明环境配置有问题,,有关的全部错误如下 ,,

2013-6-25 23:11:07 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: C:\Program Files\Java\jdk1.6.0_30\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.6.0_30\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows7Master;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;.
2013-6-25 23:11:07 org.apache.catalina.startup.SetAllPropertiesRule begin
警告: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'URIENcoding' to 'UTF-8' did not find a matching property.
2013-6-25 23:11:07 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Struts2Demo' did not find a matching property.
2013-6-25 23:11:07 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
2013-6-25 23:11:07 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
2013-6-25 23:11:07 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 376 ms
2013-6-25 23:11:07 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2013-6-25 23:11:07 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.29
2013-6-25 23:11:08 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
    at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
    at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
    at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
    at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
    at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:580)
    at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:288)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:205)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
    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 com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
    ... 29 more
Caused by: java.lang.ExceptionInInitializerError
    at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
    ... 34 more
Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency!
    at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:168)
    ... 35 more
Caused by: java.lang.ClassNotFoundException: javassist.ClassPool
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:165)
    ... 35 more
2013-6-25 23:11:08 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts
java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector
File: ContainerImpl.java
Method: inject
Line: 301 - com/opensymphony/xwork2/inject/ContainerImpl.java:301:-1
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)
    at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
    at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
    at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
    at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
    at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:580)
    at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:288)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:205)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
    ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
    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 com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)
    ... 29 more
Caused by: java.lang.ExceptionInInitializerError
    at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
    ... 34 more
Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency!
    at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:168)
    ... 35 more
Caused by: java.lang.ClassNotFoundException: javassist.ClassPool
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:165)
    ... 35 more
2013-6-25 23:11:08 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
2013-6-25 23:11:08 org.apache.catalina.core.StandardContext startInternal
严重: Context [/Struts2Demo] startup failed due to previous errors
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\docs
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\examples
2013-6-25 23:11:08 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2013-6-25 23:11:08 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2013-6-25 23:11:08 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@4bfe6b')
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\host-manager
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\Java_Diary
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\manager
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\ROOT
2013-6-25 23:11:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory E:\apache-tomcat-7.0.29\webapps\WEIBO_DEMO
2013-6-25 23:11:08 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2013-6-25 23:11:08 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2013-6-25 23:11:08 org.apache.catalina.startup.Catalina start
信息: Server startup in 1404 ms

我的环境变量有三个,,

CLASSPATH

.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

Java_home

C:\Program Files\Java\jdk1.6.0_30

path

C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows7Master;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;%JAVA_HOME%\bin;

jar 包

commons-fileupload-1.2.2.jar  commons-logging-1.1.1.jar freemarker-2.3.19.jar  mysql-connector-jar-5.0.8-bin.jar ognl-3.0.5.jar struts2-core-2.3.4.jar xwork-core-2.3.4.jar


struts.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
    <package name="user" extends="struts-default">
        <action name="user_*" class="cn.edu.tsinghua.struts.demo.action.UserAction" method="{1}">
            <result name="register_success" type="redirect">login.jsp</result>
            <result name="login_success" type="redirect">index.jsp</result>
            <result name="input">login.jsp</result>
        </action>
    </package>
</struts>


user.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="cn.edu.tsinghua.struts.demo.entity">
    <class name="User">
        <id name="id">
<!--             主键生成策略 -->
            <generator class="identity" />
        </id>
        <property name="username" />
        <property name="password" />
    </class>
</hibernate-mapping>


hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql:///strutshibernate</property>
        <property name="connection.username">root</property>
        <property name="connection.password">system</property>
        
        <property name="hibernate.show_sql">true</property>
        
        <property name="hibernate.hbm2ddl.auto">update</property>
        
        <mapping resource="user.hbm.xml" />
    </session-factory>
</hibernate-configuration>


java类的import 下划线是红色的有

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>Struts2Demo</display-name>
    <welcome-file-list>
        <welcome-file>signup.jsp</welcome-file>
    </welcome-file-list>
    <filter>
        <filter-name>struts</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts</filter-name>
        <url-pattern>/*</url-pattern>    
    </filter-mapping>
</web-app>

再次非常感谢帮我解决一下啊,,是在是弄不了了,,

加载中
1
zfc827
zfc827
缺少 Javassist library
LeoooB
LeoooB
我给你多少分呢
0
LeoooB
LeoooB
恩谢谢,,认真仔细看看,发现,少了三个jar包,,加上后全好了,,,
0
pantrick
pantrick
Caused by: java.lang.ClassNotFoundException: javassist.ClassPool
LeoooB
LeoooB
恩,,可是现在还是少了一个jar包,,我不知道是哪个,具体错误是在代码里面的红色下划线, import org.hibernate.Query; 这些错误,,就是没找到hibernate的jar包,,
0
LeoooB
LeoooB
全好了,,它妹啊,都是jar包惹的祸,
返回顶部
顶部