I have an FW / 1 application on Railo 4.2.2 / Apache and for some reason it calls onApplicationStartfor every request. I can say that this is not some kind of reinitialization code - add a dump callStackGet()to setupApplicationand see that the root call is onApplicationStart (not through any initialization hook). Are there any known errors in Railo that can cause this? I double-checked the application timeout (1 day) and the FW / 1 setting - it is disabled - so there should be no reason why the application will lose the application area for each request.
There is another strange thing that I also see, but I do not know what this is connected. In the setup application, I create a new user object (via ORM) and save it if the local administrator does not exist. I unload it and see the ID, but it is not in the database when I query the table (yes, I blushed it). The following snapshot of the page creates the user again (since he does not exist yet ...).
Edit: Add object code for Adam.
function setupApplication() {
var bf = new framework.ioc( "/com/sharp/model" );
setBeanFactory( bf );
ormReload();
if( getEnvironment() == 'dev' ){
writeLog('Checking for dev user');
if( !arrayLen( ormExecuteQuery('from User where username = ?', ['admin']) ) ){
var user = new com.sharp.model.user.User({username: 'admin', password: hash('p@ssw3rd'), isAdmin: true});
entitySave( user );
ormFlush();
writeDump(user);
writeDump(callStackGet());
writeLog('User admin created')
}
else{
var user = bf.getBean('userService').getByUsername('admin');
writeLog('Dev admin user already exists. Done.')
}
var auth = bf.getBean('userService').authenticate( 'admin', 'p@ssw3rd' );
}
}
source
share