migrating plugins to killbill 0.24.0

130 views
Skip to first unread message

Roger Parkinson

unread,
Mar 1, 2023, 11:13:01 PM3/1/23
to Kill Bill users mailing-list
My existing plugins get rejected with a class not found error looking for javax.servlet.Servlet. Stack looks like this:

j.l.ClassNotFoundException: javax.servlet.Servlet not found by nz.co.billrush.billrush-invoice-notification-plugin [4]  
o.a.f.f.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)  
o.a.f.f.BundleWiringImpl.access$300(BundleWiringImpl.java:79)  
o.a.f.f.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)  
j.lang.ClassLoader.loadClass(ClassLoader.java:522)... 34 common frames omitted\nWrapped by: j.l.NoClassDefFoundError: javax/servlet/Servlet  
java.lang.Class.getDeclaredConstructors0(Class.java)  
java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)  
java.lang.Class.getConstructor0(Class.java:3342)  java.lang.Class.newInstance(Class.java:556)
 o.a.f.f.Felix.createBundleActivator(Felix.java:4780)
  o.a.f.f.Felix.activateBundle(Felix.java:2410)...

I figured I would need to rebuild them with j17 and the latest killbill-oss-parent (0.146.7) but I run into problems.

I use async-http-client to send messages to other servers, but that dependency requires com.sun.activation:jakarta.activation:jar:1.2.2 and the enforcer calls that a banned dependency.

Is there another http client I should use instead? I picked up async-http-client earlier because it seemed to be already embedded.

thanks

Reshma Bidikar

unread,
Mar 2, 2023, 8:10:16 AM3/2/23
to Kill Bill users mailing-list
Hello Roger,

You would need to rebuild your plugin with Java 11. With regards to the com.sun.activation:jakarta.activation:jar: dependency, you could try one of the following:
1. Skip the enforcer check while building the plugin (Using -Dcheck.fail-enforcer=false)
2. Specify the dependency as a bannedDependency in the enforcer plugin. See an example here.
2. Exclude the dependency from your pom. See an example here.

Let us know how it goes.

Regards,
Reshma

Reshma Bidikar

unread,
Mar 6, 2023, 6:27:19 AM3/6/23
to Roger Parkinson, killbill...@googlegroups.com

+ killbill-mailing-list

Hi Roger,

Glad to know that your issue is resolved. Could you please elaborate what you mean by the following:

> Then it was waiting for a localhost: connection URL which isn't there, and this was supposed to be embedded.

Does the test require a database connection URL after upgrading to the testing-mysql-server library?

Regards,
Reshma


On Mon, 6 Mar 2023 at 07:03, Roger Parkinson <ro...@bill-rush.com> wrote:
I overrode the config for the analyze plugin that was triggering the above errors and included the three libraries it was complaining about. My understanding is that now these are unused (but for some reason required) and we don't care.
After that it got through a lot of the build and up to some tests. However one of my tests extends

org.killbill.billing.plugin.TestWithEmbeddedDBBase

and something has shifted around there. I added dependency
        <dependency>
   <groupId>org.kill-bill.testing</groupId>
   <artifactId>testing-mysql-server</artifactId>
            <scope>test</scope>
        </dependency>
Then it seemed to be looking for a jdbc driver, so I added that to the dependencies.
Then it was waiting for a localhost: connection URL which isn't there, and this was supposed to be embedded.
I set the test to @Ignore at that point. Sad to lose the test.
After that I had to upgrade the slf4j version to 1.7.36
and the build succeeded.


On Mon, 6 Mar 2023 at 12:44, Roger Parkinson <ro...@bill-rush.com> wrote:
I moved to J11 and then I found I had messages like these:

[ERROR] Rule 2: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:Failed while enforcing RequireUpperBoundDeps.

