0

I have created a web project in eclipse, which works fine, but when i add the Hashmap it gives me the error The type Java.util.Map$Entry canot be resolved.

I have seen many discussions on the same issue but could not get a solution. Can someone help me please.

package com.balu.loginApp.bean;

import java.util.HashMap;
import java.util.Map;

public class LoginAuthenitication {
    Map<String, String> users = new HashMap<String, String>();

    public LoginAuthenitication()
    {
        users.put("balu", "Balamurali CL");
        users.put("swathi", "Swathi RL");
    }

    public boolean loginAuthenitications(String userName, String passWord)
    {
        if (passWord== null || passWord.trim() == "")
        {
            return false;
        }
        else
            return true;
}

Stacktrace

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/juli/logging/LogFactory at
org.apache.catalina.util.LifecycleBase.<clinit>(LifecycleBase.java:37)
Caused by: java.lang.ClassNotFoundException:
org.apache.juli.logging.LogFactory at
java.net.URLClassLoader.findClass(URLClassLoader.java:381) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357) ...
Cœur
  • 37,241
  • 25
  • 195
  • 267
balu
  • 35
  • 4
  • What version of Java are you using to a) run the program b) compile the program c) run Eclipse? – Thilo Aug 02 '16 at 04:02
  • Can you also post a full stacktrace? This is a runtime error, right? What servlet container are you using and at which version? – Thilo Aug 02 '16 at 04:06
  • Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.util.LifecycleBase.(LifecycleBase.java:37) Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 1 more – balu Aug 02 '16 at 04:10
  • eclipsee Details:Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 2 Build id: 20120216-1857 (c) Copyright Eclipse contributors and others 2005, 2012. All rights reserved. Visit http://www.eclipse.org/webtools – balu Aug 02 '16 at 04:10
  • Maybe this can help http://stackoverflow.com/questions/26700824/jdk-8-the-type-java-util-mapentry-cannot-be-resolved – Sergey Gornostaev Aug 02 '16 at 05:11
  • 2
    The stack trace shows a totally different problem. – Henry Aug 02 '16 at 05:29
  • Neither your title nor your code has anything whatsoever to do with your question. – user207421 Aug 02 '16 at 06:16
  • 1
    The function should contain `return passWord != null && !passWord.trim().isEmpty();` as `== ""` is a wrong string comparison (should use `equals`). – Joop Eggen Aug 02 '16 at 06:27

2 Answers2

0

Please follow this instructions

Right click on the project.

Click 'Properties'

Go to 'Java Build Path'

And then: 'Libraries'

In there, Click: Add External Jars

Add: ''Path/To/Tomcat/Bin/tomcat-juli.jar

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Fairoz
  • 1,616
  • 13
  • 16
  • Hi ,As told I have added the tomact-jul-jar yet the issue exists. – balu Aug 04 '16 at 03:54
  • I created a simple project as below package com.balu.webapplication; import java.util.Map; public class HaspMap { Map mapstring = new HaspMap(); } even for this the error shows so ..I am not sure why is this happening – balu Aug 04 '16 at 03:54
0

After reading the stacktrace you provided , it has nothing to do with Java.util.Map$Entry.

error from stacktrace :

java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

possible solution

Tomcat's bootstrap.jar used to reference the file bin/tomcat-juli.jar in it's manifest. That is changing since it forced tomcat to use a specific library. Instead, it has to be added to the -classpath line. Open your server configuration, and add tomcat-juli.jar to the classpath, and it will work.

bananas
  • 1,176
  • 2
  • 19
  • 39