Activemq's admin console, as standard, points to 0.0.0.0:8161.
I know I can change the port from 8161 in the jetty.xml config file.
Is it possible to change the URL from 0.0.0.0?
The answer was pretty obvious. In jetty.xml:
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8161" />
<property name="host" value="HOSTNAME" />
</bean>
Related
I am using WSO2 APIM 3.0.0 version & I have published an API in WSO2 using an existing swagger definition.
I am using a hybrid gateway environment, with the "Production" & "Sandbox" URLs configured to different code environments (for testing purposes the "Production" URL hits our qa box and "Sandbox" hits my local environment). I have just noticed that WSO2 is always routing calls to the sandbox environment (my local) even when I use the "Production" access token.
Is there something else I need to do apart from simply generating different access tokens for prod & sandbox from the devportal for it to route to the desired environment?
And does this mean that I MUST always have different gateways for different environments?
I tested this using OAUTH & JWT token types, with different grant mechanisms, and it still does the same thing.
synapse-config attached as requested:
<?xml version="1.0" encoding="UTF-8"?><api xmlns="http://ws.apache.org/ns/synapse" name="admin--XXXBackendPlatform" context="/WSO2/1.0.0" version="1.0.0" version-type="context">
<resource methods="POST" url-mapping="xxxxx" faultSequence="fault">
<inSequence>
<property name="api.ut.backendRequestTime" expression="get-property('SYSTEM_TIME')"/>
<filter source="$ctx:AM_KEY_TYPE" regex="SANDBOX">
<then>
<send>
<endpoint key="XXXBackendPlatform--v1.0.0_APIsandboxEndpoint"/>
</send>
</then>
<else>
<sequence key="_production_key_error_"/>
</else>
</filter>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler">
<property name="apiUUID" value="6535a4b7-759b-4f0e-8980-eab80aaee847"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
<property name="apiImplementationType" value="ENDPOINT"/>
<property name="AuthorizationHeader" value="WSO2_Auth"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler">
<property name="RemoveOAuthHeadersFromOutMessage" value="true"/>
<property name="APILevelPolicy" value="Unlimited"/>
<property name="AuthorizationHeader" value="WSO2_Auth"/>
<property name="CertificateInformation" value="{}"/>
<property name="APISecurity" value="oauth2,oauth_basic_auth_api_key_mandatory"/>
<property name="apiUUID" value="6535a4b7-759b-4f0e-8980-eab80aaee847"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtUsageHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtGoogleAnalyticsTrackingHandler">
<property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/>
</handlers>
</api>
As per the below part, you have only configured a sandbox endpoint in your API. You should get an error if you use production keys to access the API.
<filter source="$ctx:AM_KEY_TYPE" regex="SANDBOX">
<then>
<send>
<endpoint key="XXXBackendPlatform--v1.0.0_APIsandboxEndpoint"/>
</send>
</then>
<else>
<sequence key="_production_key_error_"/>
</else>
</filter>
We are using Jasypt in one of our Spring based project to encrypt our database properties. As per Jasypt documentation we need to make algorith and password (secret) entry in our application context.
<bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndDES" />
<property name="passwordEnvName" value="secret" />
</bean>
<bean id="configurationEncryptor"
class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration" />
</bean>
<bean id="propertyConfigurer"
class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor" />
<property name="location" value="classpath*:*.properties" />
</bean>
If we do that, any one can easily decrypt our properties by decrypt property provided by Jasypt only. For example
sh decrypt.sh input=pYmd0m1m2nEAGIeTtfdfdfdl/e3W49e password=sdsdfsf algorithm=PBEWithMD5AndDES
So how we can ensure the security of our property files.
I am having trouble getting Camel to work with jndi. I am deploying camel inside of IBM Websphere.
Inside of Websphere there is a jdni connection called "vzw.ds.commerce" that is setup to connect to the database I want to access.
This route below works:
<bean class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" id="publishDB">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url"
value="jdbc:oracle:thin:#//server.com:2051/mbschema" />
<property name="username" value="username" />
<property name="password" value="password" />
</bean>
<bean id="commerceDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="vzw.ds.commerce" />
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="timer-to-console" customId="true">
<from uri="timer://foo?fixedRate=true&period=10s" />
<transform>
<simple>30004</simple>
</transform>
<process ref="createSQL" />
<to uri="jdbc:publishDB" />
<process ref="processSQL" />
<to uri="stream:out" />
</route>
</camelContext>
However, I want to use the jndi connection and not have the connection information in the route.
When I change the line to:
I get the error:
java.sql.SQLException: invalid arguments in call DSRA0010E: SQL State = null, Error Code = 17,433
The code I posted actually was correct. The problem I had was with the setup on Websphere.
Once I changed the setting on Websphere the code started working.
I have a Maven3 project where I'm using the tomcat7-maven-plugin. I would like to set the path for the embedded database via an environment variable argument to the jvm.
Reading the variable with System.getenv("myDataDir") within a Java-Method returns the correct path.
But when I try to set the variable ${myDataDir} in my persistence.xml and then I start tomcat with "mvn tomcat:run" I get FileNotFoundExceptions because the variable is not replaced with the actual value (it says e.g. Cannot find path for ${myDataDir}\derby.log)
I don't know what's causing this - if it's the persistence provider (EclipseLink) that doesn't support this or if it's something else.
My persistence.xml looks like this:
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="myPersistence" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="javax.persistence.jdbc.url" value="jdbc:derby:${myDataDir}/DB;create=true;upgrade=true" />
<property name="javax.persistence.jdbc.user" value="admin" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="both" />
<property name="eclipselink.logging.level" value="SEVERE" />
<property name="eclipselink.logging.file" value="${myDataDir}/derby.log" />
<property name="eclipselink.application-location" value="${myDataDir}/dbScripts" />
</properties>
</persistence-unit>
</persistence>
EDIT:
I forgot to mention, that I'm in a Spring 3 Framework environment. According to the examples on the web, this should be capable of using environment variables in persistence.xml...
Using ${myDataDir} in a database URL is not valid, unless supported by your database, or unless you are translating the variable during your own build scripts.
What you can do is pass a properties map to Persistence.createEntityManagerFactory() that has the URL you want, that you must build at runtime in code.
I am currently using JBoss 4.3 for a web application. I would like to move to the JBoss AS 7. I have been able to fix must of the differences of the application in both versions but one. The application has some JMX beans that are created thru the spring framework. Unfortunately the AS 7 release removed the class: org.jboss.mx.util.MBeanServerLocator which was used in spring to locate the JBoss JMX server and create some beans. I am not to familiar with JMX but so far the only thing I have found so far is:
"http://lists.jboss.org/pipermail/jboss-as7-dev/2011-February/000569.html". I was wondering if somebody knows how to replace the class above from JBOSS with the new JMX 1.6 classes. Here is my spring configuration snipet for the piece I need to fix:
<bean class="org.springframework.jmx.export.MBeanExporter">
<property name="server">
<bean class="org.jboss.mx.util.MBeanServerLocator" factory-method="locateJBoss"/>
</property>
<property name="beans">
<map>
<entry key="MywebMbeans:name=profileListenerContainer" value-ref="profileListenerContainer"/>
<entry key="MywebMbeans:name=jmsSenderService" value-ref="jmsSenderService"/>
<entry key="MywebMbeans:name=mailSender" value-ref="mailSender"/>
</map>
</property>
<property name="assembler" ref="mbeanAssembler"/>
</bean>
Thanks,
The MBeanServer used by JBoss 7 (by default) is the platform MBeanServer. The class name is com.sun.jmx.mbeanserver.JmxMBeanServer and the default domain is DefaultDomain. Accordingly, you can simply use:
java.lang.management.ManagementFactory.getPlatformMBeanServer()
Alternatively:
for(MBeanServer server: javax.management.MBeanServerFactory.findMBeanServer(null)) {
if("DefaultDomain".equals(server.getDefaultDomain())) return server;
}
throw new Exception("Failed to locate MBeanServer");
Actually I just look in the JMX page for spring
http://static.springsource.org/spring/docs/1.2.x/reference/jmx.html
The following will work in both JBoss instaces 4 and 7.
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true" />
</bean>
<bean class="org.springframework.jmx.export.MBeanExporter">
<property name="server" ref="mbeanServer"/>
</property>
<property name="beans">
<map>
<entry key="MywebMbeans:name=profileListenerContainer" value-ref="profileListenerContainer"/>
<entry key="MywebMbeans:name=jmsSenderService" value-ref="jmsSenderService"/>
<entry key="MywebMbeans:name=mailSender" value-ref="mailSender"/>
</map>
</property>
<property name="assembler" ref="mbeanAssembler"/>
</bean>