MDB Activation Properties

2024-06-20 Thread chege
Hi,

I have tried deploying this mdb in tomee 8.0.15 but keeps failing.

MDB

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "useJndi", propertyValue =
"false"),
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "getnews"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "initialRedeliveryDelay",
propertyValue = "6"),
@ActivationConfigProperty(propertyName = "maximumRedeliveries",
propertyValue = "20"),
@ActivationConfigProperty(propertyName =
"redeliveryBackOffMultiplier", propertyValue = "2"),
@ActivationConfigProperty(propertyName =
"redeliveryUseExponentialBackOff", propertyValue = "true")
})
public class A implements MessageListener {

@Override
public void onMessage(Message msg) {



}

}


tomee.xml


# Do not start the embedded ActiveMQ broker
BrokerXmlConfig  =
ServerUrl = tcp://localhost:61616


Error:

Caused by: org.apache.openejb.OpenEJBException: Unable to create
activation spec: No setter found for the activation spec properties:
[RedeliveryUseExponentialBackOff, redeliveryBackOffMultiplier]


Acccording to the error [redeliveryBackOffMultiplier,
redeliveryUseExponentialBackOff] are unknown.

I am refering to this documentation
https://tomee.apache.org/latest/docs/jms-resources-and-mdb-container.html

What I am doing wrong?

Chege



Jsonb issue. Converter Required to Unmarshall Primitive Types

2022-08-23 Thread chege

Hi,

I have a simple use case where I want convert json to pojo.
All values are quoted including booleans, longs and ints.
Jsonb specification says parse$Type e.g parseInt
or
parseBoolean shall be used. These methods can take string arguments.

https://jakarta.ee/specifications/jsonb/3.0/jakarta-jsonb-spec-3.0.html#java-lang-byte-short-integer-long-float-double

I have a unit test that produces the error.


javax.json.bind.JsonbException: Missing a Converter for type int to convert the 
JSON String '20' . Please register a custom converter for it.
at ke.mbote.jsonb.ClientTest.test(ClientTest.java:23)
Caused by: org.apache.johnzon.mapper.MapperException: Missing a Converter for 
type int to convert the JSON String '20' . Please register a custom converter 
for it.
at ke.mbote.jsonb.ClientTest.test(ClientTest.java:23)


The test can be found athttps://github.com/chegekinuthia/jsonbissue.git


@Named
public class Client {

@Inject
private Jsonb jsonb;

public Book getBook() {
String book = "{\"id\":\"20\",\"published\":\"true\"}";
return jsonb.fromJson(book, Book.class);

}

}


@Classes(cdi = true, value = {Client.class, Book.class, Config.class})
@RunWith(org.apache.openejb.junit.ApplicationComposer.class)
public class ClientTest extends TestCase {

@Inject
private Client client;

@Test
public void test() throws Exception {

Book book = client.getBook();
assertEquals(20, book.getId());
assertTrue(book.isPublished());

}
}

What am I missing?


JSON-B Adapter Not Invoked

2020-06-15 Thread chege

Hi,

I am facing a problem where jsonb adapter is not invoked.
Here is a simplified case.

jaxrs application
---

@ApplicationPath("/app")
public class App extends Application{

}

adapter


public class B implements JsonbAdapter {

@Override
public JsonObject adaptToJson(Book obj) throws Exception {
return Json.createObjectBuilder()
.add("customfield", obj.getId() + " " + obj.getTitle())
.build();
}

@Override
public Book adaptFromJson(JsonObject obj) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
//To change body of generated methods, choose Tools | Templates.
}

}

dto

public class Book {

private int id;
private String title;

public Book() {
}

public Book(int id, String title) {
this.id = id;
this.title = title;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

}

resource
---

@Path("/r")
public class R {

@GET
@Produces({MediaType.APPLICATION_JSON})
public Response response() {
Book book = new Book(100, "Apache Tomee");
JsonbConfig config = new JsonbConfig()
.withFormatting(true)
.withAdapters(new B());
Jsonb jsonb = JsonbBuilder.create(config);
String toJson = jsonb.toJson(book);
return Response.ok(toJson).build();
}

}

What am i missing?

Thanks.



Tomee 8.0.1 Plume. Enable Selected MicroProfile APIs

2020-05-23 Thread chege

Hi,

I am running my applications on Tomee 8.0.1 plume. Microprofile config
works out of box however, rest client doesn't work out of box.

I compared with microprofile release which has all microprofile apis
working out of box.

How do I enable/disable microprofile apis


Tomee 8.0.1 Plume. Enable Selected MicroProfile APIs

2020-05-23 Thread chege

Hi,

I am running my applications on Tomee 8.0.1 plume. Microprofile config
works out of box however, rest client doesn't work out of box.

I compared with microprofile release which has all microprofile apis
working out of box.

How do I enable/disable microprofile apis when using plume/plus releases?

Thanks.


How can I Help?

2019-01-03 Thread chege
Hi,

I am Chege. I'd like to help with Tomee. I am Java EE/Spring Developer
based in Kenya. I would like to start small and learn my way up.

Thanks.


How can I help?

2019-01-01 Thread Chege Kĩnũthia
Hi,

I am Chege, a freelance Java developer based in Thika, Kenya. I have no
experience in developing application servers. I look forward in
starting small and learning my way up.

I have been developing Java EE and Spring  applications and  since
2012.

Thanks,
Chege.