-
1. Re: How to create static hashmap to reflect txt file on server startup jboss 7.1.0
lafr Dec 30, 2012 2:26 PM (in response to niraz)Don't understand completely.
Creating the hashmap should not be the problem for someone familiar with java.
When talking about EJBs, look up annontations @Singleton @Startup to create a single instance of a stateless session bean started on deployment / start up of the application.
Then it's not necessary to create a static hashmap. You can create a hashmap as a "normal" instance variable.
And possibly @PostActivate for the method to put your code for initialization into.
-
2. Re: How to create static hashmap to reflect txt file on server startup jboss 7.1.0
nickarls Dec 31, 2012 3:34 AM (in response to lafr)1 of 1 people found this helpfulWhen the application is deployed, the server side stuff (singleton) is probably initalized before the web parts so before the web app context has been initialized its going to be unavailable (regardless of the singleton). Nothing to do about that.
-
3. Re: How to create static hashmap to reflect txt file on server startup jboss 7.1.0
niraz Dec 31, 2012 3:41 AM (in response to nickarls)Thanks Nicklas, that was my bad.. the jsp didn't come up because of other projects in the worksapce.
-
4. Re: How to create static hashmap to reflect txt file on server startup jboss 7.1.0
niraz Dec 31, 2012 4:29 AM (in response to lafr)...Then it's not necessary to create a static hashmap. You can create a hashmap as a "normal" instance variable...
I don't totally understand how it works. How can I reach the hashmap I created (not static) in the @Singleton @Startup class?
-
5. Re: How to create static hashmap to reflect txt file on server startup jboss 7.1.0
nickarls Dec 31, 2012 4:33 AM (in response to niraz)You can just @EJB (or @Inject) inject it and have access to the instance.