[ 
http://issues.ops4j.org/jira/browse/PAXRUNNER-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_10945
 ] 

Stuart McCulloch commented on PAXRUNNER-85:
-------------------------------------------

BTW, because we don't know the name of the field where the factory is kept 
(it's implementation specific) we would need to loop over the fields in the URL 
class and look for ones with type URLStreamHandlerFactory - seems a bit hacky 
but it's the only viable workaround that I'm aware of.

> Handle cases where a URLStreamHandlerFactory is already installed
> -----------------------------------------------------------------
>
>                 Key: PAXRUNNER-85
>                 URL: http://issues.ops4j.org/jira/browse/PAXRUNNER-85
>             Project: Pax Runner
>          Issue Type: Improvement
>          Components: handler
>    Affects Versions: 0.5.5
>            Reporter: Stuart McCulloch
>            Assignee: Alin Dreghiciu
>
> As reported by Hendy: when provisioning using NetBeans, an exception occurs 
> because NB has already installed its own URLStreamHandlerFactory:
> java.lang.Error: factory already defined
>         at java.net.URL.setURLStreamHandlerFactory(URL.java:1076)
>         at 
> org.ops4j.pax.runner.handler.internal.URLStreamHandlerExtender.start 
> (URLStreamHandlerExtender.java:67)
>         at 
> org.ops4j.pax.runner.handler.internal.Activator.start(Activator.java:66)
>         at org.ops4j.pax.runner.Run.createActivator(Run.java:405)
>         at org.ops4j.pax.runner.Run.installHandlers (Run.java:175)
>         at org.ops4j.pax.runner.Run.start(Run.java:134)
>         at org.ops4j.pax.runner.Run.main(Run.java:481)
> Quick fix is to catch this exception and simply continue (although this will 
> definitely limit the available functionality) - a better solution, which is 
> used in several applications, is to use reflection to forcibly update the 
> URLStreamHandlerFactory with the Pax-Runner factory and delegate to the 
> original factory for unknown protocols...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to