Ah, yeah…that’d do it. Interesting failure mode. I would have expected
configuration validation to fail before things get that far, but maybe the
database name isn’t declared as a required field.

Ryan

On Sun, Aug 8, 2021 at 4:02 PM Dondell Batac <[email protected]> wrote:

> Hi Ryan,
>
> I got the issue fixed now. The issue is because there is a missing value
> on my config.yml. I forgot to supply my databaseName field a value.
>
> database:
> driverClass: com.microsoft.sqlserver.jdbc.SQLServerDriver
> user: xx
> password: xxxxxxx!
> url: jdbc:sqlserver://xxx.xxx.xx.xxx:xxxx
> maxWaitForConnection: 1s
> validationQuery: "/* MyService Health Check */ SELECT 1"
> validationQueryTimeout: 3s
> minSize: 4
> maxSize: 16
>
> checkConnectionWhileIdle: true
>
> evictionInterval: 10s
> properties:
> databaseName:
> characterEncoding: UTF-8
> charSet: UTF-8
> hibernate.dialect: org.hibernate.dialect.SQLServer2012Dialect
> hibernate.enable_lazy_load_no_trans: true
>
> Thanks,
>
> Dondell
> On Monday, August 9, 2021 at 6:50:25 AM UTC+8 Dondell Batac wrote:
>
>> Hi Ryan,
>>
>> Actually I have tried this code below and still I got same error.
>>
>> private final HibernateBundle<ExampleConfiguration> hibernate = new
>> HibernateBundle<ExampleConfiguration>(Person.class) {
>>     @Override
>>     public DataSourceFactory getDataSourceFactory(ExampleConfiguration
>> configuration) {
>>         return configuration.getDataSourceFactory();
>>     }
>> };
>>
>> Dondell
>>
>> On Monday, August 9, 2021 at 4:05:57 AM UTC+8 [email protected] wrote:
>>
>>> I think the problem is that you’re constructing an empty
>>> SessionFactoryFactory rather than including it as part of your
>>> configuration.
>>>
>>> It looks like you’re manually creating these classes. Usually folks will
>>> drive creation via the Dropwizard configuration mechanism. e.g
>>> https://www.dropwizard.io/en/latest/manual/hibernate.html
>>>
>>> I suspect doing it the way you’re doing it is bypassing some default
>>> values that would otherwise be set by Jackson or it’s skipping some
>>> validation that would point out that you’ve left off a required field.
>>>
>>> Ryan
>>>
>>> On Sun, Aug 8, 2021 at 3:43 AM Dondell Batac <[email protected]>
>>> wrote:
>>>
>>>> Hi Ryan,
>>>>
>>>> I am new to Dropwizard. Can you point out what are those configuration
>>>> that is being passed to my hibernate bundle?
>>>>
>>>> This is my code for my hibernatebundle:
>>>> private final HibernateBundle<TardisConfiguration> hibernate = new
>>>> ScanningHibernateBundle<TardisConfiguration>(new String[] {
>>>> "com.my.package.hibernateEntities"}, new SessionFactoryFactory())
>>>> {
>>>> public DataSourceFactory getDataSourceFactory(TardisConfiguration
>>>> configuration)
>>>> {
>>>> return configuration.getDatabase();
>>>> }
>>>> };
>>>>
>>>> Thanks
>>>>
>>>> On Friday, August 6, 2021 at 8:48:20 AM UTC+8 [email protected] wrote:
>>>>
>>>>> If I had to guess, some piece of configuration passed to your
>>>>> hibernate bundle has a null value in it:
>>>>>
>>>>>
>>>>> https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#put-K-V-
>>>>>
>>>>> Ryan
>>>>>
>>>>> On Thu, Aug 5, 2021 at 4:34 PM Dondell Batac <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I have issue when running the application.
>>>>>>
>>>>>> I don't have clue which causes this issue.
>>>>>>
>>>>>> java.lang.NullPointerException
>>>>>>     at
>>>>>> java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
>>>>>>     at
>>>>>> java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
>>>>>>     at java.base/java.util.Properties.put(Properties.java:1334)
>>>>>>     at java.base/java.util.Properties.setProperty(Properties.java:229)
>>>>>>     at
>>>>>> io.dropwizard.db.DataSourceFactory.build(DataSourceFactory.java:872)
>>>>>>     at
>>>>>> io.dropwizard.hibernate.SessionFactoryFactory.build(SessionFactoryFactory.java:40)
>>>>>>     at
>>>>>> io.dropwizard.hibernate.HibernateBundle.run(HibernateBundle.java:74)
>>>>>>     at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:183)
>>>>>>     at
>>>>>> io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
>>>>>>     at
>>>>>> io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
>>>>>>     at io.dropwizard.cli.Cli.run(Cli.java:79)
>>>>>>     at io.dropwizard.Application.run(Application.java:94)
>>>>>>     at
>>>>>> com.fulcrumgt.tardis.TardisApplication.main(TardisApplication.java:87)
>>>>>>
>>>>>> --
>>>>>> 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/f21b8bac-a2fb-47cb-b99a-e9cdf8892f2an%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/dropwizard-user/f21b8bac-a2fb-47cb-b99a-e9cdf8892f2an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> 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/7843d7fd-8729-484b-a031-22ba0d355517n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/dropwizard-user/7843d7fd-8729-484b-a031-22ba0d355517n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> 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/db3adc10-1325-4438-9123-32814b4b275bn%40googlegroups.com
> <https://groups.google.com/d/msgid/dropwizard-user/db3adc10-1325-4438-9123-32814b4b275bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFVYhL8iVvKuHWujB5XHr40AUxhtAgy7w7Pi%2Bz0RiFUdQO2qkg%40mail.gmail.com.

Reply via email to