Hi everybody. Please help me with this issue that's driving me crazy.

Altough JConsole can connect to my spring jmx server without any problems, using the username and password I provide, I cannot connect to the same server, using my MBeanServerConnectionFactoryBean. I keep getting the "Bad credentials" error. Here is the config:

Code:
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>jmx.properties</value>
			</list>
		</property>
	</bean>

	<bean id="jmxServerClient"
		class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
		<property name="serviceUrl"
			value="service:jmx:rmi://localhost:9999/jndi/rmi://localhost:8335/connector" />
		<property name="environment">
			<props>
				<prop key="java.naming.security.principal">
					${jmx_username}
				</prop>
				<prop key="java.naming.security.credentials">
					${jmx_password}
				</prop>
			</props>
		</property>
		<property name="connectOnStartup" value="false" />
	</bean>

	<bean id="serverClient"
		class="ro.romtelecom.DEALER.services.jmxControlServiceImpl">
		<property name="client" ref="jmxServerClient" />
	</bean>
Thank you.