We have some existing source code which connect to JMS using TCP protocol . We are providing EMS URL as shown below in properties file:
tib.ems.url=tcp://UK_ONES_DEV_0000.ldn.mywork.com:9222
Now our EMS URL has been changed to SSL but when we are making any changes to ems URL in properties file, it is changing SSL to TCP automatically and failing connection. I am wondering if we need to make any changes for SSL connection.
<bean id="orcaReplayConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="orcaProviderReplayConnectionFactory"/>
<property name="username" value="${jms.orca.username}"/>
<property name="password" value="${jms.orca.password}"/>
</bean>
<jee:jndi-lookup id="orcaProviderReplayConnectionFactory"
jndi-name="${jndi.orca.name.replay}">
<jee:environment>
java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
java.naming.provider.url=${jndi.orca.url}
java.naming.factory.url.pkgs=com.tibco.tibjms.naming
</jee:environment>
</jee:jndi-lookup>
15:43:12.923 [main] INFO o.s.s.c.ThreadPoolTaskScheduler -Initializing ExecutorService 'taskScheduler'
15:43:13.528 [main] WARN o.s.c.s.ClassPathXmlApplicationContext -Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jms.listener.DefaultMessageListenerContainer#0': Cannot resolve reference to bean 'orcaConnectionFactory_v2' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orcaConnectionFactory_v2' defined in class path resource [spring/integration-context.xml]: Cannot resolve reference to bean 'orcaProviderConnectionFactory_v2' while setting bean property 'targetConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orcaProviderConnectionFactory_v2': Invocation of init method failed; nested exception is javax.naming.ServiceUnavailableException: Failed to query JNDI: Failed to connect to the server at tcp://UK_ONES_UAT_0000.ldn.mywork.com:9222 [Root exception is javax.jms.JMSException: Failed to connect to the server at tcp://UK_ONES_UAT_0000.ldn.mywork.com:9222]
Normally, when using JNDI, the connection URL is configured in the provider not the JNDI client. You need to fix the url in the provider.
After adding highlighted configuration while doing JNDI l, issue is resolved
<jee:environment>
java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
java.naming.provider.url=${jndi.orca.url}
java.naming.factory.url.pkgs=com.tibco.tibjms.naming
**com.tibco.tibjms.naming.security_protocol=ssl
com.tibco.tibjms.naming.ssl_enable_verify_host=false**
java.naming.security.principal=${jms.orca.username}
java.naming.security.credentials=${jms.orca.password}
</jee:environment>
Related
I'm using the instructions in this Heroku article to attempt to externalize database strings for a hosted Postgres DB. When I use the literal string, I can connect with no issues. However, when I attempt to use the externalized variable ${JDBC_DATABASE_URL}, I'm getting the error message:
2022-06-17 17:30:17.063 WARN 7712 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, ${JDBC_DATABASE_URL}
It looks like it's interpreting the externalized variable itself as a literal string, but I have no idea why. I haven't included any other config files because it is currently working with the database string, but I can attach them if need be. Any ideas?
[AnnotationConfigEmbeddedWebApplicationContext:559] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedActiveMQ' defined in class path resource [com/els/galaxy/gateway/ArtemisConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManagerFactory.stripPasswordParameters(Ljava/util/Map;)V
[LocalContainerEntityManagerFactoryBean:597] - Closing JPA EntityManagerFactory for persistence unit 'readPersistenceUnit'
=[LocalContainerEntityManagerFactoryBean:597] - Closing JPA EntityManagerFactory for persistence unit 'writePersistentUnit'
[session:167] - node0 Stopped scavenging
[ContextHandler:1045] - Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext#7bebe5de{application,/galaxy-gateway,[file:///C:/Users/basireddym/AppData/Local/Temp/jetty-docbase.7636853341168462882.86/],UNAVAILABLE}
[AutoConfigurationReportLoggingInitializer:102] -
I'm running TomEE 7.0.1 in Eclipse Neon. I've defined a DataSource resource in the "tomee.xml" file. The DataSource connects to an Oracle DB, and I'm getting the driver from my local Maven repo.
When TomEE starts up, I get the following error in the console:
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use].
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
Here is my Resource definition:
<Resource id="global/foo/bar" type="DataSource" classpath="mvn:oracle:ojdbc6:11.2.0.3">
JdbcDriver = oracle.jdbc.driver.OracleDriver
MaxActive = 5
MinIdle = 2
MaxIdle = 2
MaxWait = 10000
JdbcUrl = jdbc:oracle:thin:#<host>:1521:sus2
UserName = <userid>
Password = <password>
</Resource>
I've elided the host, user, and password, but the id is as written. I'm still unsure about the JNDI lookup, but that's obviously a separate problem.
Here's my JNDI lookup reference in my Spring context:
<jee:jndi-lookup jndi-name="java:global/foo/bar" id="sus2ds"/>
And here is more of the Tomcat console output:
INFO: Configuring Service(id=global/foo/bar, type=Resource, provider-id=Default JDBC Database)
...
INFO: Creating Resource(id=global/foo/bar)
Aug 03, 2016 11:08:27 AM org.apache.tomcat.jdbc.pool.ConnectionPool checkPoolConfiguration
WARNING: initialSize is larger than maxActive, setting initialSize to: 5
Aug 03, 2016 11:08:27 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to create initial connections of pool.
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use].
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
...
Aug 03, 2016 11:08:27 AM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource <init>
SEVERE: Can't create DataSource
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use].
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
...
...
2016-08-03 11:08:30,080 WARN [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:549) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
2016-08-03 11:08:30,084 ERROR [localhost-startStop-1] context.ContextLoader (ContextLoader.java:351) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
...
Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found.
at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291)
at org.apache.naming.NamingContext.lookup(NamingContext.java:828)
...
Aug 03, 2016 11:08:30 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
...
Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found.
at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151)
at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291)
at org.apache.naming.NamingContext.lookup(NamingContext.java:828)
...
I would start the server and use an MBean explorer, or the JNDI explorer webapp, to take a look at the JNDI tree and get the correct name. My suspicion is you do not need id="global/foo/bar" but id="foo/bar" and keep the lookup the same in your Spring code.
I'm using OpenAM, with its embedded OpenDJ as the LDAP service, to protect my web application running on JBoss 7.
When I start my JBoss I get this error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ldapUserDN'
...
Caused by: javax.naming.NameNotFoundException: ldap/idp/userDN -- service jboss.naming.context.java.ldap.idp.userDN
So apparently Spring is looking for the JNDI node ldap/idp/userDN. But the jboss configuration file that I got with the project has these entries:
<simple name="ldap/opendj/url" value="ldap://localhost:50389"/>
<simple name="ldap/opendj/userDN" value="cn=Directory Manager"/>
<simple name="ldap/opendj/password" value="mypassword"/>
<simple name="ldap/opendj/baseDN" value="dc=opensso,dc=java,dc=net"/>
And these properties are added to my JNDI tree on JBoss.
If I change these to "ldap/idp/userDN", for instance, then I get rid of the error, but I was wondering if there's anywhere, where "ldap/opendj/userDN" should be mapped to "ldap/idp/userDN", that I've missed.
If you're using Spring LDAP, the actual configuration of the ldap-context-source goes in the a spring config file, and might look like this:
<jee:jndi-lookup jndi-name="ldap/idp/url" id="ldapUrl"/>
<jee:jndi-lookup jndi-name="ldap/idp/userDN" id="ldapUserDN"/>
<jee:jndi-lookup jndi-name="ldap/idp/password" id="ldapPassword"/>
<jee:jndi-lookup jndi-name="ldap/idp/baseDN" id="ldapBaseDN"/>
<ldap:context-source url="#{ldapUrl}"
username="#{ldapUserDN}"
password="#{ldapPassword}"
base="#{ldapBaseDN}"
native-pooling="true"/>
So the jndi entries in your jboss config file should match the ones above.
I'm attempting to use the event:inbound-channel-adapter as an ApplicationEventListener to capture the ContextRefreshedEvent so I can dynamically start a file:inbound-channel-adapter like:
<file:inbound-channel-adapter id="filesIn" auto-startup="false"
directory="${input.location}" channel="fileInChannel">
<integration:poller ref="filesInPoller" />
</file:inbound-channel-adapter>
<event:inbound-channel-adapter id='appStarter' channel="nullChannel"
error-channel="errorChannel"
event-types="org.springframework.context.event.ContextRefreshedEvent"
payload-expression="#filesIn.start()"/>
But I get the following error indicating the sPel payload-expression cannot find the filesIn bean:
Exception in thread "main" org.springframework.expression.spel.SpelEvaluationException: EL1057E:(pos 1): No bean resolver registered in the context to resolve access to bean 'filesIn'
at org.springframework.expression.spel.ast.BeanReference.getValueInternal(BeanReference.java:45)
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:49)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:72)
at org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer.sendEventAsMessage(ApplicationEventListeningMessageProducer.java:113)
at org.springframework.integration.event.inbound.ApplicationEventListeningMessageProducer.onApplicationEvent(ApplicationEventListeningMessageProducer.java:91)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
Am I correct in believing that the file:inbound-channel-adapter is able to be started in this way?
Thanks
What version of Spring Integration are you using? The ability to reference a bean #filesIn was added to this adapter in 3.0.
If you are using 2.2 or below, upgrade to the current release (or at least 3.0.4).
In any case, you can't just send that command to nullChannel, it will evaluate to null and you can't have a null payload; you'll have to send '#filesIn.start()' to a <control-bus/>.
EDIT:
Or, "#filesIn.start() == null ? 'foo' : 'bar'" will send foo to the nullChannel.