I am getting this error when I try to deploy the app on jboss server
INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./ifs: java.lang.NoSuchFieldError: ALLOW_TRAILING_COMMA
I am using cosmosdb dependency
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>4.50.0</version>
</dependency>
My client code is below
public class CosmosDBService {
private CosmosClient client;
private CosmosDatabase database;
private CosmosContainer container;
public CosmosDBService(String endpoint, String key, String databaseName, String containerName) {
client = new CosmosClientBuilder()
.endpoint(endpoint)
.key(key)
.buildClient();
database = client.getDatabase(databaseName);
container = database.getContainer(containerName);
}
public void saveEventData(EventData eventData) {
CosmosItemResponse<EventData> response = container.upsertItem(eventData);
System.out.println("Item upserted with status code: " + response.getStatusCode());
}
}
The above code is working fine on its own, when I make a jar and use it in another project which is a ant project, then I get the above error.
I am calling the CosmosDBService constructor from a class which is present in the same jar. That class is initialized by my Jboss.
Below is the class
public class EventHubConsumerListener implements ServletContextListener {
private CosmosDBService cosmosDBService;
@Override
public void contextInitialized(ServletContextEvent sce) {
System.out.println("inside contextInitialized method");
cosmosDBService = new CosmosDBService("endpoint",
"key", "databaseName", "containerName");
startMonitoring();
}
}
I can see maven is downloading jackson dependencies 2.13.5
I tried finding dependency conflicts, but I did not find it in the project
I also tried below code
ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true);