源码编译SSH项目问题记录

 源码编译spring2.5.6+Hibernate3.2.5ga+ structs2.1.8在 Apache Tomcat/5.5.25的部署, JDK1.5环境下编译,IDE工具MyEclipse8.0,


错误1。Namespace问题解决:
将META-INF/spring.handlers和spring.schemas连目录和文件一起复制到src下就可以了。

错误2.
Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from file D:/GreenProg/NewTomcat5/webapps/SSHSrc/WEB-INF/classes/com/css/boss/model/TPubDic.hbm.xml
Caused by: org.xml.sax.SAXParseException: Element type "comment" must be declared.
将Hibernate 缺少的jar包补全。

错误3.
File: URL.java
Method: <init>
Line: 601 - java/net/URL.java:601:-1
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:893)
    ... 34 more
Caused by: java.net.MalformedURLException

将struts2-spring-plugin-2.1.8.jar引入。将E:/SSH源码/struts-2.1.8-src/struts-2.1.8/src/core/src/main/resources/org/apache/struts2下的default.properties文件拷贝引入,放在src/org/apache/struts2/下。

错误4。
Caused by: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=com.opensymphony.xwork2.util.reflection.ReflectionProvider, name='default'] in public void com.opensymphony.xwork2.ObjectFactory.setReflectionProvider(com.opensymphony.xwork2.util.reflection.ReflectionProvider).
    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$MethodInjector.<init>(ContainerImpl.java:287)
    at com.opensymphony.xwork2.inject.ContainerImpl$3.create(ContainerImpl.java:117)
    at com.opensymphony.xwork2.inject.ContainerImpl$3.create(ContainerImpl.java:114)
    at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:141)
    ... 64 more


将struts-default.xml 拷贝到src下


错误5.hibernate 3.2源码中org.hibernate.hql.antlr没有java文件解决方案
要解决这个问题,首先要了解ANTLR是做什么用的,ANTLR, 语言识别的另一个工具(ANother Tool for Language Recognition ),(前身是 PCCTS)是一种语言工具,它提供了一个框架,可以通过包含Java,C++,或C#动作(action)的语法描述来构造语言识别器,编译器和解析器。

附件中有ANTLR参考手册,有兴趣的朋友可以看一下

解决方法
1.将antlr-2.7.6.jar放到E:/SSH源码/hibernate-3.2.5.ga/hibernate-3.2/grammar
2.在CMD下运行start.bat

set Path=D:/Sun/SDK/jdk/jre/bin/;%Path%


java -cp ./antlr-2.7.6.jar antlr.Tool hql.g

java -cp ./antlr-2.7.6.jar antlr.Tool hql-sql.g

java -cp ./antlr-2.7.6.jar antlr.Tool sql-gen.g 



    ANTLR参考手册.pdf (1.5 MB)
    下载次数: 185

声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。

错误6.
[INFO]main-org.apache.catalina.util.ExtensionValidator-ExtensionValidator[/SSHSrc][commons-attributes-compiler.jar]: Required extension "ant" not found.
[INFO]main-org.apache.catalina.util.ExtensionValidator-ExtensionValidator[/SSHSrc][commons-attributes-compiler.jar]: Required extension "commons-attributes-api" not found.
[INFO]main-org.apache.catalina.util.ExtensionValidator-ExtensionValidator[/SSHSrc][commons-attributes-compiler.jar]: Required extension "javadoc" not found.
[INFO]main-org.apache.catalina.util.ExtensionValidator-ExtensionValidator[/SSHSrc]: Failure to find 3 required extension(s).
[ERROR]main-org.apache.catalina.core.StandardContext-Error getConfigured

这个问题是commons-attributes-compiler.jar的配置文件BUG。META-INF/MANIFEST.MF多了一些不必要的换行,将jar中的META-INF/MANIFEST.MF修改一下

正确内容如下:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: Apache Maven
Built-By: hen
Package: org.apache.commons.attributes.compiler
Build-Jdk: 1.4.2_05
Extension-Name: commons-attributes-compiler
Specification-Title: Attribute Compiler
Specification-Vendor: The Apache Software Foundation
Implementation-Title: org.apache.commons.attributes.compiler
Implementation-Vendor: The Apache Software Foundation
Implementation-Version: 2.2
Extension-List: ant qdox commons-attributes-api javadoc
ant-Extension-Name: ant
ant-Implementation-Version: 1.5
ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5.jar
qdox-Extension-Name: qdox
qdox-Implementation-Version: 1.5
qdox-Implementation-URL: http://www.ibiblio.org/maven/qdox/jars/qdox-1.5.jar
commons-attributes-api-Extension-Name: commons-attributes-api
commons-attributes-api-Implementation-Version: 2.2
commons-attributes-api-Implementation-URL: http://www.ibiblio.org/maven/commons-attributes/jars/commons-attributes-api-2.2.jar
javadoc-Extension-Name: javadoc
javadoc-Implementation-Version: 1.4
javadoc-Implementation-URL: http://www.ibiblio.org/maven/javadoc/jars/javadoc-1.4.jar
Implementation-Vendor-Id: org.apache
X-Compile-Source-JDK: 1.4
X-Compile-Target-JDK: 1.4

 

问题7。struct-taglib问题。

org.apache.jasper.JasperException: File "/struts-tags" not found
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:160)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
    org.apache.jasper.compiler.Parser.parse(Parser.java:127)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
    com.css.common.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:33)
   
将struts2-core-2.1.8.jar解压,找出文件struts-tags.tld,复制到src/META-INF/下,重启应用。
注意:struts2-core-2.1.8.jar在源码包中没有,必须从别的地方找。

 

 

问题8。访问jsp页面报错
2011-05-12 16:54:26.203 ERROR http-8080-Processor25 org.apache.catalina.core.ApplicationDispatcher_invoke(723) | Servlet.service() for servlet jsp threw exception
java.io.FileNotFoundException: Template /template/xhtml/hidden.ftl not found.
    at freemarker.template.Configuration.getTemplate(Configuration.java:489)
    at freemarker.template.Configuration.getTemplate(Configuration.java:452)
    at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:120)
    at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)
    at org.apache.struts2.components.UIBean.end(UIBean.java:513)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    at org.apache.jsp.manage.left_jsp._jspx_meth_s_005fhidden_005f0(left_jsp.java:173)
    at org.apache.jsp.manage.left_jsp._jspService(left_jsp.java:146)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.css.common.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:33)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:595)



将源码包中的struts-2.1.8-src/struts-2.1.8/src/core/src/main/resources/下的目录template全部拷贝到项目下
例如项目目录为D:/MyWorkDataJEdit/SSHSrc/src,将template目录拷贝到这个下面就可以了。

你可能感兴趣的:(apache,Hibernate,exception,struts,ssh,extension)