0

jonix.jar 用于解析图书行业的特定 xml 文件。我已经在核心 java 中使用 jonix 制作了相同的程序来解析 xml,并且工作正常。但现在我

       import java.io.Serializable;
       import com.opensymphony.xwork2.ActionSupport;
       import org.jonix.*;
       import org.jonix.basic.*;
     public class OnixReader extends ActionSupport implements Serializable{
         public String onix(){
    System.out.println("Onix Reader....");
    try {  
        JonixFilesScanner<BasicHeader, BasicProduct> scanner = new JonixFilesScanner<BasicHeader, BasicProduct>(new BasicFactory())
        {
                @Override
                protected void onHeader(BasicHeader header)
                {
               // ONIX-Header was processed, do something with the data..
                }

                @Override
                protected void onProduct(BasicProduct product, int index)
                {
                        // ONIX-Product (i.e. e-book) was processed, do something with the data..
                    if(index>0 && index<=1000){
                        System.out.println(index+":");
                    }



                }
        };
        scanner.scanFile(JonixPackages.v21_Reference, "D:/BBI/apache-tomcat-6.0.37/webapps/LSI_ONIX_FULL_20130623.xml");               
        }
       catch (Exception e) 
        {  
            e.printStackTrace(System.err);
            e.getCause();
            }
        return SUCCESS;
        }

}

**这给出了以下错误:

HTTP 状态 500 -
类型异常报告
消息
描述
服务器遇到内部错误,阻止它完成此请求。例外

java.lang.reflect.InvocationTargetException
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:76)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:65)
    com.buybooks.filter.HibernateSessionCloseFilter.doFilter(HibernateSessionCloseFilter.java:40)

根本原因

java.lang.OutOfMemoryError: PermGen space
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(Unknown Source)
java.lang.ClassLoader.defineClass(Unknown Source)
java.security.SecureClassLoader.defineClass(Unknown Source)
    org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2854)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Unknown Source)
java.lang.Class.getDeclaredMethods(Unknown Source)
    com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredMethods(Unknown Source)
    com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredMethods(Unknown Source)
com.sun.xml.internal.bind.v2.model.impl.RegistryInfoImpl.<init>(Unknown Source)
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.addRegistry(Unknown Source)
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(Unknown Source)
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
    com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
javax.xml.bind.ContextFinder.newInstance(Unknown Source)
javax.xml.bind.ContextFinder.find(Unknown Source)
javax.xml.bind.JAXBContext.newInstance(Unknown Source)
javax.xml.bind.JAXBContext.newInstance(Unknown Source)
javax.xml.bind.JAXBContext.newInstance(Unknown Source)
org.jonix.JonixParser.<init>(JonixParser.java:97)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.37 logs.
Apache Tomcat/6.0.37

我已经尝试使用
set JAVA_OPTS="-Xms1024m -Xmx10246m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m"
并且 LSI_ONIX_FULL_20130623.xml 的大小为 476KB。
请帮我。**

我的 WEB-INF/LIB 包含:

*<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry excluding="com/BBI/dao/|com/BBI/dao/impl/" kind="src" path="src"/>
    <classpathentry kind="lib" path="lib/activation.jar"/>
    <classpathentry kind="lib" path="lib/ant-1.6.5.jar"/>
    <classpathentry kind="lib" path="lib/antlr-2.7.7.jar"/>
    <classpathentry kind="lib" path="lib/asm-2.2.3.jar"/>
    <classpathentry kind="lib" path="lib/asm-attrs.jar"/>
    <classpathentry kind="lib" path="lib/asm.jar"/>
    <classpathentry kind="lib" path="lib/axis-ant.jar"/>
    <classpathentry kind="lib" path="lib/axis-schema.jar"/>
    <classpathentry kind="lib" path="lib/axis.jar"/>
    <classpathentry kind="lib" path="lib/c3p0-0.9.1.jar"/>
    <classpathentry kind="lib" path="lib/cglib-nodep-2.1_3.jar"/>
    <classpathentry kind="lib" path="lib/commons-beanutils-1.7.0.jar"/>
    <classpathentry kind="lib" path="lib/commons-chain-1.2.jar"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
    <classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-collections-3.2.jar"/>
    <classpathentry kind="lib" path="lib/commons-configuration-1.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-digester-1.8.jar"/>
    <classpathentry kind="lib" path="lib/commons-discovery-0.2.jar"/>
    <classpathentry kind="lib" path="lib/commons-discovery.jar"/>
    <classpathentry kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar"/>
    <classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-pool-1.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-validator-1.3.1.jar"/>
    <classpathentry kind="lib" path="lib/concurrent-1.3.2.jar"/>
    <classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
    <classpathentry kind="lib" path="lib/ehcache-1.2.3.jar"/>
    <classpathentry kind="lib" path="lib/FastInfoset-1.2.2.jar"/>
    <classpathentry kind="lib" path="lib/freemarker-2.3.13.jar"/>
    <classpathentry kind="lib" path="lib/javassist-3.3.ga.jar"/>
    <classpathentry kind="lib" path="lib/jaxrpc.jar"/>
    <classpathentry kind="lib" path="lib/jta.jar"/>
    <classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
    <classpathentry kind="lib" path="lib/log4j-1.2.8.jar"/>
    <classpathentry kind="lib" path="lib/lucene-core-2.4.1.jar"/>
    <classpathentry kind="lib" path="lib/lucene-snowball-2.4.1.jar"/>
    <classpathentry kind="lib" path="lib/mail.jar"/>
    <classpathentry kind="lib" path="lib/mailapi.jar"/>
    <classpathentry kind="lib" path="lib/mysql-connector-java-3.1.13.jar"/>
    <classpathentry kind="lib" path="lib/neethi-2.0.4.jar"/>
    <classpathentry kind="lib" path="lib/nexus-0.0.1.jar"/>
    <classpathentry kind="lib" path="lib/ognl-2.6.11.jar"/>
    <classpathentry kind="lib" path="lib/oro-2.0.8.jar"/>
    <classpathentry kind="lib" path="lib/paypal_base.jar"/>
    <classpathentry kind="lib" path="lib/paypal_stubs.jar"/>
    <classpathentry kind="lib" path="lib/PaypalIntegration.jar"/>
    <classpathentry kind="lib" path="lib/poi-3.2-FINAL-20081019.jar"/>
    <classpathentry kind="lib" path="lib/poi-3.2-FINAL.jar"/>
    <classpathentry kind="lib" path="lib/poi-contrib-3.2-FINAL-20081019.jar"/>
    <classpathentry kind="lib" path="lib/poi-ooxml-3.5-beta5-20090219.jar"/>
    <classpathentry kind="lib" path="lib/poi-scratchpad-3.2-FINAL-20081019.jar"/>
    <classpathentry kind="lib" path="lib/saaj.jar"/>
    <classpathentry kind="lib" path="lib/serializer.jar"/>
    <classpathentry kind="lib" path="lib/servlet-api.jar"/>
    <classpathentry kind="lib" path="lib/solr-common-1.3.0.jar"/>
    <classpathentry kind="lib" path="lib/solr-core-1.3.0.jar"/>
    <classpathentry kind="lib" path="lib/spring-all-2.5.jar"/>
    <classpathentry kind="lib" path="lib/struts-core-1.3.10.jar"/>
    <classpathentry kind="lib" path="lib/struts2-codebehind-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-config-browser-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-core-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-dojo-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-dwr-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-sitemesh-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-spring-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-struts1-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/struts2-tiles-plugin-2.1.6.jar"/>
    <classpathentry kind="lib" path="lib/tagsoup-1.0.1.jar"/>
    <classpathentry kind="lib" path="lib/tiles-api-2.0.6.jar"/>
    <classpathentry kind="lib" path="lib/tiles-core-2.0.6.jar"/>
    <classpathentry kind="lib" path="lib/tiles-jsp-2.0.5.jar"/>
    <classpathentry kind="lib" path="lib/wsdl4j-1.5.1.jar"/>
    <classpathentry kind="lib" path="lib/wsdl4j-1.6.1.jar"/>
    <classpathentry kind="lib" path="lib/wstx-asl-3.2.4.jar"/>
    <classpathentry kind="lib" path="lib/xalan.jar"/>
    <classpathentry kind="lib" path="lib/xbean-spring-3.4.jar"/>
    <classpathentry kind="lib" path="lib/xerces-2.6.2.jar"/>
    <classpathentry kind="lib" path="lib/xerces.jar"/>
    <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
    <classpathentry kind="lib" path="lib/xml-apis.jar"/>
    <classpathentry kind="lib" path="lib/xml-resolver-1.2.jar"/>
    <classpathentry kind="lib" path="lib/xmlbeans-2.3.0.jar"/>
    <classpathentry kind="lib" path="lib/XmlSchema-1.4.2.jar"/>
    <classpathentry kind="lib" path="lib/xmlsec-1.3.0.jar"/>
    <classpathentry kind="lib" path="lib/xpp3_min-1.1.3.4.O.jar"/>
    <classpathentry kind="lib" path="lib/xsltc.jar"/>
    <classpathentry kind="lib" path="lib/xstream-1.1.3.jar"/>
    <classpathentry kind="lib" path="lib/xstream-1.2.2.jar"/>
    <classpathentry kind="lib" path="lib/xwork-2.1.2.jar"/>
    <classpathentry kind="lib" path="target/lib/buybooks.jar" sourcepath="target/lib/buybooks.jar"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="lib/hibernate-annotations-3.4.0.GA.jar"/>
    <classpathentry kind="lib" path="lib/hibernate-core-3.6.3.Final.jar"/>
    <classpathentry kind="lib" path="lib/hibernate-ehcache-3.3.1.GA.jar"/>
    <classpathentry kind="lib" path="lib/hibernate-search-3.4.0.Final.jar"/>
    <classpathentry kind="lib" path="lib/hibernate-search-analyzers-3.4.0.Final.jar"/>
    <classpathentry kind="lib" path="lib/hibernate-search-infinispan-3.4.0.Final.jar"/>
    <classpathentry kind="lib" path="lib/jonix-2.0.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>*
4

0 回答 0