You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by arkadyz <az...@gmail.com> on 2019/10/24 11:55:53 UTC
WSDLManager.removeDefinition method is not always working
Hi,
I am using Wildfly 11 with cxf-core-3.1.12
I put attention the method "removeDefinition" of WSDLManager doesn't always
actually remove definition.
Bus bus = BusFactory.getDefaultBus();
WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
Definition def = wsdlManager.getDefinition(wsdlLocation);
wsdlManager.removeDefinition(def);
// In most of cases returns true
wsdlManager.getDefinitions().containsKey(wsdlLocation)
Did someone face to this issue ?
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
Re: WSDLManager.removeDefinition method is not always working
Posted by arkadyz <az...@gmail.com>.
Hi, here the link to jira:
https://issues.apache.org/jira/browse/CXF-8142
Thanks,
Arkady
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
Re: WSDLManager.removeDefinition method is not always working
Posted by Colm O hEigeartaigh <co...@apache.org>.
Hi,
Could you create a JIRA instead and attach the project there? Attachments
are filtered out on the mailing list.
Colm.
On Tue, Oct 29, 2019 at 7:59 AM arkadyz <az...@gmail.com> wrote:
> Of course:
>
> 1. Following jars included:
>
> cxf-rt-wsdl-3.3.3.jar
> cxf-core-3.3.3.jar
> wsdl4j-1.6.3.jar
> woodstox-core-5.0.3.jar
> cxf-rt-transports-http-3.3.3.jar
> cxf-rt-bindings-soap-3.3.3.jar
> cxf-rt-databinding-aegis-3.3.3.jar
> cxf-rt-frontend-simple-3.3.3.jar
> stax2-api-3.1.4.jar
>
> 2. Main function:
>
> public class RemoveDefinition {
> private static String ipAddress = "10.110.108.41";
>
> public static void main(String[] args) {
> for (int i = 0; i < 5; i++) {
> SMPConfigHandler handler = new SMPConfigHandler();
> handler.removeDefinition(ipAddress);
>
> handler = new SMPConfigHandler();
> handler.removeDefinition(ipAddress);
> }
> }
>
> }
>
> 3. SMPConfigHandler class:
>
> public class SMPConfigHandler {
>
> public void removeDefinition(String ipAddress) {
>
> String wsdlLocation = "http" + "://" + ipAddress +
> "/services/SMPConfig?wsdl";
> try {
> Bus bus = BusFactory.getDefaultBus();
> WSDLManager wsdlManager =
> bus.getExtension(WSDLManager.class);
> if(wsdlManager!=null){
> Definition def =
> wsdlManager.getDefinition(wsdlLocation);
> if(def!=null){
> Long numOfOccurrences = 0l;
> Long maxOfOccurrences = 1000L;
>
>
> while(wsdlManager.getDefinitions().containsKey(wsdlLocation) &&
> numOfOccurrences<=maxOfOccurrences) {
> wsdlManager.removeDefinition(def);
> numOfOccurrences++;
> }
>
> System.out.println("Definition removed
> for: "+wsdlLocation+". Number
> of occurrences: "+numOfOccurrences+". Definition still exist:
> "+wsdlManager.getDefinitions().containsKey(wsdlLocation));
> }
>
> def = wsdlManager.getDefinition(wsdlLocation);
> ServiceSchemaInfo schemas =
> wsdlManager.getSchemasForDefinition(def);
> wsdlManager.putSchemasForDefinition(def,schemas);
> String msg = "Definition added for: "+wsdlLocation;
> System.out.println(msg);
> }
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
>
> 4. Output:
>
> Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl.
> Number
> of occurrences: 1. Definition still exist: false
> Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
> Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl.
> *Number of occurrences: 2*. Definition still exist: false
> Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
> Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl.
> *Number of occurrences: 2*. Definition still exist: false
> Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
> Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl.
> Number
> of occurrences: 1. Definition still exist: false
> Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
>
> 5. Problem description:
>
> CachMap class uses 2 internal maps which doesn't work correctly:
> WeakIdentityHashMap sometimes contains more than 1 entry for specific wsdl.
>
> Why 2 maps is needed ????
>
> 6. Suggested fix: I put these 2 internal maps to be ConcurrentHashMap and
> everything works fine.
>
> Thanks,
> Arkady
>
>
>
> --
> Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
>
Re: WSDLManager.removeDefinition method is not always working
Posted by arkadyz <az...@gmail.com>.
Of course:
1. Following jars included:
cxf-rt-wsdl-3.3.3.jar
cxf-core-3.3.3.jar
wsdl4j-1.6.3.jar
woodstox-core-5.0.3.jar
cxf-rt-transports-http-3.3.3.jar
cxf-rt-bindings-soap-3.3.3.jar
cxf-rt-databinding-aegis-3.3.3.jar
cxf-rt-frontend-simple-3.3.3.jar
stax2-api-3.1.4.jar
2. Main function:
public class RemoveDefinition {
private static String ipAddress = "10.110.108.41";
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
SMPConfigHandler handler = new SMPConfigHandler();
handler.removeDefinition(ipAddress);
handler = new SMPConfigHandler();
handler.removeDefinition(ipAddress);
}
}
}
3. SMPConfigHandler class:
public class SMPConfigHandler {
public void removeDefinition(String ipAddress) {
String wsdlLocation = "http" + "://" + ipAddress +
"/services/SMPConfig?wsdl";
try {
Bus bus = BusFactory.getDefaultBus();
WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
if(wsdlManager!=null){
Definition def = wsdlManager.getDefinition(wsdlLocation);
if(def!=null){
Long numOfOccurrences = 0l;
Long maxOfOccurrences = 1000L;
while(wsdlManager.getDefinitions().containsKey(wsdlLocation) &&
numOfOccurrences<=maxOfOccurrences) {
wsdlManager.removeDefinition(def);
numOfOccurrences++;
}
System.out.println("Definition removed for: "+wsdlLocation+". Number
of occurrences: "+numOfOccurrences+". Definition still exist:
"+wsdlManager.getDefinitions().containsKey(wsdlLocation));
}
def = wsdlManager.getDefinition(wsdlLocation);
ServiceSchemaInfo schemas = wsdlManager.getSchemasForDefinition(def);
wsdlManager.putSchemasForDefinition(def,schemas);
String msg = "Definition added for: "+wsdlLocation;
System.out.println(msg);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
4. Output:
Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl. Number
of occurrences: 1. Definition still exist: false
Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl.
*Number of occurrences: 2*. Definition still exist: false
Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl.
*Number of occurrences: 2*. Definition still exist: false
Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
Definition removed for: http://10.110.108.41/services/SMPConfig?wsdl. Number
of occurrences: 1. Definition still exist: false
Definition added for: http://10.110.108.41/services/SMPConfig?wsdl
5. Problem description:
CachMap class uses 2 internal maps which doesn't work correctly:
WeakIdentityHashMap sometimes contains more than 1 entry for specific wsdl.
Why 2 maps is needed ????
6. Suggested fix: I put these 2 internal maps to be ConcurrentHashMap and
everything works fine.
Thanks,
Arkady
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
Re: WSDLManager.removeDefinition method is not always working
Posted by Dennis Kieselhorst <ma...@dekies.de>.
Hi Arkady!
> I tested on version 3.3.3 and still has problems.
>
Can you provide us with a testcase that reproduces the issue?
Cheers
Dennis
Re: WSDLManager.removeDefinition method is not always working
Posted by arkadyz <az...@gmail.com>.
Hi, Dennis
I tested on version 3.3.3 and still has problems.
Thanks,
Arkady
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
Re: WSDLManager.removeDefinition method is not always working
Posted by Dennis Kieselhorst <ma...@dekies.de>.
Hi Arkady!
> Can you please provide link to the bug ?
>
> I would like to know which jars/classes were fixed exactly.
It started with this one https://issues.apache.org/jira/browse/CXF-5407
but additional fixes have been made in
https://issues.apache.org/jira/browse/CXF-7076 and
https://issues.apache.org/jira/browse/CXF-7824.
Best,
Dennis
Re: WSDLManager.removeDefinition method is not always working
Posted by arkadyz <az...@gmail.com>.
Hi, Dennis
Can you please provide link to the bug ?
I would like to know which jars/classes were fixed exactly.
Thanks,
Arkady
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html
Re: WSDLManager.removeDefinition method is not always working
Posted by Dennis Kieselhorst <de...@apache.org>.
Hi!
> I put attention the method "removeDefinition" of WSDLManager doesn't always
> actually remove definition.
>
> Bus bus = BusFactory.getDefaultBus();
> WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
> Definition def = wsdlManager.getDefinition(wsdlLocation);
> wsdlManager.removeDefinition(def);
>
> // In most of cases returns true
> wsdlManager.getDefinitions().containsKey(wsdlLocation)
>
> Did someone face to this issue ?
There was a bug in the past and multiple fixes have been made since then. Could you please try 3.1.18 or even better 3.3.3 which is the latest release?
Best,
Dennis