Skip to content

Commit 3ab3ad2

Browse files
authored
Fix: fixing issues when running in a JakartaEE server. (#144)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Follow the [`CONTRIBUTING` Guide](../CONTRIBUTING.md). - [ ] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [ ] Ensure the tests pass - [ ] Appropriate READMEs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕 Signed-off-by: Emmanuel Hugonnet <[email protected]>
1 parent 94ff7d7 commit 3ab3ad2

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

sdk-jakarta/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@
4848
<dependency>
4949
<groupId>jakarta.enterprise</groupId>
5050
<artifactId>jakarta.enterprise.cdi-api</artifactId>
51+
<scope>provided</scope>
5152
</dependency>
5253
<dependency>
5354
<groupId>jakarta.inject</groupId>
5455
<artifactId>jakarta.inject-api</artifactId>
56+
<scope>provided</scope>
5557
</dependency>
5658
<dependency>
5759
<groupId>jakarta.json</groupId>

sdk-jakarta/src/main/java/io/a2a/server/apps/jakarta/A2AServerResource.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ static void setStreamingIsSubscribedRunnable(Runnable streamingIsSubscribedRunna
206206
}
207207

208208
@Provider
209-
public class JsonParseExceptionMapper implements ExceptionMapper<JsonParseException> {
209+
public static class JsonParseExceptionMapper implements ExceptionMapper<JsonParseException> {
210+
211+
public JsonParseExceptionMapper() {
212+
}
210213

211214
@Override
212215
public Response toResponse(JsonParseException exception) {
@@ -219,6 +222,9 @@ public Response toResponse(JsonParseException exception) {
219222
@Provider
220223
public static class JsonMappingExceptionMapper implements ExceptionMapper<JsonMappingException> {
221224

225+
public JsonMappingExceptionMapper(){
226+
}
227+
222228
@Override
223229
public Response toResponse(JsonMappingException exception) {
224230
if (exception.getCause() instanceof JsonParseException) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
bean-discovery-mode="annotated">
6+
</beans>

sdk-server-common/src/main/java/io/a2a/server/requesthandlers/JSONRPCHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public class JSONRPCHandler {
3838
private AgentCard agentCard;
3939
private RequestHandler requestHandler;
4040

41+
protected JSONRPCHandler() {
42+
}
43+
4144
@Inject
4245
public JSONRPCHandler(@PublicAgentCard AgentCard agentCard, RequestHandler requestHandler) {
4346
this.agentCard = agentCard;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
bean-discovery-mode="all">
6+
</beans>

0 commit comments

Comments
 (0)