This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 85737
Collapse All | Expand All

(-)serverplugins/weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentFactory.java (-1 / +1 lines)
Lines 122-128 Link Here
122
        }
122
        }
123
    }
123
    }
124
    
124
    
125
    private DeploymentManager getDM(String uri, String username, String password, String host, String port) throws DeploymentManagerCreationException {
125
    static DeploymentManager getDM(String uri, String username, String password, String host, String port) throws DeploymentManagerCreationException {
126
        if (WLDebug.isEnabled()) {
126
        if (WLDebug.isEnabled()) {
127
            WLDebug.notify(WLDeploymentFactory.class, "getDM, uri:" + uri+" username:" + username+" password:"+password+" host:"+host+" port:"+port);
127
            WLDebug.notify(WLDeploymentFactory.class, "getDM, uri:" + uri+" username:" + username+" password:"+password+" host:"+host+" port:"+port);
128
        }
128
        }
(-)serverplugins/weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentManager.java (-64 / +76 lines)
Lines 148-153 Link Here
148
        return process;
148
        return process;
149
    }
149
    }
150
    
150
    
151
    private DeploymentManager getDM() throws IllegalStateException {
152
        try {
153
            return WLDeploymentFactory.getDM(uri, username, password, host, port);
154
        } catch (DeploymentManagerCreationException e) {
155
            throw new IllegalStateException(e);
156
        }
157
    }
158
    
151
    public ProgressObject distribute(Target[] target, File file, File file2) 
159
    public ProgressObject distribute(Target[] target, File file, File file2) 
152
            throws IllegalStateException {
160
            throws IllegalStateException {
153
        if (WLDebug.isEnabled()) // debug output
161
        if (WLDebug.isEnabled()) // debug output
Lines 159-177 Link Here
159
            return new WLDeployer(uri).deploy(target, file, file2, getHost(), getPort());
167
            return new WLDeployer(uri).deploy(target, file, file2, getHost(), getPort());
160
        } else {
168
        } else {
161
            //weblogic jsr88 version
169
            //weblogic jsr88 version
162
            modifiedLoader();
170
            ClassLoader currentLoader = modifiedLoader();
163
            try {
171
            try {
164
                return new DelegatingProgressObject(dm.distribute(target, file, file2));
172
                return new DelegatingProgressObject( getDM().distribute(target, file, file2));
165
            } finally {
173
            } finally {
166
                originalLoader();
174
                originalLoader(currentLoader);
167
            }
175
            }
168
        }
176
        }
169
    }
177
    }
170
    
178
    
171
    private ClassLoader swapLoader;
179
//    private ClassLoader swapLoader;
172
    
180
    
173
    private void modifiedLoader() {
181
    private ClassLoader modifiedLoader() {
174
        swapLoader = Thread.currentThread().getContextClassLoader();
182
        ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
175
        String serverRoot = getInstanceProperties().getProperty(WLPluginProperties.SERVER_ROOT_ATTR);
183
        String serverRoot = getInstanceProperties().getProperty(WLPluginProperties.SERVER_ROOT_ATTR);
176
        // if serverRoot is null, then we are in a server instance registration process, thus this call
184
        // if serverRoot is null, then we are in a server instance registration process, thus this call
177
        // is made from InstanceProperties creation -> WLPluginProperties singleton contains 
185
        // is made from InstanceProperties creation -> WLPluginProperties singleton contains 
Lines 180-188 Link Here
180
            serverRoot = WLPluginProperties.getInstance().getInstallLocation();
188
            serverRoot = WLPluginProperties.getInstance().getInstallLocation();
181
189
182
        Thread.currentThread().setContextClassLoader(WLDeploymentFactory.getWLClassLoader(serverRoot));
190
        Thread.currentThread().setContextClassLoader(WLDeploymentFactory.getWLClassLoader(serverRoot));
191
        return currentLoader;
183
    }
192
    }
