I tried the following in the application context:
but I keep getting this error when specifying more than one jndi lookup. In Glassfish, I have two JNDI resources that the application needs, one is for configurations specific towards the application and the other is for logging using log4j.Code:<jee:jndi-lookup id="log4jJndi" jndi-name="log4j" resource-ref="true" /> <jee:jndi-lookup id="configurationsJndi" jndi-name="configurations" resource-ref="true" />
Since removing one of the JNDI look ups it works deploying the application to a container. My question is then, how do you specify more than one JNDI look up or how do you have one JNDI look up look up more than one JNDI resource?Code:Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'log4jJndi': Invocation of init method failed; nested exception is javax.naming.CommunicationException: Communication exception for SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is java.lang.IllegalAccessException: value cannot be null]|#]
Edit: Solved it in the application context I used propertiesArray and then added the log4j value to a config bean.
Code:<jee:jndi-lookup id="log4jJndi" jndi-name="log4j" resource-ref="true" /> <jee:jndi-lookup id="configurationsJndi" jndi-name="configurations" resource-ref="true" /> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="true"/> <property name="propertiesArray"> <list> <ref bean="configurationsJndi"/> <ref bean="log4jJndi"/> </list> </property> </bean> <bean id="config" class="com.foo.Config"> <constructor-arg> <bean class="org.springframework.util.StringUtils" factory-method="commaDelimitedListToSet"> <constructor-arg type="java.lang.String" value="${com.foo.file.location}"/> </bean> </constructor-arg> <property name="log4jFileLocation" value="${com.foo.logPath}" /> </bean>


Reply With Quote
