Skip to content

java.lang.NoSuchMethodError: No static method newFactory() Ljavax/xml/stream/XMLInputFactory #283

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

Closed
samimejri opened this issue Feb 8, 2025 · 10 comments
Labels
bug Something isn't working

Comments

@samimejri
Copy link
Contributor

samimejri commented Feb 8, 2025

I am working on an android app using semantic kernel and I have this issue that I have been battling for 2 days now. In the semantic kernel code, the use of the newFactory() static method for prompt parsing is the root cause. I think this is not needed and newInstance() can do the job.

This github issue is talking about the problem I am facing but in another library: FasterXML/jackson-dataformat-xml#533

I have this issue when I use invokePromptAsync() but not when I use getChatMessageContentsAsync().

The problem is easy to reproduce, create a new project in android studio and use any sample that has a call to invokePromptAsync()

@karianna
Copy link
Member

karianna commented Feb 9, 2025

@samimejri Can you send in the snippet of code you're executing?

@samimejri
Copy link
Contributor Author

Thanks for responding.
Here is a repo that I made to share this issue: https://github.com/samimejri/SKTest

The problem occurs at runtime. When launching the app you will get this error:

Image

@karianna karianna added bug Something isn't working and removed Waiting on OP labels Feb 10, 2025
@johnoliver
Copy link
Member

@samimejri have you tried adding the stax-api dependency to your project:

<dependency>
  <groupId>javax.xml.stream</groupId>
  <artifactId>stax-api</artifactId>
  <version>1.0-2</version>
</dependency>

@samimejri
Copy link
Contributor Author

samimejri commented Feb 11, 2025

https://github.com/samimejri/SKTest/blob/master/app/build.gradle.kts

stax-api is already added in the dependencies. It DOES NOT RESOLVE the issue. The implementation of stax-api does not have the static newFactory() method.

Like I said, using the newInstance() method instead newFactory() here will resolve the issue for Android.

@johnoliver
Copy link
Member

@samimejri yeah I agree moving it to newInstance should fix it

@samimejri
Copy link
Contributor Author

Do you want me to create a pull request? I am no java/kotlin expert but the change seems to be simple enough!

@karianna
Copy link
Member

Do you want me to create a pull request? I am no java/kotlin expert but the change seems to be simple enough!

Yes please!

@samimejri
Copy link
Contributor Author

Do you want me to create a pull request? I am no java/kotlin expert but the change seems to be simple enough!

Yes please!

Sorry but I am not permitted to push code to this repo.

@karianna
Copy link
Member

Do you want me to create a pull request? I am no java/kotlin expert but the change seems to be simple enough!

Yes please!

Sorry but I am not permitted to push code to this repo.

Can you fork this repo and create a PR?

@samimejri
Copy link
Contributor Author

Do you want me to create a pull request? I am no java/kotlin expert but the change seems to be simple enough!

Yes please!

Sorry but I am not permitted to push code to this repo.

Can you fork this repo and create a PR?

Sorry for the delay! I created the pull request.

It's my first open source project contribution and the first java code I touched in years... Please bear with me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants