I've configured jetty hightide 8.1 server on ec2 instance. My jetty.xml file is as follows
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool -->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">200</Set>
<Set name="detailedDump">false</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" default="0.0.0.0"/></Set>
<Set name="port"><Property name="jetty.port" default="80"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addBean">
<Arg>
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts">
<Ref id="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/servlet-api-[^/]*\.jar$</Arg>
</Call>
<!-- Add a customize step to the deployment lifecycle -->
<!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
<Call name="insertLifeCycleNode">
<Arg>deployed</Arg>
<Arg>starting</Arg>
<Arg>customise</Arg>
</Call>
<Call name="addLifeCycleBinding">
<Arg>
<New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
<Arg>customise</Arg>
</New>
</Arg>
</Call>
-->
</New>
</Arg>
</Call>
<Ref id="DeploymentManager">
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDirName"><Property name="jetty.home" default="." />/contexts</Set>
<Set name="scanInterval">1</Set>
</New>
</Arg>
</Call>
</Ref>
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Arg><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.tutorial.log</Arg>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
<Set name="dumpAfterStart">false</Set>
<Set name="dumpBeforeStop">false</Set>
</Configure>
And in /contexts folder I've made a file mydomain.xml as follows
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/</Set>
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webapps/sampleapp/</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<!-- virtual hosts -->
<Set name="virtualHosts">
<Array type="String">
<Item>www.mydomain.com</Item>
<Item>localhost</Item>
<Item>127.0.0.1</Item>
</Array>
</Set>
<!-- Virtual Hosts-->
<!-- disable cookies
<Get name="sessionHandler">
<Get name="sessionManager">
<Set name="usingCookies" type="boolean">false</Set>
</Get>
</Get>
-->
<!-- Non standard error page mapping -->
<!--
<Get name="errorHandler">
<Call name="addErrorPage">
<Arg type="int">500</Arg>
<Arg type="int">599</Arg>
<Arg type="String">/dump/errorCodeRangeMapping</Arg>
</Call>
</Get>
-->
<!-- Add context specific logger
<Set name="handler">
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><Property name="jetty.logs" default="./logs"/>/test-yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="append">true</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</New>
</Set>
-->
</Configure>
When I'm doing wget from the ec2 instance I'm getting proper index.html page. But if I do it from outside or hit www.mydomain.com from the browser I'm getting request timed out. I've set jetty to listen to http port 80 but no request from outside is coming to jetty. I've created the CNAME record in my domain registrar with the public dns provided in the aws console. IP and dns is resolved correctly but jetty doesn't receive any request. I'm not able to understand the problem in my configuration
Sorry, All the configurations are correct. Actually tcp port 80 was not open from aws console. I just wasted 2 hours to realize that.
Related
I am trying to configure a JDBC-backed Infinispan cache for storing Hibernate Search indices on Wildfly 10/JBoss EAP 7. I have installed the Infinispan 8.1.x Wildfly/JBoss modules from infinispan.org within my application server, and I've FINALLY gotten a basic infinispan.xml file working with file persistence, and now I am trying to change it over to use JDBC for persistence. My infinispan.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:8.1 http://www.infinispan.org/schemas/infinispan-config-8.1.xsd
urn:infinispan:config:jdbc:8.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-8.0.xsd"
xmlns="urn:infinispan:config:8.1" xmlns:jdbc="urn:infinispan:config:store:jdbc:8.0">
<jgroups>
<stack-file name="default-jgroups-udp" path="default-configs/default-jgroups-udp.xml" />
</jgroups>
<cache-container name="HibernateSearch" default-cache="default"
statistics="false" shutdown-hook="DONT_REGISTER">
<transport stack="default-jgroups-udp" />
<jmx duplicate-domains="true" />
<!-- *************************************** -->
<!-- Cache to store Lucene's file metadata -->
<!-- *************************************** -->
<replicated-cache name="LuceneIndexesMetadata" mode="SYNC"
remote-timeout="25000">
<locking striping="false" acquire-timeout="10000"
concurrency-level="500" write-skew="false" />
<transaction mode="NONE" />
<eviction max-entries="-1" strategy="NONE" />
<expiration max-idle="-1" />
<persistence passivation="false">
<file-store preload="true" purge="true"
path="${jboss.server.temp.dir}/indexes" />
</persistence>
<indexing index="NONE" />
<state-transfer enabled="true" timeout="480000"
await-initial-transfer="true" />
</replicated-cache>
<!-- **************************** -->
<!-- Cache to store Lucene data -->
<!-- **************************** -->
<replicated-cache name="LuceneIndexesData" mode="SYNC"
remote-timeout="25000">
<locking striping="false" acquire-timeout="10000"
concurrency-level="500" write-skew="false" />
<transaction mode="NONE" />
<eviction max-entries="-1" strategy="NONE" />
<expiration max-idle="-1" />
<persistence passivation="false">
<string-keyed-jdbc-store xmlns="urn:infinispan:config:store:jdbc:8.0"
fetch-state="false" read-only="false" purge="false">
<data-source jndi-url="java:jboss/datasources/InfinispanCacheDS" />
<string-keyed-table drop-on-exit="false"
create-on-start="true" prefix="ISPN_STRING_TABLE">
<id-column name="ID_COLUMN" type="VARCHAR(255)" />
<data-column name="DATA_COLUMN" type="BINARY" />
<timestamp-column name="TIMESTAMP_COLUMN" type="BIGINT" />
</string-keyed-table>
</string-keyed-jdbc-store>
</persistence>
<!-- <persistence passivation="false"> <file-store preload="true" purge="true"
path="${jboss.server.temp.dir}/indexes" /> </persistence> -->
<indexing index="NONE" />
<state-transfer enabled="true" timeout="480000"
await-initial-transfer="true" />
</replicated-cache>
<!-- ***************************** -->
<!-- Cache to store Lucene locks -->
<!-- ***************************** -->
<replicated-cache name="LuceneIndexesLocking" mode="SYNC"
remote-timeout="25000">
<locking striping="false" acquire-timeout="10000"
concurrency-level="500" write-skew="false" />
<transaction mode="NONE" />
<eviction max-entries="-1" strategy="NONE" />
<expiration max-idle="-1" />
<persistence passivation="false">
<file-store preload="true" purge="true"
path="${jboss.server.temp.dir}/indexes" />
</persistence>
<indexing index="NONE" />
<state-transfer enabled="true" timeout="480000"
await-initial-transfer="true" />
</replicated-cache>
</cache-container>
</infinispan>
I am also using the following jboss-deployment-structure.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
<!-- Core Java/Java EE Dependencies -->
<module name="javax.transaction.api" export="true" services="import" />
<!-- JPA/Hibernate Search Dependencies -->
<module name="javax.persistence.api" export="true" />
<module name="org.hibernate.search.engine" export="true"
services="import" slot="5.5" />
<module name="org.hibernate.search.orm" export="true"
services="import" slot="5.5" />
<module name="org.infinispan.hibernate-search.directory-provider"
slot="for-hibernatesearch-5.5" export="true" services="import" /><!--
<module name="org.apache.lucene" export="true" services="import" /> <module
name="org.infinispan.lucene-directory" slot="ispn-8.1" /> -->
<module name="org.infinispan.core" slot="ispn-8.1" services="import"
export="true" />
<module name="org.infinispan.persistence.jdbc" slot="ispn-8.1"
services="import" export="true" />
<module name="org.infinispan.persistence.remote" slot="ispn-8.1"
services="import" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
However, when I deploy my application I get the following exception:
ISPN000327: Cannot find a parser for element 'string-keyed-jdbc-store' in namespace 'urn:infinispan:config:store:jdbc:8.0'. Check that your configuration is up-to date for this version of Infinispan.
Everything works fine if I change persistence from JDBC to "file". However, once I put in the JDBC parameters I get the parsing error. I'm sure I'm doing something minor and stupid to cause this, but I can't for the life of me figure out what. Any help would be GREATLY appreciated!!
After trying to investigate this problem I ended opening a bug report:
https://issues.jboss.org/browse/ISPN-7572
The problem is that I expected the org.infinispan.core module to depend on its extensions, but this is not the case. I previously mentioned a wokraround, but editing the module XML files is not enough as there's no easy solution which would be able to maintain the isolation of different modules which need to be isolated.
The problem is fixed now, please upgrade to either Infinispan version 9.0.0.Final which will contain the fix, or get Infinispan 8.2.7.Final as I'll backport this fix as well.
When I transit from view state to decision state or action state all the input set is lost while transitioning to another state. How to do I get the flow scope variable for decision state or action state on transitioning from view state to decision state and action state in junit ?
In my flow definition right now I am in view state when I set the event Id as submit it moves to registerEnroll decision state where it needs flowScope.regform.loyaltyLookUp value. When I see the flow execution variable map there is nothing inside apart from RegForm object, even though I have set variable in MutableAttributeMap.
How to set the flow scope variable which will be always available on transitioning to state on junit test case for spring webflow?
In second test case flow is going to else part of decision state even though I have provide flowScope.regform.loyaltyLookUp in input. What mistake I am doing I am not able to figure out .
xml
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd"
start-state="confirmsuccess">
<var name="regform" class="com.shc.ecom.usr.form.Regform" />
<var name="enrollresponse" class="com.shc.ecom.usr.service.adapter.ResponseVO" />
<!-- <input-mapper> <input-attribute name="service" /> <input-attribute
name="regform" /> <input-attribute name="success" /> </input-mapper> <start-state
idref="confirmsuccess" /> -->
<input name="service" />
<input name="regform" />
<input name="success" />
<input name="enrollresponse"/>
<decision-state id="confirmsuccess">
<if test="flowScope.success!=null" then="serviceticketvalidation"
else="saveQueryParamInSession" />
</decision-state>
<decision-state id="serviceticketvalidation">
<if test="flowScope.success=='yes'" then="sywNumAction" else="ssoerrorredirect" />
</decision-state>
<!-- <action-state id="enterCustInfo"> <action bean="regEnrollFormAction"
method="setupForm" > </action> <transition on="success" to="renderform"/>
</action-state> -->
<!-- save query parameter in session -->
<action-state id="saveQueryParamInSession">
<evaluate expression="saveQueryParamInSession.doExecute(flowRequestContext)" />
<transition on="success" to="renderform" />
</action-state>
<view-state id="renderform" view="/regenroll" >
<on-entry>
<evaluate expression="regEnrollFormAction.setupForm(flowRequestContext)" />
<set name="flowScope.sourceSite" value="requestParameters.sid" /> <!-- scope="flow" -->
<set name="flowScope.service" value="requestParameters.service" />
<set name="flowScope.clienthost" value="requestParameters.clienthost" />
<set name="flowScope.target" value="requestParameters.target" />
<set name="flowScope.switchForm" value="requestParameters.switchForm" />
<set name="flowScope.oldlogin" value="requestParameters.oldlogin" />
<set name="flowScope.emailId" value="requestParameters.emailId" />
<set name="flowScope.confirmEmail" value="requestParameters.emailConfirm" />
<set name="flowScope.fname" value="requestParameters.fname" />
<set name="flowScope.lname" value="requestParameters.lname" />
<set name="flowScope.zipCode" value="requestParameters.zip" />
<set name="flowScope.modifyservice" value="requestParameters.modifyservice" />
<set name="flowScope.ocpPage" value="requestParameters.ocpPage" />
<set name="flowScope.fullpage" value="requestParameters.fullpage" />
<set name="flowScope.emailValidateFlag" value="requestParameters.emailValidateFlag" />
<set name="flowScope.mode" value="requestParameters.mode" />
<set name="flowScope.phone" value="requestParameters.phone" />
<set name="flowScope.number" value="requestParameters.number" />
<set name="flowScope.irp" value="requestParameters.irp" />
<set name="flowScope.sywmax" value="requestParameters.sywmax" />
</on-entry>
<transition on="submit" to="registerEnroll">
<evaluate expression="regEnrollFormAction.bindAndValidate(flowRequestContext)"></evaluate>
</transition>
</view-state>
<decision-state id="registerEnroll">
<if test="flowScope.regform.loyaltyLookUp!=null" then="processEnroll"
else="activateEnroll" />
</decision-state>
<action-state id="processEnroll">
<evaluate
expression="ssoGatewayService.register(flowScope.regform,externalContext)" result="flowScope.enrollresponse" result-type="com.shc.ecom.usr.service.adapter.ResponseVO" />
<transition on="success" to="postenroll" />
</action-state>
<decision-state id="postenroll">
<if test="flowScope.enrollresponse.responseCode ==200" then="ccenroll"
else="enrollerror" />
</decision-state>
<decision-state id="ccenroll">
<if test="flowScope.regform.craftsmanAffinity!=null" then="ccAffinityUpdate"
else="go_to_login_flow" />
</decision-state>
<action-state id="ccAffinityUpdate">
<evaluate
expression="ssoGatewayService.updateCCAffinity(flowScope.regform, flowScope.enrollresponse)"
result="enrollresponse" />
<transition on="success" to="postccupdate" />
</action-state>
<decision-state id="postccupdate">
<if test="flowScope.enrollresponse.responseCode==200" then="go_to_login_flow"
else="ccupdateerror" />
</decision-state>
<decision-state id="enrollerror">
<if test="flowScope.enrollresponse.existingUserInd!=null" then="existingUserLogin"
else="captchaValidation" />
</decision-state>
<decision-state id="captchaValidation">
<if test="flowScope.enrollresponse.errorCode eq '401.1'" then="captchaValidationError"
else="loyaltydown" />
</decision-state>
<decision-state id="loyaltydown">
<if test="flowScope.enrollresponse.loyaltyDown!=null" then="loyaltydownerror"
else="showerror" />
</decision-state>
<action-state id="activateEnroll">
<evaluate expression="ssoGatewayService.onlineActivation(flowScope.regform, requestParameters.clienthost,
externalContext, requestParameters.mode, requestParameters.number, requestParameters.phone)"
result = "enrollresponse" />
<transition on="success" to="postenroll" />
</action-state>
<subflow-state id="go_to_login_flow" subflow="shclogin-flow">
<input value="flowScope.regform.password" name="logonPassword"/>
<input value="flowScope.regform.email" name="loginId"/>
<input value="flowScope.regform.sid" name="sourceSiteId"/>
<input value="flowScope.regform.service" name="service"/>
<input value="flowScope.regform.redirectUrl" name="redirectUrl"/>
<input value="flowScope.reglogin" name="reglogin"/>
<input value="flowScope.enrollresponse" name="enrollresponse"/>
<transition on="finish" to="process_and_redirect" />
<transition on="redirect" to="process_and_redirect" />
<transition on="sendtickettomodal_reg" to="sendtickettomodal">
<set name="clienthost" value="requestParameters.clienthost" /> <!-- scope="flow" -->
</transition>
<transition on="pickup_error_redirect_reg" to="ssoerrorredirect" />
<transition on="pickup_error_redirect_login" to="ssoerrorredirect" />
</subflow-state>
<!--
<attribute-mapper>
<input-mapper>
<mapping source="${flowScope.regform.email}" target="loginId" />
<mapping source="${flowScope.regform.password}" target="logonPassword" />
<mapping source="${flowScope.regform.sid}" target="sourceSiteId" />
<mapping source="${flowScope.regform.service}" target="service" />
<mapping source="${flowScope.regform.redirectUrl}" target="redirectUrl" />
<mapping source="${flowScope.reglogin}" target="reglogin" />
<mapping source="${flowScope.enrollresponse}" target="enrollresponse" />
</input-mapper>
</attribute-mapper>
-->
<action-state id="sywNumAction">
<evaluate expression="sywNumSetupAction" />
<transition on="success" to="process_and_redirect" />
</action-state>
<end-state id="process_and_redirect" view="/successconfirmation">
<on-entry>
<set name="sourceSiteId" value="flowScope.regform.sid" />
<set name="sywrNumber" value="flowScope.sywrNumber" />
<set name ="softLinkFlow" value="requestParameters.softLinkFlow" />
<set name ="fullpage" value="requestParameters.fullpage" />
<set name="targetUrl" value="requestParameters.targetUrl" />
</on-entry>
</end-state>
<view-state id="showerror" view="/displayerror">
<on-entry>
<set name="errorCode" value="flowScope.enrollresponse.responseCode" />
<set name="responseString" value="flowScope.enrollresponse.responseString" />
</on-entry>
</view-state>
<view-state id="captchaValidationError" view="/displayerror">
<on-entry>
<set name="errorCode" value="401.1" />
<set name="responseString" value="flowScope.enrollresponse.errorDescription" />
</on-entry>
</view-state>
<view-state id="loyaltydownerror" view="/displayerror">
<on-entry>
<set name="errorCode" value="500.2" />
<set name="responseString" value="flowScope.enrollresponse.responseString" />
</on-entry>
</view-state>
<end-state id="existingUserLogin" view="/existingUserLogin">
<on-entry>
<set name="returnCode" value="'500.110'" />
<set name="clienthost" value="requestParameters.clienthost" />
<set name="emailId" value="flowScope.regform.email" />
</on-entry>
</end-state>
<view-state id="ccupdateerror" view="/ccEnrollError">
<on-entry>
<set name="returnCode" value="'500.111'" />
<set name="clienthost" value="requestParameters.clienthost" />
<set name="emailId" value="flowScope.regform.email" />
</on-entry>
</view-state>
<!-- redirect the next step from login flow -->
<end-state id="ssoerrorredirect" view="/successconfirmationwithssoerror">
<on-entry>
<set name="sourceSiteId" value="flowScope.regform.sid" />
<set name="sywrNumber" value="flowScope.sywrNumber" />
<set name="softLinkFlow" value="requestParameters.softLinkFlow" />
<set name="fullpage" value="requestParameters.fullpage" />
</on-entry>
</end-state>
<!-- adding sywmax parameter for registration flow -->
<end-state id="sendtickettomodal" view="/displayserviceticketandcookie">
<output value="requestScope.syw" name="sywmax"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.syw" x } target="sywmax" />
</output-mapper>
-->
<global-transitions>
<transition to="showerror"
on-exception="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException" />
<transition to="showerror"
on-exception="org.jasig.cas.services.UnauthorizedSsoServiceException" />
<transition to="showerror"
on-exception="org.jasig.cas.services.UnauthorizedServiceException" />
<transition to="showerror"
on-exception="org.springframework.webflow.execution.FlowExecutionException" />
</global-transitions>
<!-- <bean-import resource="regenroll-beans.xml" /> -->
</flow>
Test case
Second Test is failing
public class TestRegEnrollFlow extends AbstractXmlFlowExecutionTests {
SavingQueryParamInSessionAction saveQueryParamInSession;
SSOGatewayServiceImpl ssoGatewayService;
#Override
protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) {
return resourceFactory.createFileResource("src/main/webapp/WEB-INF/usr/flows/regEnroll-flow.xml");
}
#Override
protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) {
// I Have tried even mocking using Easy Mock
saveQueryParamInSession = EasyMock.createMock("saveQueryParamInSession", SavingQueryParamInSessionAction.class);
ssoGatewayService = EasyMock.createMock("ssoGatewayService", SSOGatewayServiceImpl.class);
builderContext.registerBean("saveQueryParamInSession", saveQueryParamInSession);
builderContext.registerBean("sywNumSetupAction", new SywNumSetupAction());
builderContext.registerBean("ssoGatewayService", ssoGatewayService);
builderContext.registerBean("regEnrollFormAction", new RegEnrollFormAction());
}
public void testAction() {
MockExternalContext ctx = new MockExternalContext();
MutableAttributeMap input = new LocalAttributeMap();
input.put("service", "");
input.put("regform", createRegistrationForm());
// this is the line where we are changing the state flow
input.put("success", null);
input.put("externalContext", ctx);
input.put("enrollresponse.responseCode", 200);
input.put("regform.craftsmanAffinity", "any");
startFlow(input, ctx);
assertFlowExecutionActive();
assertCurrentStateEquals("renderform");
assertResponseWrittenEquals("/regenroll", ctx);
}
public void testREgForm() throws Exception {
setCurrentState("renderform");
MockExternalContext context = new MockExternalContext();
context.putRequestParameter("sid", "3");
context.putRequestParameter("service", "qa.ecom.s.com:4380");
context.putRequestParameter("clienthost", "qa.ecom.s.com:4380");
context.putRequestParameter("target", "http://qa.ecom.sears.com:4380/?storeId=10153&catalogId=12605");
context.putRequestParameter("switchForm", "Donald");
context.putRequestParameter("oldlogin", "Donald");
context.putRequestParameter("emailId", "jadiya#gmail.com");
context.putRequestParameter("emailConfirm", "jadiya#gmail.com");
context.putRequestParameter("fname", "Ankur");
context.putRequestParameter("lname", "Jadiya");
context.putRequestParameter("zip", "56005");
context.putRequestParameter("modifyservice", "no");
context.putRequestParameter("ocpPage", "no");
context.putRequestParameter("fullpage", "no");
context.putRequestParameter("emailValidateFlag", "true");
context.putRequestParameter("mode", "active");
context.putRequestParameter("phone", "8884911391");
context.putRequestParameter("number", "883427");
context.putRequestParameter("irp", "true");
context.putRequestParameter("sywmax", "1234567");
context.putRequestParameter("enrollresponse.responseCode","200");
FlowExecution flowExecution = getFlowExecution();
FlowSession session = flowExecution.getActiveSession();
//flowExecution.getConversationScope().put("flowScope.enrollresponse.responseCode", 200);
session.getScope().put("flowScope.regform.loyaltyLookUp", true);
//session.getScope().put("flowScope.enrollresponse.responseCode", "200");
// session.getScope().put("flowScope.enrollresponse", 200);
//session.getScope().put("responseCode", 200);
session.getScope().put("flowScope.regform.craftsmanAffinity", "check");
/*session.getScope().put("enrollresponse.responseCode", 200);*/
// session..put("flowScope.enrollresponse.responseCode", 200);
updateFlowExecution(flowExecution);
ResponseVO value = new ResponseVO(200, "success");
session.getScope().put("enrollresponse", value);
session.getScope().put("flowScope.enrollresponse.responseCode", value);
context.setEventId("submit");
// EasyMock.expect(ssoGatewayService.register(createRegistrationForm(), context)).andReturn(value);
flowExecution.resume(context);
assertCurrentStateEquals("showerror");
}
private Regform createRegistrationForm() {
Regform regform = new Regform();
regform.setEmail("20130410111#gmail.com");
regform.setLname("mike");
regform.setFname("sun");
regform.setPassword("test11");
regform.setSid("3");
regform.setZip("60179");
regform.setLoyaltyLookUp(true);
return regform;
}
}
Error
Caused by: org.springframework.binding.expression.PropertyNotFoundException: Property not found
at org.springframework.binding.expression.spel.SpringELExpression.setValue(SpringELExpression.java:117)
at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:80)
at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
... 36 more
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1010E:(pos 0): Property or field 'enrollresponse' cannot be set on object of type 'org.springframework.webflow.engine.impl.RequestControlContextImpl' - maybe not public?
at org.springframework.expression.spel.ast.PropertyOrFieldReference.writeProperty(PropertyOrFieldReference.java:270)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.setValue(PropertyOrFieldReference.java:159)
at org.springframework.expression.spel.standard.SpelExpression.setValue(SpelExpression.java:411)
at org.springframework.binding.expression.spel.SpringELExpression.setValue(SpringELExpression.java:114)
... 40 more
you are setting this property:
input.put("enrollresponse.responseCode", "200");
but:
I don't see it anywhere in your flow (maybe in the part you omitted)
You have to first create the enrollresponse object before setting "responseCode" on it. I think that is causing the error you are having
[EDIT]
you also need to specify the scope for variable in <set> element (showrror state). replace:
<set name="errorCode" value="flowScope.enrollresponse.responseCode" />
by
<set name="viewScope.errorCode" value="flowScope.enrollresponse.responseCode" />
fix all those issues and try again
I need to send just one request (can be a proxy url) which takes user id as input and call multiple endpoints and return the response after aggregating all of them.
Currently I am using a proxy service implementation to achieve it but is returns just one response(can be from any of the endpoints) and not able to combine responses from other systems/endpoints. Though I can see the response from another endpoint in my server console.
Below is the code I implemented so far:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ProxyTestTwoW"
transports="http,https"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log/>
<clone>
<target>
<sequence>
<property name="Application" value="Application1"/>
<property name="messageType"
value="application/xacml+json"
scope="axis2"
type="STRING"/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('username:password'))"
scope="transport"/>
<send>
<endpoint>
<address uri="localhost:8080/iiq/rest/identities/9000070"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<property name="Application" value="Application2"/>
<property name="messageType"
value="application/xacml+json"
scope="axis2"
type="STRING"/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('username:password'))"
scope="transport"/>
<send>
<endpoint>
<address uri="http://localhost:8080/iiq/rest/identities/9000071"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<log level="full" description="">
<property name="Component" expression="get-property('Application')"/>
</log>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="$body/*[1]">
<property name="messageType"
value="application/xacml+json"
scope="axis2"
type="STRING"
description="messageType"/>
<send/>
</onComplete>
</aggregate>
</outSequence>
<faultSequence>
<log level="full" category="WARN"/>
</faultSequence>
</target>
<description/>
</proxy>
Result :
After hitting proxy URL in browser: - Only one response as below:
<jsonObject><viewableIdentityAttributes><Email>Kevin.Mollo#companyb.com</Email><cn>Kevin Mollo</cn><Last Name>Mollo</Last Name><First Name>Kevin</First Name></viewableIdentityAttributes><listAttributes>First Name</listAttributes><listAttributes>Last Name</listAttributes><listAttributes>Email</listAttributes><listAttributes>cn</listAttributes></jsonObject>
In server logs:
[2016-07-14 11:46:35,057] INFO - LogMediator To: http://www.w3.org/2005/08/addr
essing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:3beaaf16-7b94-4e
08-a3e0-7605869572c7, Direction: response, Component = Application1, Payload: {"vi
ewableIdentityAttributes":{"Email":"Kevin.Mollo#companyb.com","cn":"Kevin Mollo"
,"Last Name":"Mollo","First Name":"Kevin"},"assignedRoles":[],"listAttributes":[
"First Name","Last Name","Email","cn"]}
[2016-07-14 11:46:35,057] INFO - LogMediator To: http://www.w3.org/2005/08/addr
essing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:c878c7db-ad4c-49
46-94d6-75aebc75ad8e, Direction: response, Component = Application1, Payload: {"vi
ewableIdentityAttributes":{"Email":"Michelle.Lassauze#companyb.com","cn":"Michel
le Lassauze","Last Name":"Lassauze","First Name":"Michelle"},"assignedRoles":[],
"listAttributes":["First Name","Last Name","Email","cn"]}
As we can see I get responses from both the endpoints in server logs.
As per analysis, I feel to make it work properly and get the responses from both the endpoints, we need change the following:
1. Using call mediator instead of send if we have multiple endpoints to be called.
2. Using enrich mediator to store the responses.
I tried following the above approaches but I am unable to get the expected results as I am not sure how to use enrich mediator in this case.
Please help me in fixing the above issues.
Clone mediator will be used to send identical copies of message to different endpoints.
Iterate mediator will be used to send message chunks of one particular message to different endpoints.
Enrich mediator will be used to change message (Ex: removing content, adding etc.) [1]
Check your endpoints and check whether they provide proper responses to work with aggregate mediator.
I add sample scenario here. You can test that with your ESB pack to understand the above three mediators usage. You just have to start 2 instances of SimpleStockQuote service [2] and publish message to proxy via SOAPUI.
<proxy name="ScatterGatherProxy" startOnLoad="true" trace="disable" transports="https http">
<description/>
<target>
<inSequence>
<clone>
<target>
<sequence>
<send>
<endpoint name="vendorA">
<address uri="http://localhost:9001/services/SimpleStockQuoteService/"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<send>
<endpoint name="vendorB">
<address uri="http://localhost:9002/services/SimpleStockQuoteService/"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<log level="full"/>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="//m0:return"
xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd">
<enrich>
<source clone="true" xpath="//m0:return[not(preceding-sibling::m0:return/m1:last <= m1:last) and not(following-sibling::m0:return/m1:last < m1:last)]"/>
<target type="body"/>
</enrich>
<send/>
</onComplete>
</aggregate>
</outSequence>
</target>
</proxy>
If you need further assistance, please attach more details like responses of your service.
[1] http://dilshanilive.blogspot.com/2016/03/enrich-mediator-wso2-esb.html
[2] https://docs.wso2.com/display/ESB490/Setting+Up+the+ESB+Samples#Starting%20the%20Axis2%20server
I'm required to write a script that can remove a commented block in xml file, and save it back to its directory.
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool -->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">10000</Set>
<Set name="detailedDump">false</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<!--
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
-->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
<Set name="statsOn">false</Set>
</New>
</Arg>
</Call>
</Configure>
on this xml
How can I comment out this block only?
<!--
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
-->
I have tried it with this but
require 'nokogiri'
file = File.read("jetty.xml")
xml = Nokogiri::XML(file)
#replace <!-- --> with a space
xml.xpath("//comment()").each do |node|
node.content =node.content.gsub!(/(^\D\W[<!\-\-}]\W[\-\->])/,' ')
end
File.open("newjetty.xml","w") do |f|
f.write xml.to_xml
end
this code only remove the text within the comment
Output:
<!---->
<!---->
<!---->
<Set name="ThreadPool">
<!---->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">10000</Set>
<Set name="detailedDump">false</Set>
</New>
</Set>
<!---->
<!---->
<!---->
<!---->
<!---->
You should delete the node, as it is a comment node. You can use the inner text to parse it and add it again.
require 'nokogiri'
file = File.read("jetty.xml")
xml = Nokogiri::XML(file)
#replace <!-- --> with a space
xml.xpath("//comment()").each do |node|
t = Nokogiri::XML::DocumentFragment.parse(node.content)
node.add_next_sibling(t)
node.remove
end
File.open("newjetty.xml","w") do |f|
f.write xml.to_xml
end
Here you are parsing the comments content, add it as the next sibling and remove the node itself.
This basically works, however the string-only contents are also added as nodes, making this a mixed content document, which you most certainly do not want for a jetty configuration file.
So there should also be some logic included that checks for the node type (text versus element) and only includes elements.
I've recently started experimenting with a Message exchange between WSO2 ESB's via WSO2's MB for a requirement. Created a JMS sender Proxy Service which concatenates endpoint URL based on SOAP Input (used Header property and defaultEndpoint).
On Message Broker:
Have set up a Hierarchical topic as
Root|
Node1
Node2
With 3 users and their specific roles as Root, Node1, Node2. Requirement is Node 1 should be able to subscribe for both Node 1 and Root, Similarly for Node2, Only Node2 and Root.
The problem is When creating a proxy service subscriber can only set it to subscribe one Node only (Root or Node1 or Node2). Tried setting destination as Root.# but then All Nodes are subscribed (even when Node USer is not set to Subscribe the other based on Role based Topic access). Following is the code for subscriber
enter code here
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Subscriber_Node2"
transports="jms"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<log level="full"/>
<log level="custom" separator="###">
<property name="STATE"
value="**************** RECEIVED AT Node 2 ***************"/>
</log>
<drop/>
</inSequence>
<outSequence/>
<faultSequence>
<log level="custom">
<property name="text" value="An unexpected error occured"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
<property name="code" expression="get-property('ERROR_CODE')"/>
<property name="detail" expression="get-property('ERROR_DETAIL')"/>
<property name="exception" expression="get-property('ERROR_EXCEPTION')"/>
</log>
</faultSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="java.naming.factory.initial">
org.wso2.andes.jndi.PropertiesFileInitialContextFactory
</parameter>
<parameter name="transport.jms.ConnectionFactory">
Store2TopicConnectionFactory</parameter>
<parameter name="java.naming.provider.url">
repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.DestinationType">topic</parameter>
<parameter name="transport.jms.Destination">HQ.Store_2</parameter>
<description/>
</proxy>
jndi.properties:
connectionfactory.Node1TopicConnectionFactory = amqp://Node1:Node1#clientID/carbon?
brokerlist='tcp://localhost:5680'
connectionfactory.Node2TopicConnectionFactory = amqp://Node2:Node2#clientID/carbon?
brokerlist='tcp://localhost:5680'
connectionfactory.RootTopicConnectionFactory = amqp://Root1:Root1#clientID/carbon?
brokerlist='tcp://localhost:5680'
topic.Root = Root
topic.Root.Node1 = Root.Node1
topic.Root.Node2 = Root.Node2
Is there a way a Subscriber can subscribe to Multiple Topics in a hierrarchy and its access be controlled by User and Role?