The error(s) are [Require upper bound dependencies error for io.netty:netty-common:4.1.51.Final
similar for netty-common, woodstox-core, and reactive-streams.
So I added explicit dependencies for those with the version it wanted. Those messages went away and were replaced with these:

[ERROR] Unused declared dependencies found:
[ERROR] org.reactivestreams:reactive-streams:jar:1.0.3:compile
[ERROR] com.fasterxml.woodstox:woodstox-core:jar:6.3.1:compile
[ERROR] io.netty:netty-common:jar:4.1.84.Final:compile

which seems to mean it both does and does not require those dependencies.
I also added an explicit dependency for Servlet, and that has worked. But I still have those unused declared dependencies to solve



--
You received this message because you are subscribed to a topic in the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/killbilling-users/2PrsgXtdVDA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to killbilling-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/f66b2a9e-12e4-4555-9660-0f795017417dn%40googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Roger Parkinson

unread,
Mar 12, 2023, 5:56:33 PM3/12/23
to Kill Bill users mailing-list
The test in question extends TestWithEmbeddedDBBase and uses embeddedDB.getDataSource() to find the data source.
Previously this supplied an embedded (in-memory) database but it now seems to want an external one.
There isn't an external db available when I run unit tests so the test fails. I have turned off that test for now
but I would like to understand what changed and what I need to do to get the previous behaviour.
Thanks

Reshma Bidikar

unread,
Mar 15, 2023, 12:19:12 AM3/15/23
to Kill Bill users mailing-list
Hi Roger,

Thanks for sharing these details, let me find out more about this, and I'll get back to you.

Regards,
Reshma

Reshma Bidikar

unread,
Mar 15, 2023, 1:08:41 AM3/15/23
to Kill Bill users mailing-list
Hi Roger,

I'm still finding out more about this, but quick question, did you specify the org.killbill.billing.dbi.test.useLocalDb=true property while running your test?

Regards,
Reshma

Roger Parkinson

unread,
Mar 15, 2023, 8:03:22 PM3/15/23
to Kill Bill users mailing-list
I am now. But it does not seem to help. What it looks like from the log is it tries to start mysqldb (though I'm not sure how) externally and waits for it, but it doesn't start.

This is the start of my test showing setting the property

public class PNZDaoImplTest extends TestWithEmbeddedDBBase {


    @BeforeMethod(groups = "slow")
    public void setUp() throws SQLException, IOException {
    dao = new PNZDaoImpl(embeddedDB.getDataSource());
    }

@DataProvider(name = "test1")
public Object[][] createData1() {
return new Object[][] { { "org.killbill.billing.dbi.test.useLocalDb", Boolean.TRUE } };
}

@Test(dataProvider = "test1")
public void testPaymentMethod() {
....

This is what I see in the logs.

2023-03-15T23:57:51.698+0000 [main] INFO org.killbill.billing.platform.test.PlatformDBTestingHelper - Using MySQL as the embedded database
2023-03-15T23:57:51.709+0000 [main] INFO org.killbill.testing.mysql.TestingMySqlServer - Will start MySQL server for testing with database: [mydb_bc13831b] at: jdbc:mysql://localhost:45271/<see-previous-db-list>?user=myuser_e0ecc6b9&password=mypass_b4f08e44&useSSL=false&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true&allowMultiQueries=true&permitMysqlScheme=true
2023-03-15T23:57:51.713+0000 [main] INFO org.killbill.testing.mysql.EmbeddedMySql - Starting MySQL server in /tmp/testing-mysql-server377184978341017956
2023-03-15T23:57:55.870+0000 [main] INFO org.killbill.testing.mysql.EmbeddedMySql - mysqld started on port 45271. Waiting up to 10.00s for startup to finish.
2023-03-15T23:57:56.104966Z 0 [Warning] [MY-011068] [Server] The syntax '--ssl=off' is deprecated and will be removed in a future release. Please use --tls-version='' instead.
2023-03-15T23:57:56.105086Z 0 [System] [MY-010116] [Server] /tmp/testing-mysql-server377184978341017956/bin/mysqld (mysqld 8.0.31) starting as process 2160557
2023-03-15T23:57:56.119463Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-15T23:57:56.251094Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-03-15T23:57:56.491663Z 0 [Warning] [MY-013829] [Server] Missing data directory for ICU regular expressions: /tmp/testing-mysql-server377184978341017956/lib/private/.
2023-03-15T23:57:56.494969Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2023-03-15T23:57:56.532997Z 0 [System] [MY-010931] [Server] /tmp/testing-mysql-server377184978341017956/bin/mysqld: ready for connections. Version: '8.0.31'  socket: '/tmp/testing-mysql-server377184978341017956/mysql.sock'  port: 45271  MySQL Community Server - GPL.
2023-03-15T23:58:06.492+0000 [main] INFO org.mortbay.log - Logging to org.slf4j.impl.SimpleLogger(org.mortbay.log) via org.mortbay.log.Slf4jLog
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.fasterxml.jackson.module.afterburner.util.MyClassLoader (file:/home/roger/.m2/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.10.1/jackson-module-afterburner-2.10.1.jar) to method java.lang.ClassLoader.findLoadedClass(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.module.afterburner.util.MyClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2023-03-15T23:58:07.553+0000 [main] INFO org.killbill.billing.plugin.paymentsnz.PaymentPluginApiImpl - purchasePayment invoice 1 returning PROCESSED PaymentTransactionInfoPluginImpl PaymentTransactionInfoPluginImpl{amount=165.88, createdDate=2023-03-15T23:58:07.550Z, currency=NZD, effectiveDate=2017-06-05T15:15:22.000Z, firstPaymentReferenceId='73434aec-fdad-40f0-ba19-4130d1c7cb96-001', gatewayError=null, gatewayErrorCode=null, kbPaymentId=2064d06f-510b-4391-a98f-b873c481d576, kbTransactionPaymentId=dde15dc9-ee18-43f0-b0ef-ff80cbb2b5ab, properties=[PluginProperty{key='URL', value=http://localhost:8080, isUpdatable=false}, PluginProperty{key='URL1', value=http://localhost:8080, isUpdatable=false}, PluginProperty{key='audience', value=http://localhost:8080, isUpdatable=false}, PluginProperty{key='gatewayName', value=ASB, isUpdatable=false}, PluginProperty{key='clientId', value=s6BhdRkqt3, isUpdatable=false}, PluginProperty{key='clientSecret', value=s6BhdRkqt3, isUpdatable=false}, PluginProperty{key='consentId', value=73434aec-fdad-40f0-ba19-4130d1c7cb96, isUpdatable=false}, PluginProperty{key='id', value=ASB:73434aec-fdad-40f0-ba19-4130d1c7cb96, isUpdatable=false}, PluginProperty{key='idempotencyKey', value=idempotencyKey, isUpdatable=false}, PluginProperty{key='correlationId', value=correlationId, isUpdatable=false}, PluginProperty{key='instructionIdentification', value=SplxlOBeZQQYbYS6WxSbIA, isUpdatable=false}, PluginProperty{key='code', value=SplxlOBeZQQYbYS6WxSbIA, isUpdatable=false}, PluginProperty{key='successRedirectUrl', value=http://localhost/whatever, isUpdatable=false}, PluginProperty{key='IPCD_INVOICE_ID', value=057c95be-2d92-4950-8cc3-cd221468d1a1, isUpdatable=false}, PluginProperty{key='singleAmount', value=100, isUpdatable=false}, PluginProperty{key='totalAmount', value=100, isUpdatable=false}, PluginProperty{key='totalCount', value=12, isUpdatable=false}, PluginProperty{key='enduring', value=false, isUpdatable=false}, PluginProperty{key='kbInvoiceId', value=1, isUpdatable=false}, PluginProperty{key='gatewaypaymentId', value=73434aec-fdad-40f0-ba19-4130d1c7cb96-001, isUpdatable=false}], secondPaymentReferenceId=null, status=PROCESSED, transactionType=PURCHASE}
2023-03-15T23:58:07.685+0000 [main] INFO org.killbill.billing.plugin.paymentsnz.JWTHelperTest - export ASSERTION="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJacXBFdUFCRmZsWHdzTHhyYU1qeGJBbVhpcTVNaVlaNCIsInN1YiI6IlpxcEV1QUJGZmxYd3NMeHJhTWp4YkFtWGlxNU1pWVo0IiwibmJmIjoxNjc4OTI0Njg3LCJleHAiOjE2Nzg5MjgyODcsImlhdCI6MTY3ODkyNDY4NywiYXVkIjoiaHR0cHM6Ly9hcGkuYXBpY2VudHJlLm1pZGRsZXdhcmUuY28ubnovbWlkZGxld2FyZS1uei1zYW5kYm94L3YyLjAvb2F1dGgvdG9rZW4iLCJqdGkiOiIxYjJkZDdjNS1mMzU0LTQ1MDAtYTQ4OC0zMmU4Y2NhZjIwMjEifQ.QCQZPTd2JxOdpl7gGE0flLmd_Lw5HCRvDWuiQLtgXH9zohZ3gCiqXkIGWIy3J0fLH20zl5BN2Ec48gcEmeSpLE6MQT1KPHREHpZ88VlQTxNTbVRaG3P8qsQ6pRdWCSSU-4axRiKL9F_cw3zGMw25RFtlTcMo5MH8dvyV3BqYK9wKyuJJgJNOPImoWhJAdVE5yF91DDDTUSNrfjdyQnbmliJGF_CX5sa0FWEQgi6TlSI0aM9_6fTGDFiO-uBLEn4k29a0Le2yEIiuwlK3KjYMVnRyAjCc1tgxavvHzyxIUrVEAR_eASNYaV76BX0DZ4y9OMtpDyAw3gGfoe0Liy-Cehqusm6neZa_jM_DIQXAWF9JbYb_nOizA_A6GVDUtCE-BhA5lRcZr7ciakCknp6oCDqbw3dPVeXKxG4zAZ8Qd8ee_WzvkzdNsj-qb2bw3OAtmAU70HkB5UcQLwkijoybmU4c2jpjK5ZCsv2iP52MgVAbsoCACADusaM_A6Vsndd3WpWAvq5tAfpYoy5kVK8g8Q1JOl_MuQ7QI8nFG98pGaiLgbZROllZFb8SxNdkgnqdmn8jmnl_au11Rxdd9fX-14mmfU47sPXJFkztlrYf1TI7kLhudXc9HbvhPQd3DDwNR-eY9Iy7UOGSNKsP3fn_XL1O7GG2KTLqjjqv4hWRfwA"
2023-03-15T23:58:07.686+0000 [main] INFO org.killbill.billing.plugin.paymentsnz.JWTHelperTest - code 41656370
2023-03-15T23:58:07.686+0000 [main] INFO org.killbill.billing.plugin.paymentsnz.JWTHelperTest - state f73f7ea8
2023-03-15T23:58:07.699+0000 [main] INFO org.killbill.billing.plugin.paymentsnz.JWTHelperTest - export ASSERTION="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJacXBFdUFCRmZsWHdzTHhyYU1qeGJBbVhpcTVNaVlaNCIsInN1YiI6IlpxcEV1QUJGZmxYd3NMeHJhTWp4YkFtWGlxNU1pWVo0IiwibmJmIjoxNjc4OTI0Njg3LCJleHAiOjE2Nzg5MjgyODcsImlhdCI6MTY3ODkyNDY4NywiYXVkIjoiaHR0cHM6Ly9hcGktbm9tYXRscy5hcGljZW50cmUubWlkZGxld2FyZS5jby5uei9taWRkbGV3YXJlLW56LXNhbmRib3gvdjIuMC9vYXV0aC90b2tlbiIsImp0aSI6ImU5ZDg1YWZlLTY4Y2MtNDdjYS05MjlmLWU4M2E2ZGEzOTVjYSJ9.dXWSiOcg08CY04fT--izHJlJazwWpRKRbEmq7xmCZhBTv0LRrfAjHTP0RHm-Tiz_0yPXji13GnRAf3yhfvtbTBsVhUWwo8VftonXNx18qgU6E0XfXTUxxvxRxonf91WeT6ak2ytQQYQFTJtpte7EC0OsW7XOFywqzFuW13RcFyn6gNkKYkbvGz4GOdtysqjJsefiPPRZrNdqr4x51ui-UqWzORlKtW4blim20r1lC9TEVuQ_3uBO2vFCArcI_IFpRQH6jJs_ReTFwn6WralIMF3fUcCl8KlJ0kTpralhTaPz4YjowV5Ug7HhqG6nBq20XoSP-qsdkSE5NYAqOrwSasDI9sXj4JbkpBkHUkyYHBz_RKJzpwC2QXTazcdNsACnEkIHbKTGWHjvqIvoTn2ThqzeM4wvFxBl4dKUYKNiletT7lAs51sMKW0fEvyhDZ4y1lVIYyR5fzSsN2XqKsqjFL4QgDqbZw828Vq8Q9VYahb5OeOk2d8g6iEB92fpV0wIkbg6LVvVbi9aAKKrq4EeKUuQtLWWoQs3JbRwqqMV3RPPdJuc2hMQVewqoMBTBqoZu3y3THdAz7TTuvP-V8AjJBReWuG0IcT6WGo_Gh0DWjJnMiKm16LidLbs6ZgvxWZ0-ICwkHP770nW55yUSS_--3ePkCSDrenePqzXSCoulrY"
[ [1;31mERROR [m] [1;31mTests [0;1mrun: [0;1m10 [m, [1;31mFailures: [0;1;31m2 [m, Errors: 0, [1;33mSkipped: [0;1;33m1 [m, Time elapsed: 16.303 s [1;31m <<< FAILURE! [m - in [1mTestSuite [m
[ [1;31mERROR [m] org.killbill.billing.plugin.paymentsnz.PNZDaoImplTest.setUpBeforeClass  Time elapsed: 14.508 s  <<< FAILURE!
java.io.IOException: java.io.IOException: mysqld failed to start after 10.00s

Reshma Bidikar

unread,
Mar 16, 2023, 7:51:21 AM3/16/23
to Kill Bill users mailing-list
Hi Roger,

I'm still discussing this internally but just FYI,  the org.killbill.billing.dbi.test.useLocalDb=true property specifies that an external database should be used.  If you would like an embedded MySQL DB to be used, you should not specify this property.

Regards,
Reshma

xsalefter

unread,
Mar 16, 2023, 1:37:56 PM3/16/23
to Kill Bill users mailing-list
Hi Roger,

This log line:

2023-03-15T23:57:51.709+0000 [main] INFO org.killbill.testing.mysql.TestingMySqlServer - Will start MySQL server for testing with database: [mydb_bc13831b] at: jdbc:mysql://localhost:45271/<see-previous-db-list>?user=myuser_e0ecc6b9&password=mypass_b4f08e44&useSSL=false&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true&allowMultiQueries=true&permitMysqlScheme=true

Indicate that you already running test with embedded MySQL database. "org.killbill.testing.mysql.TestingMySqlServer" comes from our own MySQL embedded testing.

It is possible that the problem is in our end, but I would suggest you to check whether embedded database actually running successfully in your machine. As embedded database will closed once test completed, maybe you can check by run testing using debugging option and set breakpoints somewhere before test ended.

Roger Parkinson

unread,
Mar 20, 2023, 6:13:13 PM3/20/23
to Kill Bill users mailing-list
Part of my problem is that I really needed postgres rather than mysql running. I now have it running by adding:

@DataProvider(name = "test1")
public Object[][] createData1() {
return new Object[][] {
{ "org.killbill.billing.dbi.test.useLocalDb", "true" } ,
{ "org.killbill.billing.dbi.test.postgresql", "true" }
};
}

@Test(dataProvider = "test1")
public void testPaymentMethod(String arg1, String arg2) {
...

So now it looks for a locally running postgres database and talks to that. I need to go back to the prev version and see how this used to work because I am pretty sure I didn't need an external db running. But this works well enough for now and I can verify my db code writes to the tables okay etc.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages