从 Spring 初始化中删除 JNDI
Remove JNDI from Spring initialization
我正在 maven tomcat 插件中加载 Spring 应用程序。我没有使用 Spring 引导。
加载时,我收到无法加载 JNDI 属性的调试日志,例如:
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server_useforwardheaders]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server_useforwardheaders] threw NamingException with message: Name [server_useforwardheaders] is not bound in this Context. Unable to find [server_useforwardheaders].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server.USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server.USE-FORWARD-HEADERS] not found - trying original name [server.USE-FORWARD-HEADERS]. javax.naming.NameNotFoundException: Name [server.USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server.USE-FORWARD-HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server.USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server.USE-FORWARD-HEADERS] threw NamingException with message: Name [server.USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server.USE-FORWARD-HEADERS].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server_USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server_USE-FORWARD-HEADERS] not found - trying original name [server_USE-FORWARD-HEADERS]. javax.naming.NameNotFoundException: Name [server_USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server_USE-FORWARD-HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server_USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server_USE-FORWARD-HEADERS] threw NamingException with message: Name [server_USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server_USE-FORWARD-HEADERS].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server.USE_FORWARD_HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server.USE_FORWARD_HEADERS] not found - trying original name [server.USE_FORWARD_HEADERS]. javax.naming.NameNotFoundException: Name [server.USE_FORWARD_HEADERS] is not bound in this Context. Unable to find [server.USE_FORWARD_HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server.USE_FORWARD_HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server.USE_FORWARD_HEADERS] threw NamingException with message: Name [server.USE_FORWARD_HEADERS] is not bound in this Context. Unable to find [server.USE_FORWARD_HEADERS].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server_USE_FORWARD_HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server_USE_FORWARD_HEADERS] not found - trying original name [server_USE_FORWARD_HEADERS]. javax.naming.NameNotFoundException: Name [server_USE_FORWARD_HEADERS] is not bound in this Context. Unable to find [server_USE_FORWARD_HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server_USE_FORWARD_HEADERS]
我可以在我的 spring 项目中 disable/ignore JNDI 吗?
读起来不错:what is JNDI?
Basic use of JNDI is to allows distributed applications to look up
services in an abstract, resource-independent way.
禁用 JNDI
在 src/main/resources
中创建一个 spring.properties
文件(如果已经创建则忽略)并添加此值 spring.jndi.ignore=true
我正在 maven tomcat 插件中加载 Spring 应用程序。我没有使用 Spring 引导。
加载时,我收到无法加载 JNDI 属性的调试日志,例如:
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server_useforwardheaders]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server_useforwardheaders] threw NamingException with message: Name [server_useforwardheaders] is not bound in this Context. Unable to find [server_useforwardheaders].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server.USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server.USE-FORWARD-HEADERS] not found - trying original name [server.USE-FORWARD-HEADERS]. javax.naming.NameNotFoundException: Name [server.USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server.USE-FORWARD-HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server.USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server.USE-FORWARD-HEADERS] threw NamingException with message: Name [server.USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server.USE-FORWARD-HEADERS].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server_USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server_USE-FORWARD-HEADERS] not found - trying original name [server_USE-FORWARD-HEADERS]. javax.naming.NameNotFoundException: Name [server_USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server_USE-FORWARD-HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server_USE-FORWARD-HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server_USE-FORWARD-HEADERS] threw NamingException with message: Name [server_USE-FORWARD-HEADERS] is not bound in this Context. Unable to find [server_USE-FORWARD-HEADERS].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server.USE_FORWARD_HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server.USE_FORWARD_HEADERS] not found - trying original name [server.USE_FORWARD_HEADERS]. javax.naming.NameNotFoundException: Name [server.USE_FORWARD_HEADERS] is not bound in this Context. Unable to find [server.USE_FORWARD_HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server.USE_FORWARD_HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [server.USE_FORWARD_HEADERS] threw NamingException with message: Name [server.USE_FORWARD_HEADERS] is not bound in this Context. Unable to find [server.USE_FORWARD_HEADERS].. Returning null.
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/server_USE_FORWARD_HEADERS]
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/server_USE_FORWARD_HEADERS] not found - trying original name [server_USE_FORWARD_HEADERS]. javax.naming.NameNotFoundException: Name [server_USE_FORWARD_HEADERS] is not bound in this Context. Unable to find [server_USE_FORWARD_HEADERS].
[localhost-startStop-1] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [server_USE_FORWARD_HEADERS]
我可以在我的 spring 项目中 disable/ignore JNDI 吗?
读起来不错:what is JNDI?
Basic use of JNDI is to allows distributed applications to look up services in an abstract, resource-independent way.
禁用 JNDI
在 src/main/resources
中创建一个 spring.properties
文件(如果已经创建则忽略)并添加此值 spring.jndi.ignore=true