struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yasser Zamani <yasser.zam...@live.com>
Subject validation xmls in a Struts2 application with no Internet connection
Date Sat, 14 Dec 2013 16:02:46 GMT
Hi there,

We have a Struts2 application with some validation XMLs with following 
"DOCTYPE":

    <!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator
    1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">


When we run this application on a server which has access to 
"struts.apache.org", there is no problem. But when we run it on a server 
which has no access to "struts.apache.org", Struts can not create 
default validation interceptor with following exception:

    Caught Exception while registering Interceptor class
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor
    - interceptor -
    jar:file:/home/yasser/Applications/apache-tomcat-7.0.29/webapps/TAAM/WEB-INF/lib/struts2-core-2.3.1.1.jar!/struts-default.xml:148:127
         at
    com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:213)
         at
    com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70)
         at
    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:1035)
         at
    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStack(XmlConfigurationProvider.java:852)
         at
    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStacks(XmlConfigurationProvider.java:865)
         at
    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptors(XmlConfigurationProvider.java:888)
         at
    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
         at
    com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278)
         at
    org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
         at
    com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
         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:436)
         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: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.addChildInternal(ContainerBase.java:901)
         at
    org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
         at
    org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
         at
    org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
         at
    org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
         at
    java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
         at
    java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
         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:724)
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
         at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:485)
         at
    com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:523)
         at
    com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:521)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:521)
         at
    com.opensymphony.xwork2.ObjectFactory.injectInternalBeans(ObjectFactory.java:138)
         at
    com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:208)
         at
    com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:183)
         at
    com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154)
         at
    com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
         at
    com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:191)
         ... 32 more
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.reflect.InvocationTargetException
         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$ParameterInjector.inject(ContainerImpl.java:462)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:477)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
         at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
         ... 43 more
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
         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)
         ... 48 more
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.reflect.InvocationTargetException
         at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
         at
    com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:492)
         ... 53 more
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
         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$ParameterInjector.inject(ContainerImpl.java:462)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:477)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:34)
         at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
         ... 55 more
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.reflect.InvocationTargetException
         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)
         ... 60 more
    Caused by: java.lang.RuntimeException:
    java.lang.reflect.InvocationTargetException
         at
    com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:440)
         at
    com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:492)
         ... 65 more
    Caused by: java.lang.reflect.InvocationTargetException
         at
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
         at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
         at
    com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:419)
         ... 66 more
    Caused by: struts.apache.org - Class: java.net.AbstractPlainSocketImpl
    File: AbstractPlainSocketImpl.java
    Method: connect
    Line: 178 - java/net/AbstractPlainSocketImpl.java:178:-1
         at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
         at
    com.opensymphony.xwork2.validator.DefaultValidatorFileParser.parseValidatorDefinitions(DefaultValidatorFileParser.java:117)
         at
    com.opensymphony.xwork2.validator.DefaultValidatorFactory.retrieveValidatorConfiguration(DefaultValidatorFactory.java:195)
         at
    com.opensymphony.xwork2.validator.DefaultValidatorFactory.parseValidators(DefaultValidatorFactory.java:184)
         at
    com.opensymphony.xwork2.validator.DefaultValidatorFactory.<init>(DefaultValidatorFactory.java:55)
         ... 71 more
    Caused by: java.net.UnknownHostException: struts.apache.org
         at
    java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
         at java.net.Socket.connect(Socket.java:579)
         at java.net.Socket.connect(Socket.java:528)
         at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
         at sun.net.www.http.HttpClient.<init>(HttpClient.java:203)
         at sun.net.www.http.HttpClient.New(HttpClient.java:290)
         at sun.net.www.http.HttpClient.New(HttpClient.java:306)
         at
    sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:995)
         at
    sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
         at
    sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:849)
         at
    sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299)
         at
    com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:633)
         at
    com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1271)
         at
    com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1238)
         at
    com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:260)
         at
    com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1153)
         at
    com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1049)
         at
    com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:962)
         at
    com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
         at
    com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
         at
    com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
         at
    com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
         at
    com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
         at
    com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
         at
    com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
         at
    com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
         at
    com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:302)
         at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:113)
         ... 75 more

Why it tries to get DTDs from Internet while they are already exist in 
jar files?

What is the clean solution for this problem?

Thanks in advance!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message