New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JAXB Unmarshaller not unlocking after failure #3238
Comments
Confirmed. Now need to figure out how to fix... |
OK. I found that It was probably fixed in some later Java version, but it really still fails for me on Java 8 on Windows... I will try to workaround it with an explicit |
Fixes spring-projects#3238 * Extract an `InputStream` from a `File` payload in the `UnmarshallingTransformer` before parsing an XML. Close this `InputStream` in the `finally` block to release the file resource **Cherry-pick to 5.2.x, 5.1.x & 4.3.x**
The fix is not reviewed yet. |
Fixes #3238 * Extract an `InputStream` from a `File` payload in the `UnmarshallingTransformer` before parsing an XML. Close this `InputStream` in the `finally` block to release the file resource **Cherry-pick to 5.2.x, 5.1.x & 4.3.x**
Fixes #3238 * Extract an `InputStream` from a `File` payload in the `UnmarshallingTransformer` before parsing an XML. Close this `InputStream` in the `finally` block to release the file resource **Cherry-pick to 5.2.x, 5.1.x & 4.3.x** # Conflicts: # spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/UnmarshallingTransformer.java # spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java
Fixes #3238 * Extract an `InputStream` from a `File` payload in the `UnmarshallingTransformer` before parsing an XML. Close this `InputStream` in the `finally` block to release the file resource **Cherry-pick to 5.2.x, 5.1.x & 4.3.x** # Conflicts: # spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/UnmarshallingTransformer.java # spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java # Conflicts: # spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/UnmarshallingTransformer.java # spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java
Fixed according merged PR with an appropriate back-port to all the supported versions. |
Thanks very much for the fast turn-around! FYI - I was using Java 10 (the 'last chance saloon' before Java 11 and modules), not 8. I managed to work around the problem by adding a |
Thanks, @lafual , for feedback! So, sounds like the problem remains in the Java 10 as well, but anyway we can't rely on the latest Java version because of backward compatibility with existing application based on our Spring artifacts. Nice trick with the |
Hi,
In Windows I am reading a file that "should" contain XML using
@InboundChannelAdapter FileReadingMesageSource
and passing on to@Transformer UnmarshallingTransformer
.If the un-marshall works, the correct object is forwarded. When the XML is invalid or not the file didn't contain XML a
MessageTransformerException
is forwarded.When the un-marshall is successful, the incoming file is un-locked and I can remove it from the incoming directory. However, when I get a
MessageTransformerException
the file's lock is not released. When I try to move it getjava.nio.file.FileSystemException: The process cannot access the file because it is being used by another process
In the
FileReadingMessageSource
I have tried withoutsetLocker
,setLocker
withNIOFileLocker
and an implementation ofFileLocker
which creates an additional file with a.locked
extension. None of these solutions work.I am using the following to Transform;
How do I cause the lock to be released?
Shouldn't the transformer somehow share/re-use the lock of the original file reader? It seems as if it is using its own locking and not releasing after failure.
The text was updated successfully, but these errors were encountered: