Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] log4j issues when starting spark connector #3649

Closed
FANNG1 opened this issue May 30, 2024 · 1 comment · Fixed by #3654
Closed

[Bug report] log4j issues when starting spark connector #3649

FANNG1 opened this issue May 30, 2024 · 1 comment · Fixed by #3654
Assignees
Labels
bug Something isn't working

Comments

@FANNG1
Copy link
Contributor

FANNG1 commented May 30, 2024

Version

main branch

Describe what's wrong

there are error messages

Error message and/or stacktrace

ERROR StatusLogger Unable to create Lookup for bundle
 [Loaded java.lang.Throwable$PrintStreamOrWriter from /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded java.lang.Throwable$WrappedPrintStream from /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/rt.jar]
java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.ResourceBundleLookup
        at java.lang.Class.asSubclass(Class.java:3404)
        at com.datastrato.gravitino.shaded.org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:86)
        at com.datastrato.gravitino.shaded.org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:108)
        at com.datastrato.gravitino.shaded.org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:136)
        at com.datastrato.gravitino.shaded.org.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:32)
        at com.datastrato.gravitino.shaded.org.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:76)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.apache.log4j.LogManager.checkLog4jCore(LogManager.java:76)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:68)
        at org.apache.log4j.Logger.getLogger(Logger.java:40)
        at org.datanucleus.util.Log4JLogger.<init>(Log4JLogger.java:49)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1025)
        at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:844)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:541)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:269)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
        at org.apache.hadoop.hive.conf.valcoersion.JavaIOTmpdirVariableCoercion.<clinit>(JavaIOTmpdirVariableCoercion.java:35)
        at org.apache.hadoop.hive.conf.SystemVariables.<clinit>(SystemVariables.java:37)
        at org.apache.hadoop.hive.conf.HiveConf$ConfVars.<init>(HiveConf.java:3445)
        at org.apache.hadoop.hive.conf.HiveConf$ConfVars.<init>(HiveConf.java:3409)
        at org.apache.hadoop.hive.conf.HiveConf$ConfVars.<clinit>(HiveConf.java:436)
        at org.apache.hadoop.hive.conf.HiveConf.<clinit>(HiveConf.java:148)
        at org.apache.spark.sql.hive.client.HiveClientImpl$.newHiveConf(HiveClientImpl.scala:1266)
        at org.apache.spark.sql.hive.client.HiveClientImpl.newState(HiveClientImpl.scala:169)
        at org.apache.spark.sql.hive.client.HiveClientImpl.<init>(HiveClientImpl.scala:134)

How to reproduce

./bin/spark-sql -v
--conf spark.plugins="com.datastrato.gravitino.spark.connector.plugin.GravitinoSparkPlugin"
--conf spark.sql.gravitino.uri=http://127.0.0.1:8090
--conf spark.sql.gravitino.metalake=test
--conf spark.sql.gravitino.enableIcebergSupport=true
--conf spark.hadoop.hive.exec.dynamic.partition.mode=nonstrict
--conf spark.sql.catalog.hive.spark.sql.hive.metastore.jars=path
--conf spark.sql.catalog.hive.spark.sql.hive.metastore.jars.path="file:///Users/fanng/deploy/hive/lib/*"
--conf spark.locality.wait.node=0
--conf spark.sql.session.timeZone=UTC

Additional context

No response

@FANNG1 FANNG1 added the bug Something isn't working label May 30, 2024
@FANNG1 FANNG1 self-assigned this May 30, 2024
@FANNG1
Copy link
Contributor Author

FANNG1 commented May 30, 2024

  public Interpolator(final StrLookup defaultLookup, final List<String> pluginPackages) {
        this.defaultLookup =
                defaultLookup == null ? new PropertiesLookup(new HashMap<String, String>()) : defaultLookup;
        final PluginManager manager = new PluginManager(CATEGORY);
        manager.collectPlugins(pluginPackages);
        final Map<String, PluginType<?>> plugins = manager.getPlugins();

        for (final Map.Entry<String, PluginType<?>> entry : plugins.entrySet()) {
            try {
               // StrLookup class is relocated to com.datastrato.xxx here
                final Class<? extends StrLookup> clazz =
                        entry.getValue().getPluginClass().asSubclass(StrLookup.class);
                if (!clazz.getName().equals("org.apache.logging.log4j.core.lookup.JndiLookup")
                        || JndiManager.isJndiLookupEnabled()) {
                    strLookupMap.put(toRootLowerCase(entry.getKey()), ReflectionUtil.instantiate(clazz));
                }
            } catch (final Throwable t) {
                handleError(entry.getKey(), t);
            }
        }
    }

jerryshao pushed a commit that referenced this issue May 31, 2024
…t-java-runtime (#3665)

### What changes were proposed in this pull request?

remove log4j impl from client-java-runtime

### Why are the changes needed?

Fix: #3649 

### Does this PR introduce _any_ user-facing change?
no

### How was this patch tested?
local spark env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants