geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirk Lund <kl...@apache.org>
Subject Re: ClassNotFoundException: LogService
Date Fri, 01 Nov 2019 22:28:03 GMT
To reproduce, drop this new test in geode-dunit/src/distributedTest/java
and then run it in IntelliJ or however you want.

It passes, but if you search through the output you'll find the error in my
first message with:

Caused by: java.lang.ClassNotFoundException:
*org.apache.geode.internal.logging.LogService*
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at
org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:543)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 88 more

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
 * agreements. See the NOTICE file distributed with this work for
additional information regarding
 * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the
License. You may obtain a
 * copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express
 * or implied. See the License for the specific language governing
permissions and limitations under
 * the License.
 */
package org.apache.geode.test.dunit.examples;

import static
org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
import static
org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
import static org.apache.geode.internal.AvailablePort.SOCKET;
import static
org.apache.geode.internal.AvailablePort.getRandomAvailablePort;
import static org.apache.geode.test.dunit.VM.getVM;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.Serializable;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import org.apache.geode.distributed.LocatorLauncher;
import org.apache.geode.test.dunit.rules.DistributedRule;
import
org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;

public class LocatorLauncherDistributedTest implements Serializable {

  private static LocatorLauncher locatorLauncher;

  @Rule
  public DistributedRule distributedRule = new DistributedRule();

  @Rule
  public SerializableTemporaryFolder temporaryFolder = new
SerializableTemporaryFolder();

  @Before
  public void setUp() {
    String name = getClass().getSimpleName();
    int port = getRandomAvailablePort(SOCKET);

    getVM(0).invoke(() -> {
      locatorLauncher = new LocatorLauncher.Builder()

.setWorkingDirectory(temporaryFolder.newFolder(name).getAbsolutePath())
          .setMemberName(name)
          .setPort(port)
          .set(HTTP_SERVICE_PORT, "0")
          .set(JMX_MANAGER_PORT, "0")
          .build();
      locatorLauncher.start();
    });
  }

  @After
  public void tearDown() {
    getVM(0).invoke(() -> {
      locatorLauncher.stop();
    });
  }

  @Test
  public void isRunning() {
    getVM(0).invoke(() -> {
      assertThat(locatorLauncher.isRunning()).isTrue();
    });
  }
}


On Fri, Nov 1, 2019 at 3:02 PM Kirk Lund <klund@apache.org> wrote:

