[ 
https://issues.apache.org/jira/browse/AXIS2-4614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829987#action_12829987
 ] 

Ilja Gnezdilov commented on AXIS2-4614:
---------------------------------------

this issue not goof.  because it is trash 'current' directory. 

imho, better doing so:

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            InputStream is = cl.getResourceAsStream("addressing-1.4.1.mar");
            //если в ресурсах есть нужный нам mar'ник
            if (is != null) {
                //то записываем его во временный файл
                File addressing = File.createTempFile("addressing",".mar");
                addressing.deleteOnExit();
                FileOutputStream fos = new FileOutputStream(addressing);
                byte[] b = new byte[1];
                while(is.read(b)>0) {
                    fos.write(b);
                }
                is.close();
                fos.close();
                //запоминаем путь к нему 
                URL url = addressing.toURL();
                //создаем загрузчик классов по тому урлу
                URLClassLoader urlloader = new URLClassLoader(new 
URL[]{url},cl);
                //и проставляем в качестве основного
                Thread.currentThread().setContextClassLoader(urlloader);
            }
            //загружаем аксивским способом модуль
            ConfigurationContext myConfigContext = 
                
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, 
null);
            serviceClient = new ServiceClient(myConfigContext, null);
            //подключение модуля адресации
            serviceClient.engageModule("addressing");
            serviceClient.setOptions(options);        
        } finally {
            //и в конце концов возвращаем на родину старый загрузчик классов
            Thread.currentThread().setContextClassLoader(cl);
        }


> Modules not loaded by axis2 when run inside a Java Web Start application
> ------------------------------------------------------------------------
>
>                 Key: AXIS2-4614
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4614
>             Project: Axis2
>          Issue Type: Bug
>          Components: modules
>    Affects Versions: 1.5.1
>         Environment: server: OS AIX, ibm jre "1.5.0" build pap32dev-20080315 
> (SR7), web stack oc4j 10.1.3.4
> client: winxp sp2, sun jre1.6.0_16
>            Reporter: casper
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> We have a Java Web Start (JWS) application that uses axis2 generate soap 
> proxies. We are using the rampart module to provide security headers for the 
> soap requests.
> The problem is, the addressing module does not get loaded when our 
> application is run from within JWS.
> It works fine from within eclipse, loading the module from the classpath, but 
> not from JWS.
> My assumption is, that the axis2 module loading works from a custom class 
> loader that is not being used when run from within a JWS application.
> java.lang.RuntimeException: <snip>: java.lang.RuntimeException: 
> org.apache.axis2.AxisFault: The system is attempting to engage a module that 
> is not available: addressingjava.lang.RuntimeException: <snip>: 
> java.lang.RuntimeException: org.apache.axis2.AxisFault: The system is 
> attempting to engage a module that is not available: addressing
> <snip>
>       at java.awt.event.InvocationEvent.dispatch(Unknown Source)
>       at java.awt.EventQueue.dispatchEvent(Unknown Source)
>       at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>       at java.awt.EventDispatchThread.run(Unknown Source)
> Caused by: <snip>: java.lang.RuntimeException: org.apache.axis2.AxisFault: 
> The system is attempting to engage a module that is not available: addressing
> <snip>
>       ... 15 more
> Caused by: java.lang.RuntimeException: org.apache.axis2.AxisFault: The system 
> is attempting to engage a module that is not available: addressing
> <snip>
>       ... 18 more
> Caused by: org.apache.axis2.AxisFault: The system is attempting to engage a 
> module that is not available: addressing
>       at 
> org.apache.axis2.deployment.URLBasedAxisConfigurator.getAxisConfiguration(URLBasedAxisConfigurator.java:78)
>       at 
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
>       at 
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromURIs(ConfigurationContextFactory.java:194)
>       ... 19 more

-- 
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