Page 1 of 1

custom credit card module was not picked up

Posted: Thu Mar 24, 2011 11:23 pm
by TTLee
I am able to run the demoappwtp based on http://www.broadleafcommerce.org/conflu ... ipse+-+WTP

Then I try to customize the payment workflow by following http://www.broadleafcommerce.org/conflu ... figuration

I created two java class:
my own credit module com.rrhui.payment.service.module.CreditCardModule.
my own payment service com.rrhui.payment.service.PaymentServiceImpl

I also created my own. /WEB-INF/applicationContext-custom-payment.xml,

----
<bean id="blCreditCardService" class="com.rrhui.payment.service.PaymentServiceImpl">
<property name="paymentModule" ref="myCreditCardModule"/>
</bean>


<bean id="myCreditCardModule" class="com.rrhui.payment.service.module.CreditCardModule">
<property name="param1" value="value1"/>
</bean>

--------

and add it to the web.xml as
<display-name>BroadleafCommerceDemo</display-name>

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>bl.root</param-value>
</context-param>
<context-param>
<param-name>patchConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext-custom.xml
/WEB-INF/applicationContext-custom-payment.xml
/WEB-INF/applicationContext-email.xml
/WEB-INF/applicationContext-search.xml
/WEB-INF/applicationContext-security.xml
</param-value>
</context-param>
.....

Then, I restart the eclipse-tomcat server, and I go through the shopping-checkout flow from http://localhost:8081/broadleafdemo.

My runtime parameter is as
-Xmx512m -XX:MaxPermSize=512M
-Dcatalina.base="D:\MyWork\RRuriProject\broadleaf\.metadata\.plugins\org.eclipse.wst.server.core\tmp0" -Dcatalina.home="D:\ProgramFiles\apache-tomcat-6.0.32" -Dwtp.deploy="D:\MyWork\RRuriProject\broadleaf\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps" -Djava.endorsed.dirs="D:\ProgramFiles\apache-tomcat-6.0.32\endorsed"

the java class was compiled under D:\MyWork\RRuriProject\broadleaf\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps.

However, my credit card module was not picked up at all.

I notice the payment workflow was launched by the checkout workflow, but it should still use my new creditcard module, right?

Did I missing any steps.

Re: custom credit card module was not picked up

Posted: Mon Mar 28, 2011 3:34 pm
by jefffischer
Thanks for your question. The first thing to check is the merged application context that Spring is seeing to make sure that your custom bean definitions are actually making it through. There is a log4j.properties file in the WEB-INF directory of the demo. Change the log4j.category.org.broadleafcommerce property from WARN to DEBUG. Now, when you start your server, you should see a lot of additional output to the console. Most of this will be the merged application context. Search through this output and make sure your new, custom bean definitions are making it. If not, then confirm that your changed web.xml is actually making it to your target build that Tomcat is running on.

Re: custom credit card module was not picked up

Posted: Mon Mar 28, 2011 6:14 pm
by TTLee
Thank you for the info.

But i can not find the log4j.properties at src\site\BroadleafCommerceDemo.

instead it is at src\core\BroadleafCommerceProfile\src\main\resources\.

or should I create log4j.properties myself ?

Re: custom credit card module was not picked up

Posted: Thu Mar 31, 2011 6:20 am
by jefffischer
Sorry - sometimes I get confused between version 1.5 and 1.1. The best answer is to create the log4j.properties files yourself inside the WEB-INF directory. Then, you'll need to add the following to your web.xml (put this right before your MergeContextLoaderListener declaration):

Code: Select all

<!-- enable configured logging -->
<context-param>
   <param-name>log4jConfigLocation</param-name>
   <param-value>/WEB-INF/log4j.properties</param-value>
</context-param>

<listener>
   <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>


Here's an example of what you could put in that log4j.properties file to achieve this goal:

Code: Select all

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%5p] %d{HH:mm:ss} %c{1} - %m%n

log4j.rootLogger=WARN, stdout

log4j.category.org.broadleafcommerce=DEBUG
log4j.category.org.springframework=WARN
log4j.category.org.hibernate=INFO