在Jboss中使用jasypt部署Spring Jax RS服务应用程序时出现空指针异常
在jboss-as-7.0.2.Final上部署服务时,我遇到以下异常。当从jboss上的eclipse内部运行相同的代码时,它工作正常在Jboss中使用jasypt部署Spring Jax RS服务应用程序时出现空指针异常,spring,hibernate,cxf,jboss7.x,jasypt,Spring,Hibernate,Cxf,Jboss7.x,Jasypt,在jboss-as-7.0.2.Final上部署服务时,我遇到以下异常。当从jboss上的eclipse内部运行相同的代码时,它工作正常 15:30:02,220 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/searchservice]] (MSC service thread 1-16) Initializing Spring root WebApplicationContext 15:3
15:30:02,220 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/searchservice]] (MSC service thread 1-16) Initializing Spring root WebApplicationContext
15:30:03,105 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/searchservice]] (MSC service thread 1-16) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: java.lang.NullPointerException
at org.jasypt.encryption.pbe.config.SimplePBEConfig.getPasswordCharArray(SimplePBEConfig.java:434) [jasypt-1.9.0.jar:]
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.resolveConfigurationPassword(StandardPBEByteEncryptor.java:740) [jasypt-1.9.0.jar:]
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:590) [jasypt-1.9.0.jar:]
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:553) [jasypt-1.9.0.jar:]
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:705) [jasypt-1.9.0.jar:]
at org.jasypt.properties.PropertyValueEncryptionUtils.decrypt(PropertyValueEncryptionUtils.java:72) [jasypt-1.9.0.jar:]
at org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer.convertPropertyValue(EncryptablePropertyPlaceholderConfigurer.java:109) [jasypt-spring3-1.9.0.jar:]
at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperties(PropertyResourceConfigurer.java:95) [spring-beans-3.0.2.RELEASE.jar:]
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:72) [spring-beans-3.0.2.RELEASE.jar:]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:640) [spring-context-3.0.2.RELEASE.jar:]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:615) [spring-context-3.0.2.RELEASE.jar:]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:405) [spring-context-3.0.2.RELEASE.jar:]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) [spring-web-3.0.2.RELEASE.jar:]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) [spring-web-3.0.2.RELEASE.jar:]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.2.RELEASE.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [:1.7.0_09-icedtea]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [:1.7.0_09-icedtea]
at java.lang.Thread.run(Thread.java:722) [:1.7.0_09-icedtea]
15:30:03,159 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-16) Error listenerStart
15:30:03,159 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-16) Context [/searchservice] startup failed due to previous errors
下面是应用程序上下文文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="srdhSearchService" address="/">
<jaxrs:serviceBeans>
<ref bean="searchServiceInterface" />
</jaxrs:serviceBeans>
</jaxrs:server>
<!--
<bean id="placeholderConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:databaseResources.properties</value>
</list>
</property>
</bean>
-->
<bean id="propertyConfigurer"
class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor" />
<property name="locations">
<list>
<value>databaseResources.properties</value>
</list>
</property>
</bean>
<bean id="commonDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${commonDataSourceDriver}" />
<property name="url" value="${commonDataSourceUrl}" />
<property name="username" value="${commonDataSourceUsername}" />
<property name="password" value="${commonDataSourcePassword}" />
<property name="initialSize" value="2"/>
<property name="maxActive" value="400"/>
<property name="maxIdle" value="300"/>
<property name="minIdle" value="10"/>
<property name="maxWait" value="10000"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="timeBetweenEvictionRunsMillis" value="5000"/>
<property name="removeAbandonedTimeout" value="60"/>
<property name="removeAbandoned" value="true"/>
<property name="minEvictableIdleTimeMillis" value="10000"/>
</bean>
<bean id="enrollmentDataSource1" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${enrollmentDataSourceDriver1}" />
<property name="url" value="${enrollmentDataSourceUrl1}" />
<property name="username" value="${enrollmentDataSourceUsername1}" />
<property name="password" value="${enrollmentDataSourcePassword1}" />
<property name="initialSize" value="2"/>
<property name="maxActive" value="400"/>
<property name="maxIdle" value="300"/>
<property name="minIdle" value="10"/>
<property name="maxWait" value="10000"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="timeBetweenEvictionRunsMillis" value="5000"/>
<property name="removeAbandonedTimeout" value="60"/>
<property name="removeAbandoned" value="true"/>
<property name="minEvictableIdleTimeMillis" value="10000"/>
</bean>
<bean id="enrollmentDataSource2" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${enrollmentDataSourceDriver2}" />
<property name="url" value="${enrollmentDataSourceUrl2}" />
<property name="username" value="${enrollmentDataSourceUsername2}" />
<property name="password" value="${enrollmentDataSourcePassword2}" />
<property name="initialSize" value="2"/>
<property name="maxActive" value="400"/>
<property name="maxIdle" value="300"/>
<property name="minIdle" value="10"/>
<property name="maxWait" value="10000"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="timeBetweenEvictionRunsMillis" value="5000"/>
<property name="removeAbandonedTimeout" value="60"/>
<property name="removeAbandoned" value="true"/>
<property name="minEvictableIdleTimeMillis" value="10000"/>
</bean>
<bean id="seedingDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${seedingDataSourceDriver}" />
<property name="url" value="${seedingDataSourceUrl}" />
<property name="username" value="${seedingDataSourceUsername}" />
<property name="password" value="${seedingDataSourcePassword}" />
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="timeBetweenEvictionRunsMillis" value="5000"/>
<property name="removeAbandonedTimeout" value="60"/>
<property name="removeAbandoned" value="true"/>
</bean>
<bean id="commonSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="commonDataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="current_session_context_class">org.hibernate.context.ManagedSessionContext</prop>
<!-- <prop key="cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> -->
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
<prop key="hibernate.default_schema">${hibernate.defaultSchema.common}</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>auditWebServiceSearch.hbm.xml</value>
<value>login.hbm.xml</value>
<value>srdh_census_master_mapping.hbm.xml</value>
</list>
</property>
</bean>
<bean id="enrollmentSessionFactory1"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="enrollmentDataSource1" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="current_session_context_class">org.hibernate.context.ManagedSessionContext</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
<prop key="hibernate.default_schema">${hibernate.defaultSchema.enrollment1}</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>enrollmentDetails.hbm.xml</value>
<value>enrollmentphoto.hbm.xml</value>
</list>
</property>
</bean>
<bean id="enrollmentSessionFactory2"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="enrollmentDataSource2" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="current_session_context_class">org.hibernate.context.ManagedSessionContext</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
<prop key="hibernate.default_schema">${hibernate.defaultSchema.enrollment2}</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>enrollmentphoto.hbm.xml</value>
<value>enrollmentDetails.hbm.xml</value>
</list>
</property>
</bean>
<bean id="seedingSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="seedingDataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="current_session_context_class">org.hibernate.context.ManagedSessionContext</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>seedingDictionary.hbm.xml</value>
</list>
</property>
</bean>
<bean id="searchServiceInterface"
class="in.gov.uidai.srdh.portal.service.impl.SearchWebServiceImpl">
<property name="searchServiceImpl" ref="searchService"></property>
<property name="loginDAO" ref="loginDAO"></property>
</bean>
<bean id="searchService" class="in.gov.uidai.srdh.portal.service.impl.SearchServiceImpl"
scope="prototype">
<property name="searchDAO" ref="searchDAO" />
</bean>
<bean id="searchDAO" class="in.gov.uidai.srdh.portal.dao.impl.SearchDAOImpl"
scope="prototype">
<property name="dbController" ref="dbController" />
<property name="commonSessionFactory" ref="commonSessionFactory" />
<property name="seedingSessionFactory" ref="seedingSessionFactory" />
</bean>
<bean id="loginDAO" class="in.gov.uidai.srdh.portal.dao.impl.LoginDAOImpl"
scope="prototype">
<property name="commonSessionFactory" ref="commonSessionFactory" />
</bean>
<bean id="dbController" class="in.gov.uidai.srdh.portal.common.util.DBController">
<property name="enrollmentSessionFactory1" ref="enrollmentSessionFactory1" />
<property name="enrollmentSessionFactory2" ref="enrollmentSessionFactory2" />
</bean>
<bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndDES" />
<property name="passwordEnvName" value="SRDH_KEY" />
</bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration" />
</bean>
</beans>
databaseResources.properties
${hibernate.dial}
${hibernate.show_sql}
org.hibernate.context.ManagedSessionContext
真的
UTF-8
UTF-8
${hibernate.defaultSchema.common}
auditWebServiceSearch.hbm.xml
login.hbm.xml
srdh_普查_主地图.hbm.xml
${hibernate.dial}
${hibernate.show_sql}
org.hibernate.context.ManagedSessionContext
真的
UTF-8
UTF-8
${hibernate.defaultSchema.enrollment1}
enrollmentDetails.hbm.xml
enrollmentphoto.hbm.xml
${hibernate.dial}
${hibernate.show_sql}
org.hibernate.context.ManagedSessionContext
真的
UTF-8
UTF-8
${hibernate.defaultSchema.enrollment2}
enrollmentphoto.hbm.xml
enrollmentDetails.hbm.xml
${hibernate.dial}
${hibernate.show_sql}
org.hibernate.context.ManagedSessionContext
真的
UTF-8
UTF-8
seedingDictionary.hbm.xml
有没有可能看到密码?我正在通过database.properties文件传递编码密码。我已经在上面发布了应用程序上下文文件,我们是否有可能看到代码?我正在通过database.properties文件传递编码的密码。我已经在上面发布了应用程序上下文文件