Start associated ClassLoader and implement the requirements of org.apache.catalina.util.LifecycleBase#startInternal(). @exception LifecycleException if this component detects a fatal error that prevents this component from being used
()
| 315 | * used |
| 316 | */ |
| 317 | @Override |
| 318 | protected void startInternal() throws LifecycleException { |
| 319 | |
| 320 | if (log.isDebugEnabled()) { |
| 321 | log.debug(sm.getString("webappLoader.starting")); |
| 322 | } |
| 323 | |
| 324 | if (context.getResources() == null) { |
| 325 | log.info(sm.getString("webappLoader.noResources", context)); |
| 326 | setState(LifecycleState.STARTING); |
| 327 | return; |
| 328 | } |
| 329 | |
| 330 | // Construct a class loader based on our current repositories list |
| 331 | try { |
| 332 | |
| 333 | classLoader = createClassLoader(); |
| 334 | classLoader.setResources(context.getResources()); |
| 335 | classLoader.setDelegate(this.delegate); |
| 336 | |
| 337 | // Set Jakarta class converter |
| 338 | if (getJakartaConverter() != null) { |
| 339 | MigrationUtil.addJakartaEETransformer(classLoader, getJakartaConverter()); |
| 340 | } |
| 341 | |
| 342 | classLoader.start(); |
| 343 | |
| 344 | // Configure our repositories |
| 345 | setClassPath(); |
| 346 | |
| 347 | String contextName = context.getName(); |
| 348 | if (!contextName.startsWith("/")) { |
| 349 | contextName = "/" + contextName; |
| 350 | } |
| 351 | ObjectName cloname = |
| 352 | new ObjectName(context.getDomain() + ":type=" + classLoader.getClass().getSimpleName() + ",host=" + |
| 353 | context.getParent().getName() + ",context=" + contextName); |
| 354 | Registry.getRegistry(null).registerComponent(classLoader, cloname, null); |
| 355 | |
| 356 | } catch (Throwable t) { |
| 357 | Throwable throwable = ExceptionUtils.unwrapInvocationTargetException(t); |
| 358 | ExceptionUtils.handleThrowable(throwable); |
| 359 | throw new LifecycleException(sm.getString("webappLoader.startError"), throwable); |
| 360 | } |
| 361 | |
| 362 | setState(LifecycleState.STARTING); |
| 363 | } |
| 364 | |
| 365 | |
| 366 | /** |
nothing calls this directly
no test coverage detected