Fixed the XMLResolver's IOException of JDK 1.5 in XMLResolver bundle
--------------------------------------------------------------------

                 Key: SMX4-325
                 URL: https://issues.apache.org/activemq/browse/SMX4-325
             Project: ServiceMix 4
          Issue Type: Improvement
            Reporter: Willem Jiang


I'm using the servicemix bundle of xmlresolver 1.2 bundle in apache camel for 
testing the camel-cxf component with PAX-Exam  (JDK 1.5).

When I try to publish a CXF endpoint, the init process will block about 60 
second, and throw a ConnectionException.

>From the stack trace, it looks like the CatalogManager is trying to open a 
>connection of FTP.

After digging the code , I found the Catalog using the URL with the "file" 
protocol header to open the InputStream.
So I did a quick fix for it by using the FileInputStream to open the file.
The original code n Catalog line 852
{code}
      inStream = new DataInputStream(base.openStream());
{code}

My change in Catalog line 852
{code}
        // using FileInputStream instand of URL.openStream()
        // to walk around the file open timeout issue
        File f;
        try {
            f = new File(base.toURI());
        } catch(Exception e) {
            f = new File(base.getPath());
        }
        inStream = new DataInputStream(new FileInputStream(f));

{code}
  

[RMI TCP Connection(1)-192.168.0.158] INFO 
org.springframework.beans.factory.support.DefaultListableBeanFactory - 
Pre-instantiating singletons in 
org.springframework.beans.factory.support.defaultlistablebeanfact...@ed9d72: 
defining beans 
[cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.
corba.CorbaBindingFactory,org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister#0,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxws.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.javascript.JavascriptQueryHandlerRegistry,org.apache.cxf.transport.local.LocalTransportFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.management.Instr
umentationManager,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory,org.apache.cxf.transport.jms.JMSTransportFactory,org.apache.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.binding.http.HttpBindingFactory,org.apache.cxf.jaxrs.JAXRSBindingFactory,org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.policy.PolicyBuilder,org.apache.cxf.ws.policy.PolicyEngine,org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider,org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider,org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder,org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.RMPolicyI
nterceptorProvider,org.apache.cxf.ws.rm.RMAssertionBuilder]; root of factory 
hierarchy
java.net.ConnectException: Operation timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:520)
    at java.net.Socket.connect(Socket.java:470)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.NetworkClient.openServer(NetworkClient.java:118)
    at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
    at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
    at 
sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
    at 
sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
    at java.net.URL.openStream(URL.java:1007)
    at org.apache.xml.resolver.Catalog.parseCatalogFile(Catalog.java:852)
    at org.apache.xml.resolver.Catalog.parsePendingCatalogs(Catalog.java:756)
    at org.apache.xml.resolver.Catalog.parseCatalog(Catalog.java:604)
    at org.apache.xml.resolver.Catalog.loadSystemCatalogs(Catalog.java:579)
    at 
org.apache.xml.resolver.CatalogManager.getPrivateCatalog(CatalogManager.java:695)
    at 
org.apache.xml.resolver.CatalogManager.getCatalog(CatalogManager.java:722)
    at 
org.apache.xml.resolver.tools.CatalogResolver.initializeCatalogs(CatalogResolver.java:93)
    at 
org.apache.xml.resolver.tools.CatalogResolver.<init>(CatalogResolver.java:88)
    at 
org.apache.cxf.catalog.OASISCatalogManager.getResolver(OASISCatalogManager.java:69)
    at 
org.apache.cxf.catalog.OASISCatalogManager.<init>(OASISCatalogManager.java:58)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
    at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
    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:222)
    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:429)
    at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at 
org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:91)
    at 
org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)
    at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
    at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:86)
    at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)
    at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:53)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to