File tree Expand file tree Collapse file tree
server/src/com/cloud/servlet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,13 +71,29 @@ public class ConsoleProxyServlet extends HttpServlet {
7171 @ Inject ManagementServer _ms ;
7272 @ Inject IdentityService _identityService ;
7373
74+ static AccountManager s_accountMgr ;
75+ static VirtualMachineManager s_vmMgr ;
7476 static ManagementServer s_ms ;
77+ static IdentityService s_identityService ;
78+
7579 public ConsoleProxyServlet () {
7680 }
7781
7882 @ PostConstruct
79- void initComponent () {
80- s_ms = _ms ;
83+ void initComponent () {
84+ // Servlet injection does not always work for servlet container
85+ // We use a hacking here to initialize static variables at Spring wiring time
86+ if (_accountMgr != null ) {
87+ s_accountMgr = _accountMgr ;
88+ s_vmMgr = _vmMgr ;
89+ s_ms = _ms ;
90+ s_identityService = _identityService ;
91+ } else {
92+ _accountMgr = s_accountMgr ;
93+ _vmMgr = s_vmMgr ;
94+ _ms = s_ms ;
95+ _identityService = s_identityService ;
96+ }
8197 }
8298
8399 @ Override
Original file line number Diff line number Diff line change 1919import java .net .URLEncoder ;
2020import java .util .List ;
2121
22+ import javax .annotation .PostConstruct ;
2223import javax .inject .Inject ;
2324import javax .servlet .ServletContextEvent ;
2425import javax .servlet .ServletContextListener ;
@@ -48,6 +49,27 @@ public class RegisterCompleteServlet extends HttpServlet implements ServletConte
4849 @ Inject ConfigurationDao _configDao ;
4950 @ Inject UserDao _userDao ;
5051
52+ static AccountService s_accountSvc ;
53+ static ConfigurationDao s_configDao ;
54+ static UserDao s_userDao ;
55+
56+ public RegisterCompleteServlet () {
57+ }
58+
59+ @ PostConstruct
60+ void initComponent () {
61+ // Hakcing way to make servlet injection work for now
62+ if (_accountSvc != null ) {
63+ s_accountSvc = _accountSvc ;
64+ s_configDao = _configDao ;
65+ s_userDao = _userDao ;
66+ } else {
67+ _accountSvc = s_accountSvc ;
68+ _configDao = s_configDao ;
69+ _userDao = s_userDao ;
70+ }
71+ }
72+
5173 @ Override
5274 public void contextInitialized (ServletContextEvent sce ) {
5375 }
You can’t perform that action at this time.
0 commit comments