184
    private void originalLoader() {
193
    
185
        Thread.currentThread().setContextClassLoader(swapLoader);
194
    private void originalLoader(ClassLoader currentLoader) {
195
        if (currentLoader != null) {
196
            Thread.currentThread().setContextClassLoader(currentLoader);
197
        }
186
    }
198
    }
187
    
199
    
188
    /**
200
    /**
Lines 217-227 Link Here
217
        if (WLDebug.isEnabled()) // debug output
229
        if (WLDebug.isEnabled()) // debug output
218
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
230
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
219
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
231
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
220
        modifiedLoader();
232
        ClassLoader currentLoader = modifiedLoader();
221
        try {
233
        try {
222
            return new DelegatingProgressObject(dm.redeploy(targetModuleID, inputStream, inputStream2));
234
            return new DelegatingProgressObject(getDM().redeploy(targetModuleID, inputStream, inputStream2));
223
        } finally {
235
        } finally {
224
            originalLoader();
236
            originalLoader(currentLoader);
225
        }
237
        }
226
    }
238
    }
227
239
Lines 235-245 Link Here
235
        if (WLDebug.isEnabled()) // debug output
247
        if (WLDebug.isEnabled()) // debug output
236
            WLDebug.notify("distribute(" + target + ", " +             // NOI18N
248
            WLDebug.notify("distribute(" + target + ", " +             // NOI18N
237
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
249
                    inputStream + ", " + inputStream2 + ")");          // NOI18N
238
        modifiedLoader();
250
        ClassLoader currentLoader = modifiedLoader();
239
        try {
251
        try {
240
            return new DelegatingProgressObject(dm.distribute(target, inputStream, inputStream2));
252
            return new DelegatingProgressObject(getDM().distribute(target, inputStream, inputStream2));
241
        } finally {
253
        } finally {
242
            originalLoader();
254
            originalLoader(currentLoader);
243
        }
255
        }
244
    }
256
    }
245
257
Lines 252-262 Link Here
252
            throws IllegalStateException {
264
            throws IllegalStateException {
253
        if (WLDebug.isEnabled()) // debug output
265
        if (WLDebug.isEnabled()) // debug output
254
            WLDebug.notify("undeploy(" + targetModuleID + ")");        // NOI18N
266
            WLDebug.notify("undeploy(" + targetModuleID + ")");        // NOI18N
255
        modifiedLoader();
267
        ClassLoader currentLoader = modifiedLoader();
256
        try {
268
        try {
257
            return new DelegatingProgressObject(dm.undeploy(targetModuleID));
269
            return new DelegatingProgressObject(getDM().undeploy(targetModuleID));
258
        } finally {
270
        } finally {
259
            originalLoader();
271
            originalLoader(currentLoader);
260
        }
272
        }
261
    }
273
    }
262
274
Lines 270-280 Link Here
270
        if (WLDebug.isEnabled()) // debug output
282
        if (WLDebug.isEnabled()) // debug output
271
            WLDebug.notify("stop(" + targetModuleID + ")");            // NOI18N
283
            WLDebug.notify("stop(" + targetModuleID + ")");            // NOI18N
272
                
284
                
273
        modifiedLoader();
285
        ClassLoader currentLoader = modifiedLoader();
274
        try {
286
        try {
275
            return new DelegatingProgressObject(dm.stop(targetModuleID));
287
            return new DelegatingProgressObject(getDM().stop(targetModuleID));
276
        } finally {
288
        } finally {
277
            originalLoader();
289
            originalLoader(currentLoader);
278
        }
290
        }
279
    }
291
    }
280
292
Lines 288-298 Link Here
288
        if (WLDebug.isEnabled()) // debug output
300
        if (WLDebug.isEnabled()) // debug output
289
            WLDebug.notify("start(" + targetModuleID + ")");           // NOI18N
301
            WLDebug.notify("start(" + targetModuleID + ")");           // NOI18N
290
        
302
        
291
        modifiedLoader();
303
        ClassLoader currentLoader = modifiedLoader();
292
        try {
304
        try {
293
            return new DelegatingProgressObject(dm.start(targetModuleID));
305
            return new DelegatingProgressObject(getDM().start(targetModuleID));
294
        } finally {
306
        } finally {
295
            originalLoader();
307
            originalLoader(currentLoader);
296
        }
308
        }
297
    }
309
    }
298
310
Lines 307-318 Link Here
307
            WLDebug.notify("getAvailableModules(" + moduleType +       // NOI18N
319
            WLDebug.notify("getAvailableModules(" + moduleType +       // NOI18N
308
                    ", " + target + ")");                              // NOI18N
320
                    ", " + target + ")");                              // NOI18N
309
        
321
        
310
        modifiedLoader();
322
        ClassLoader currentLoader = modifiedLoader();
311
        try {
323
        try {
312
            TargetModuleID t[] = dm.getAvailableModules(moduleType, target);
324
            TargetModuleID t[] = getDM().getAvailableModules(moduleType, target);
313
            return t;
325
            return t;
314
        } finally {
326
        } finally {
315
            originalLoader();
327
            originalLoader(currentLoader);
316
        }
328
        }
317
    }
329
    }
318
330
Lines 327-341 Link Here
327
            WLDebug.notify("getNonRunningModules(" + moduleType +      // NOI18N
339
            WLDebug.notify("getNonRunningModules(" + moduleType +      // NOI18N
328
                    ", " + target + ")");                              // NOI18N
340
                    ", " + target + ")");                              // NOI18N
329
        
341
        
330
        modifiedLoader();
342
        ClassLoader currentLoader = modifiedLoader();
331
        try {
343
        try {
332
            TargetModuleID t[] = dm.getNonRunningModules(moduleType, target);
344
            TargetModuleID t[] = getDM().getNonRunningModules(moduleType, target);
333
            for (int i=0; i < t.length; i++) {
345
            for (int i=0; i < t.length; i++) {
334
                System.out.println("non running module:" + t[i]);
346
                System.out.println("non running module:" + t[i]);
335
            }
347
            }
336
            return t;
348
            return t;
337
        } finally {
349
        } finally {
338
            originalLoader();
350
            originalLoader(currentLoader);
339
        }
351
        }
340
    }
352
    }
341
353
Lines 350-364 Link Here
350
            WLDebug.notify("getRunningModules(" + moduleType +         // NOI18N
362
            WLDebug.notify("getRunningModules(" + moduleType +         // NOI18N
351
                    ", " + target + ")");                              // NOI18N
363
                    ", " + target + ")");                              // NOI18N
352
        
364
        
353
        modifiedLoader();
365
        ClassLoader currentLoader = modifiedLoader();
354
        try {
366
        try {
355
            TargetModuleID t[] = dm.getRunningModules(moduleType, target);
367
            TargetModuleID t[] = getDM().getRunningModules(moduleType, target);
356
            for (int i=0; i < t.length; i++) {
368
            for (int i=0; i < t.length; i++) {
357
                System.out.println("running module:" + t[i]);
369
                System.out.println("running module:" + t[i]);
358
            }
370
            }
359
            return t;
371
            return t;
360
        } finally {
372
        } finally {
361
            originalLoader();
373
            originalLoader(currentLoader);
362
        }
374
        }
363
    }
375
    }
364
376
Lines 374-384 Link Here
374
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
386
            WLDebug.notify("redeploy(" + targetModuleID + ", " +       // NOI18N
375
                    file + ", " + file2 + ")");                        // NOI18N
387
                    file + ", " + file2 + ")");                        // NOI18N
376
        
388
        
377
        modifiedLoader();
389
        ClassLoader currentLoader = modifiedLoader();
378
        try {
390
        try {
379
            return new DelegatingProgressObject(dm.redeploy(targetModuleID, file, file2));
391
            return new DelegatingProgressObject(getDM().redeploy(targetModuleID, file, file2));
380
        } finally {
392
        } finally {
381
            originalLoader();
393
            originalLoader(currentLoader);
382
        }
394
        }
383
    }
395
    }
384
    
396
    
Lines 391-401 Link Here
391
        if (WLDebug.isEnabled()) // debug output
403
        if (WLDebug.isEnabled()) // debug output
392
            WLDebug.notify("setLocale(" + locale + ")");               // NOI18N
404
            WLDebug.notify("setLocale(" + locale + ")");               // NOI18N
393
        
405
        
394
        modifiedLoader();
406
        ClassLoader currentLoader = modifiedLoader();
395
        try {
407
        try {
396
            dm.setLocale(locale);
408
            getDM().setLocale(locale);
397
        } finally {
409
        } finally {
398
            originalLoader();
410
            originalLoader(currentLoader);
399
        }
411
        }
400
    }
412
    }
401
413
Lines 408-418 Link Here
408
        if (WLDebug.isEnabled()) // debug output
420
        if (WLDebug.isEnabled()) // debug output
409
            WLDebug.notify("isLocaleSupported(" + locale + ")");       // NOI18N
421
            WLDebug.notify("isLocaleSupported(" + locale + ")");       // NOI18N
410
        
422
        
411
        modifiedLoader();
423
        ClassLoader currentLoader = modifiedLoader();
412
        try {
424
        try {
413
            return dm.isLocaleSupported(locale);
425
            return getDM().isLocaleSupported(locale);
414
        } finally {
426
        } finally {
415
            originalLoader();
427
            originalLoader(currentLoader);
416
        }
428
        }
417
    }
429
    }
418
430
Lines 428-438 Link Here
428
            WLDebug.notify("setDConfigBeanVersion(" +                  // NOI18N
440
            WLDebug.notify("setDConfigBeanVersion(" +                  // NOI18N
429
                    dConfigBeanVersionType + ")");                     // NOI18N
441
                    dConfigBeanVersionType + ")");                     // NOI18N
430
        
442
        
431
        modifiedLoader();
443
        ClassLoader currentLoader = modifiedLoader();
432
        try {
444
        try {
433
            dm.setDConfigBeanVersion(dConfigBeanVersionType);
445
            getDM().setDConfigBeanVersion(dConfigBeanVersionType);
434
        } finally {
446
        } finally {
435
            originalLoader();
447
            originalLoader(currentLoader);
436
        }
448
        }
437
    }
449
    }
438
450
Lines 447-457 Link Here
447
            WLDebug.notify("isDConfigBeanVersionSupported(" +          // NOI18N
459
            WLDebug.notify("isDConfigBeanVersionSupported(" +          // NOI18N
448
                    dConfigBeanVersionType + ")");                     // NOI18N
460
                    dConfigBeanVersionType + ")");                     // NOI18N
449
        
461
        
450
        modifiedLoader();
462
        ClassLoader currentLoader = modifiedLoader();
451
        try {
463
        try {
452
            return dm.isDConfigBeanVersionSupported(dConfigBeanVersionType);
464
            return getDM().isDConfigBeanVersionSupported(dConfigBeanVersionType);
453
        } finally {
465
        } finally {
454
            originalLoader();
466
            originalLoader(currentLoader);
455
        }
467
        }
456
    }
468
    }
457
469
Lines 464-470 Link Here
464
        if (WLDebug.isEnabled()) // debug output
476
        if (WLDebug.isEnabled()) // debug output
465
            WLDebug.notify("release()");                               // NOI18N
477
            WLDebug.notify("release()");                               // NOI18N
466
        
478
        
467
        modifiedLoader();
479
        ClassLoader currentLoader = modifiedLoader();
468
        try {
480
        try {
469
            if (dm != null) {
481
            if (dm != null) {
470
                // delegate the call and clear the stored deployment manager
482
                // delegate the call and clear the stored deployment manager
Lines 479-485 Link Here
479
                }
491
                }
480
            }
492
            }
481
        } finally {
493
        } finally {
482
            originalLoader();
494
            originalLoader(currentLoader);
483
        }
495
        }
484
    }
496
    }
485
497
Lines 492-502 Link Here
492
        if (WLDebug.isEnabled()) // debug output
504
        if (WLDebug.isEnabled()) // debug output
493
            WLDebug.notify("isRedeploySupported()");                   // NOI18N
505
            WLDebug.notify("isRedeploySupported()");                   // NOI18N
494
        
506
        
495
        modifiedLoader();
507
        ClassLoader currentLoader = modifiedLoader();
496
        try {
508
        try {
497
            return dm.isRedeploySupported();
509
            return getDM().isRedeploySupported();
498
        } finally {
510
        } finally {
499
            originalLoader();
511
            originalLoader(currentLoader);
500
        }
512
        }
501
    }
513
    }
502
514
Lines 509-519 Link Here
509
        if (WLDebug.isEnabled()) // debug output
521
        if (WLDebug.isEnabled()) // debug output
510
            WLDebug.notify("getCurrentLocale()");                      // NOI18N
522
            WLDebug.notify("getCurrentLocale()");                      // NOI18N
511
        
523
        
512
        modifiedLoader();
524
        ClassLoader currentLoader = modifiedLoader();
513
        try {
525
        try {
514
            return dm.getCurrentLocale();
526
            return getDM().getCurrentLocale();
515
        } finally {
527
        } finally {
516
            originalLoader();
528
            originalLoader(currentLoader);
517
        }
529
        }
518
    }
530
    }
519
531
Lines 526-536 Link Here
526
        if (WLDebug.isEnabled()) // debug output
538
        if (WLDebug.isEnabled()) // debug output
527
            WLDebug.notify("getDConfigBeanVersion()");                 // NOI18N
539
            WLDebug.notify("getDConfigBeanVersion()");                 // NOI18N
528
540
529
        modifiedLoader();
541
        ClassLoader currentLoader = modifiedLoader();
530
        try {
542
        try {
531
            return dm.getDConfigBeanVersion();
543
            return dm.getDConfigBeanVersion();
532
        } finally {
544
        } finally {
533
            originalLoader();
545
            originalLoader(currentLoader);
534
        }
546
        }
535
    }
547
    }
536
548
Lines 543-553 Link Here
543
        if (WLDebug.isEnabled()) // debug output
555
        if (WLDebug.isEnabled()) // debug output
544
            WLDebug.notify("getDefaultLocale()");                      // NOI18N
556
            WLDebug.notify("getDefaultLocale()");                      // NOI18N
545
        
557
        
546
        modifiedLoader();
558
        ClassLoader currentLoader = modifiedLoader();
547
        try {
559
        try {
548
            return dm.getDefaultLocale();
560
            return dm.getDefaultLocale();
549
        } finally {
561
        } finally {
550
            originalLoader();
562
            originalLoader(currentLoader);
551
        }
563
        }
552
    }
564
    }
553
565
Lines 560-570 Link Here
560
        if (WLDebug.isEnabled()) // debug output
572
        if (WLDebug.isEnabled()) // debug output
561
            WLDebug.notify("getSupportedLocales()");                   // NOI18N
573
            WLDebug.notify("getSupportedLocales()");                   // NOI18N
562
        
574
        
563
        modifiedLoader();
575
        ClassLoader currentLoader = modifiedLoader();
564
        try {
576
        try {
565
            return dm.getSupportedLocales();
577
            return dm.getSupportedLocales();
566
        } finally {
578
        } finally {
567
            originalLoader();
579
            originalLoader(currentLoader);
568
        }
580
        }
569
    }
581
    }
570
582
Lines 577-587 Link Here
577
        if (WLDebug.isEnabled()) // debug output
589
        if (WLDebug.isEnabled()) // debug output
578
            WLDebug.notify("getTargets()");                            // NOI18N
590
            WLDebug.notify("getTargets()");                            // NOI18N
579
        
591
        
580
        modifiedLoader();
592
        ClassLoader currentLoader = modifiedLoader();
581
        try {
593
        try {
582
            return dm.getTargets();
594
            return getDM().getTargets();
583
        } finally {
595
        } finally {
584
            originalLoader();
596
            originalLoader(currentLoader);
585
        }
597
        }
586
    }
598
    }
587
    
599
    

Return to bug 85737