> I'm seeing ClassNotFoundExceptions for FQN of the old package of the
> LogService:
>
> [locator] Caused by: java.lang.ClassNotFoundException:
> *org.apache.geode.internal.logging.LogService*
> [locator] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
>
> The above is interesting because it's the old package, not the current
> one. The current package is
> *org.apache.geode.logging.internal.log4j.api.LogService*.
>
> There are two related commits and I'm wondering if something didn't get
> completed or merged correctly. Do we need to revert any of these? Anyone
> working on this?
>
> commit 182de42d8e56a900f0d22793a440af72f62f09f4
> Author: Dan Smith <upthewaterspout@apache.org>
> Date:   Tue Oct 29 18:31:17 2019 -0700
>
>     GEODE-7177: Changing packages in geode-logging (#4232)
>
>     Changing the packages of classes in geode-logging so that they do not
> conflict
>     with geode-core packages. The following two new packages were created
>
>     org.apache.geode.logging.internal.executors:
>     Now contains LoggingExecutors, LoggingThread, LoggingThreadFactory,
>     LoggingUncaughtExceptionHandler
>
>     org.apache.geode.logging.internal.log4j.api:
>     Now contains: LogService, FastLogger, and log4j.message classes
>
>     This change touches the imports of files because LogService is used
> everywhere
>     we get a logger.
>
> commit 5981a139a1acc078d2d3024ddcfaad35642d7684
> Author: Ernie Burghardt <eburghardt@pivotal.io>
> Date:   Thu Oct 10 09:38:33 2019 -0700
>
>     GEODE-7177: Logging as a submodule (#4129)
>
>     * GEODE-7177: Extract LogService to a separate submodule
>
>     - Extracting LogService and it's dependencies to a separate
> geode-logging
>     submodule so that other modules not in geode-core can still use
> LogService to
>     get a Logger.
>
>     - Removing the use of the logging SPI from LogService
>     LogService had a dependency on the logging SPI in geode-core. However,
> this
>     dependency was unecessary - the LoggingProvider loaded statically in
> this class
>     never had `configure` called on it. In addition, the getLogger methods
> of this
>     class are merely creating FastLoggers which can live inside
> geode-logging and
>     do not need to be pluggable.
>
>     - Moved executors that are not dependent on geode-core to
> geode-logging and
>     renamed the remaining executors to be CoreLoggingExecutors.
>
>     - Refactor the marker interface from Loggable to EntriesCollection
>
>     - EntriesCollection put back into internal.cache and AbstractRegion
> now implements the marker
>     - Formerly known as Loggable renamed to LogWithToString
>
>     - Remove marker interface called EntriesCollection completely, replace
> with LogWithToString.
>
> Here's the full output of the error:
>
> [locator] [error 2019/11/01 14:48:50.877 PDT <RMI TCP
> Connection(1)-127.0.0.1> tid=0x13] Context initialization failed
> [locator] org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'managementControllerAdvice' defined in file
> [/Users/klund/dev/gemfire/geode/geode-dunit/dunit/locator/GemFire_klund/services/http/0.0.0.0_7070_management_8c20b9f3/webapp/WEB-INF/classes/org/apache/geode/management/internal/rest/controllers/ManagementControllerAdvice.class]:
> Instantiation of bean failed; nested exception is
> java.lang.NoClassDefFoundError: org/apache/geode/internal/logging/LogService
> [locator] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1159)
> [locator] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
> [locator] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
> [locator] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
> [locator] at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
> [locator] at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
> [locator] at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
> [locator] at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
> [locator] at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:764)
> [locator] at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
> [locator] at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
> [locator] at
> org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
> [locator] at
> org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
> [locator] at
> org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
> [locator] at
> org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
> [locator] at
> org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
> [locator] at
> org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:171)
> [locator] at javax.servlet.GenericServlet.init(GenericServlet.java:244)
> [locator] at
> org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:599)
> [locator] at
> org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:425)
> [locator] at
> org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:751)
> [locator] at
> java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352)
> [locator] at
> java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
> [locator] at
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> [locator] at
> java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
> [locator] at
> java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743)
> [locator] at
> java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742)
> [locator] at
> java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
> [locator] at
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:744)
> [locator] at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:361)
> [locator] at
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1443)
> [locator] at
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1407)
> [locator] at
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:821)
> [locator] at
> org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:276)
> [locator] at
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
> [locator] at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
> [locator] at
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
> [locator] at
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
> [locator] at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:106)
> [locator] at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
> [locator] at
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
> [locator] at org.eclipse.jetty.server.Server.start(Server.java:407)
> [locator] at
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
> [locator] at
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:106)
> [locator] at org.eclipse.jetty.server.Server.doStart(Server.java:371)
> [locator] at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
> [locator] at
> org.apache.geode.internal.cache.InternalHttpService.addWebApplication(InternalHttpService.java:207)
> [locator] at
> org.apache.geode.distributed.internal.InternalLocator.lambda$startClusterManagementService$1(InternalLocator.java:777)
> [locator] at java.util.Optional.ifPresent(Optional.java:159)
> [locator] at
> org.apache.geode.distributed.internal.InternalLocator.startClusterManagementService(InternalLocator.java:773)
> [locator] at
> org.apache.geode.distributed.internal.InternalLocator.startCache(InternalLocator.java:736)
> [locator] at
> org.apache.geode.distributed.internal.InternalLocator.startDistributedSystem(InternalLocator.java:715)
> [locator] at
> org.apache.geode.distributed.internal.InternalLocator.startLocator(InternalLocator.java:378)
> [locator] at
> org.apache.geode.distributed.internal.InternalLocator.startLocator(InternalLocator.java:328)
> [locator] at
> org.apache.geode.distributed.Locator.startLocator(Locator.java:252)
> [locator] at
> org.apache.geode.distributed.Locator.startLocatorAndDS(Locator.java:139)
> [locator] at
> org.apache.geode.test.dunit.internal.DUnitLauncher$1.call(DUnitLauncher.java:304)
> [locator] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [locator] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [locator] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [locator] at java.lang.reflect.Method.invoke(Method.java:498)
> [locator] at
> org.apache.geode.test.dunit.internal.MethodInvoker.executeObject(MethodInvoker.java:123)
> [locator] at
> org.apache.geode.test.dunit.internal.MethodInvoker.executeObject(MethodInvoker.java:92)
> [locator] at
> org.apache.geode.test.dunit.internal.RemoteDUnitVM.executeMethodOnObject(RemoteDUnitVM.java:45)
> [locator] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [locator] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [locator] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [locator] at java.lang.reflect.Method.invoke(Method.java:498)
> [locator] at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
> [locator] at sun.rmi.transport.Transport$1.run(Transport.java:200)
> [locator] at sun.rmi.transport.Transport$1.run(Transport.java:197)
> [locator] at java.security.AccessController.doPrivileged(Native Method)
> [locator] at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
> [locator] at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
> [locator] at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
> [locator] at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
> [locator] at java.security.AccessController.doPrivileged(Native Method)
> [locator] at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
> [locator] at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [locator] at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [locator] at java.lang.Thread.run(Thread.java:748)
> [locator] Caused by: java.lang.NoClassDefFoundError:
> org/apache/geode/internal/logging/LogService
> [locator] at
> org.apache.geode.management.internal.rest.controllers.ManagementControllerAdvice.<clinit>(ManagementControllerAdvice.java:54)
> [locator] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> [locator] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> [locator] at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> [locator] at
> java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> [locator] at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
> [locator] at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
> [locator] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1151)
> [locator] ... 80 more
> [locator] Caused by: java.lang.ClassNotFoundException:
> *org.apache.geode.internal.logging.LogService*
> [locator] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
> [locator] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> [locator] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
> [locator] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> [locator] at
> org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:543)
> [locator] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> [locator] ... 88 more
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message