Hi Petere,
thank you for suggestions, I will definetly try to do what you've 
mentioned. For now I've decided to go with default Tomcat Connection Pool 
as I have other things going on which are priority.
I'll give feedback ASAP. :)

Regards,
Nikola

уторак, 08. септембар 2020. 02.02.51 UTC+2, Peter Stackle је написао/ла:
>
> Hi Nikola,
>
> It looks to me like the following are two different projects to integrate 
> HikariCP into a Dropwizard app. I think you need to pick just one to use 
> (if you require HikariCP instead of the Tomcat JDBC connection pool 
> library). 
> - https://github.com/mtakaki/dropwizard-hikaricp
> - https://github.com/DeloitteDigitalUK/dropwizard-hikaricp
>
> It's worth pointing out that neither of these libraries are part of the 
> official Dropwizard project, which comes with out of the box integration 
> with the Tomcat JDBC Connection Pool library. 
>
> If you need HikariCP and assuming you are using the first library, it 
> looks like it provides replacement classes for a couple of the classes in 
> the dropwizard-db library (the ones that provide integration with the 
> Tomcat connection pool), but seems that it relies on the ordering of which 
> library shows up on your application's classpath first. You should make 
> sure that the com.github.mtakaki:dropwizard-hikaricp dependency shows up 
> above the io.dropwizard:dropwizard-db dependency in your application's 
> pom.xml file.
>
> Since you are using JDBI3 for your application, my suggestion would be to 
> start by following the instructions at this link: 
> https://www.dropwizard.io/en/latest/manual/jdbi3.html
> and get things working before starting to integrate HikariCP. Once you 
> have things working correctly, then introduce the 
> com.github.mtakaki:dropwizard-hikaricp dependency _above_ your 
> io.dropwizard:dropwizard-db dependency in your application's pom.xml file. 
> You can use Maven's `mvn dependency:build-classpath` command to display the 
> classpath that Maven determined and you can double check that the 
> dropwizard-hikaricp classes are loaded earlier than the dropwizard-db 
> classes. 
> You could also set breakpoints in the classes to see that the 
> correct ManagedPooledDataSource class is used. 
>
>
> On an unrelated note, in looking at your application class, I noticed that 
> you are setting up a MetricRegistry and integrating that in with a 
> JmxReporter. The Dropwizard framework has out of the box integration with 
> the Metrics library and automatically sets up a MetricRegistry and wires it 
> up with a JmxReporter. You can see that happen in the Bootstrap class: 
> https://github.com/dropwizard/dropwizard/blob/master/dropwizard-core/src/main/java/io/dropwizard/setup/Bootstrap.java#L79-L97
> This integration is what allows you to put a @Timed annotation on your 
> resource methods and get metrics automatically recorded: 
> https://www.dropwizard.io/en/latest/manual/core.html#metrics  
>
> I hope that helps,
> Peter
>
> On Monday, September 7, 2020 at 3:22:04 PM UTC-7, Nikola Stevanović wrote:
>>
>> Hi Jochen,
>> thank you for suggestion and examples. Since I'm *newbie* with 
>> Dropwizard and don't have expreince with setting up Bundles (*NEVER* 
>> done it) can you please give me some link with simple tutorial/explanation 
>> how to configure it? 
>>
>> I'm struggling to set it up cause I don't use Hibernate in my application 
>> for creating queries, but jDBI3 so Hibernate does not work for me + I'm NOT 
>> using Dependency Injection in my project so since it's small project it 
>> instantiates objects manually in *run()* method.
>> I've found code example on *this* 
>> https://github.com/DeloitteDigitalUK/dropwizard-hikaricp/tree/master/src/main/java/uk/co/deloittedigital/dropwizard/hikari
>>  
>> repo, edited my project and got this message in Console when I run my app 
>> (it compiles successfully with *mvn clean package *command*):*
>>  
>>
>>> java.lang.ClassCastException: 
>>> com.nikolas.master_thesis.DropwizardMasterThesisConfiguration cannot be 
>>> cast to com.nikolas.master_thesis.config.HikariConfigurationProvider
>>>
>>
>> ...and here are *classes* which this *message is reffering *to:
>>
>> https://github.com/nixos89/DW-Bookshop/blob/09-adding-dropwizard-metrics-jmx/src/main/java/com/nikolas/master_thesis/DropwizardMasterThesisConfiguration.java
>>
>> https://github.com/nixos89/DW-Bookshop/blob/09-adding-dropwizard-metrics-jmx/src/main/java/com/nikolas/master_thesis/config/HikariConfigurationProvider.java
>> Thank you in advance.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dropwizard-user/17b36e8f-9918-46e9-aa90-4d9ed4011962o%40googlegroups.com.

Reply via email to