2011-06-09 88 views
2

我從我的weblogic 8.1環境複製了一個代碼,並複製到我的新環境weblogic 10.3.4中。遵循和平的代碼是在我的8.1環境中工作。並且當我使用相同的代碼時,它給了我以下例外。MalformedURL讀取文件時發生異常

代碼

String xmlPath="e:\\domains\\devdamsdomain\\j2ee\\configurations\\dcd\\dams\\common\\interfaceconfig.xml"; 
    log.info("xmlpath" + xmlPath); 
    SAXBuilder saxBuilder = new SAXBuilder(); 
    log.info("creating SAXBuilder"); 
    Document document = saxBuilder.build(xmlPath); 

例外是如下:

INFO [orabpel.invoke.pool-4.thread-12] (SubRegistration_ptClient.java:76) - exception occured: unknown protocol: e 
java.net.MalformedURLException: unknown protocol: e 
     at java.net.URL.<init>(URL.java:574) 
     at java.net.URL.<init>(URL.java:464) 
     at java.net.URL.<init>(URL.java:413) 
     at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:250) 
     at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:222) 
     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453) 
     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:891) 
     at com.ura.proxy.subregistration.proxy.SubRegistration_ptClient.callSubRegistration_process(SubRegistration_ptClient.java:68) 
     at com.ura.dams.registration.businesscontrol.SubRegControlImpl.clientRequestwithReturn(SubRegControlImpl.java:19) 
     at com.ura.dams.registration.process.RegistrationUpload.objSubRegClientRequestwithReturn(RegistrationUpload.java:137) 
     at orabpel.registrationupload.ExecLetBxExe7.execute(ExecLetBxExe7.java:208) 
     at com.collaxa.cube.engine.ext.bpel.common.wmp.BPELxExecWMP.__executeStatements(BPELxExecWMP.java:42) 
     at com.collaxa.cube.engine.ext.bpel.common.wmp.BaseBPELActivityWMP.perform(BaseBPELActivityWMP.java:162) 
     at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:2465) 
     at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1132) 
     at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:73) 
     at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:219) 
     at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:327) 
     at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:4350) 
     at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:4281) 
     at com.collaxa.cube.engine.CubeEngine._createAndInvoke(CubeEngine.java:713) 
     at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:545) 
     at com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke(DeliveryService.java:654) 
     at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke(CubeDeliveryBean.java:355) 
     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.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) 
     at com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104) 

     at oracle.security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:88) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313) 
     at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414) 
     at oracle.security.jps.wls.JpsWeblogicEjbInterceptor.runJaasMode(JpsWeblogicEjbInterceptor.java:61) 
     at oracle.security.jps.ee.ejb.JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:106) 
     at oracle.security.jps.ee.ejb.JpsInterceptor.intercept(JpsInterceptor.java:106) 
     at sun.reflect.GeneratedMethodAccessor1264.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) 
     at com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:69) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) 

     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
     at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37) 
     at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54) 
     at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
     at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) 

     at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) 
     at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
     at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
     at $Proxy250.handleInvoke(Unknown Source) 
     at com.collaxa.cube.engine.ejb.impl.bpel.BPELDeliveryBean_5k948i_ICubeDeliveryLocalBeanImpl.handleInvoke(BPELDeliveryBean_5k948i_ICubeDelivery 
LocalBeanImpl.java:462) 
     at com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessageHandler.handle(InvokeInstanceMessageHandler.java:35) 
     at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:141) 
     at com.collaxa.cube.engine.dispatch.BaseDispatchTask.run(BaseDispatchTask.java:82) 
     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:619) 

請某物建議我。

+0

構造函數期待一個URI,當你給它它想要的或者你使用'build(new File(xmlPath))'方法時會發生什麼? – 2011-06-09 14:51:36

回答

8

您使用的方法接受URL的字符串表示,並且e:不是根據所述URL格式的有效協議(它也可以這樣處理,因爲它是第一個冒號之前)

您有多個選項要解決這個問題:

  • 使用.build(new File(path))(最好)
  • 添加的文件協議file://e/etc..(解決眼前的問題)
1

您可以試試file:///e:/domains/...

0

如前所述,這是因爲格式錯誤的文件路徑。解決方案是使用類似的路徑。

document = builder.parse(new File(<pathtoberead>).toURI().toString()); 
相關問題