Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Uncomment (or compile with at least these modules using --enable)

Code Block
\#LoadModule proxy_module modules/mod_proxy.so
\#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
\#LoadModule ssl_module modules/mod_ssl.so

Set ServerAdmin, ServerName

Add something like

Code Block
ProxyRequests Off

<Proxy \*>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddDefaultCharset off
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order deny,allow
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Allow from all
</Proxy>

\# Enable/disable the handling of HTTP/1.1 "Via:" headers.
\# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
\# Set to one of: Off \| On \| Full \| Block
ProxyVia On

NameVirtualHost \*:80

<VirtualHost \*:80>
&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; General setup for the virtual host
&nbsp;&nbsp;&nbsp; DocumentRoot "/usr/local/apache2/htdocs"
&nbsp;&nbsp;&nbsp; ErrorLog logs/error_log
&nbsp;&nbsp;&nbsp; TransferLog logs/access_log

&nbsp;&nbsp;&nbsp; ServerName lamouline.myvnc.com
&nbsp;&nbsp;&nbsp; ServerAdmin webmaster@les7arts.com

&nbsp;&nbsp;&nbsp; ProxyRequests Off
&nbsp;&nbsp;&nbsp; ProxyPreserveHost On
&nbsp;&nbsp;&nbsp; proxyPass / ajp://localhost:8009/
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp; RewriteEngine On
&nbsp;&nbsp;&nbsp; RewriteRule \^/(images/.+);jsessionid=\w+$ /$1&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;
</VirtualHost>

include conf/httpd-ssl.conf
In httpd-ssl.conf

replace

Code Block
<VirtualHost \_default_:443>

\#&nbsp;&nbsp; General setup for the virtual host
DocumentRoot "/usr/local/apache2/htdocs"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog "/usr/local/apache2/logs/error_log"
TransferLog "/usr/local/apache2/logs/access_log"

by

Code Block
<VirtualHost \*:443>
&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; General setup for the virtual host
&nbsp;&nbsp;&nbsp; DocumentRoot "/usr/local/apache2/htdocs"
&nbsp;&nbsp;&nbsp; ErrorLog "/usr/local/apache2/logs/error_log"
&nbsp;&nbsp;&nbsp; TransferLog "/usr/local/apache2/logs/access_log"

&nbsp;&nbsp;&nbsp; ServerName lamouline.myvnc.com
&nbsp;&nbsp;&nbsp; ServerAdmin webmaster@les7arts.com

&nbsp;&nbsp;&nbsp; ProxyRequests Off
&nbsp;&nbsp;&nbsp; ProxyPreserveHost On
&nbsp;&nbsp;&nbsp; proxyPass / ajp://localhost:8009/
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; RewriteEngine On
&nbsp;&nbsp;&nbsp; RewriteRule \^/(images/.+);jsessionid=\w+$ /$1&nbsp;&nbsp;&nbsp;&nbsp;

...

Mounting Ofbiz application as show below will forward every request to Ofbiz including request for static resources such as images.

Code Block
proxyPass / ajp://localhost:8009/

To mound individual application, use the below mentioned method. You will need to do this for all your application accept the one you want to be served by Apache Web Server e.g. /images

Code Block
<Location /accounting/>
       ProxyPass ajp://localhost:9009/accounting/
 </Location>

Configure the Images folder in the Apache as shown below:

Code Block
<Directory /var/www/xxxx/images/>
       Options Indexes FollowSymLinks
       AllowOverride None
       Order allow,deny
       allow from all
    </Directory>

...

Here an example based on one of my test (http://labs.libre-entreprise.org/plugins/scmcvs/cvsweb.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/TestCreateNomenclature.html?rev=1.6;content-type=text%2Fplain;cvsroot=neogia)

Code Block
<!-- create a variable named uid that contains an unique identifier -->
<tr>
       <td>store</td>
       <td>javascript{(new Date()).getTime() % 10000}</td>
       <td>uid</td>
</tr>

...

3) What is the difference between click and clickAndWait ? I would like to understand why I'm getting different behaviors from click and clickAndWait functions. Here is the scenario: I want to perform the login and then verify some text on the page (what should be pretty straight forward...) My first approach was  using the clickfunction + pause function. Something like below:<tr>

Code Block

<tr>
    <td>click</td>

...


    <td>submit</td>

...


    <td></td>

...


</

...

tr>
<tr>
    <td>pause</td>

...


    <td>3000</td>

...


    <td></td>

...


</tr>

The approach above worked fine and I was able to proceed with my test. However, I was looking the clickAndWait functionality and, per my understanding, this function should have a simlar behavior to my code above.. then I wrote the following:

Code Block
<tr>
    <td>clickAndWait</td>
    <td>submit</td>
    <td></td>
</tr>

The code above is getting a "Permission Denied" message. I already check the URLs and I'm not launching a different domain (before I click I have http://domain/Login/ and after the submission I have http://domain/App/).

I think the right solution is to use clickAndWait command instead of click+pause because it always success contrary to click+pause (we dont known the page response time). I see no reason why you don't observe the same behavior with clickAndWait. Maybe it's because your are testing the login page that can be a little tricky to test due to the session handling.
To be sure to always start a test in a clean session, my tests always do the same actions :
1. logoff
2. login
3. check error
Here, an example of my standard login procedure under selenium  from (http://labs.libre-entreprise.org/plugins/scmcvs/cvsweb.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/TestProcessRouting.html?rev=1.2;content-type=text%2Fplain;cvsroot=neogia)

Code Block
<!-- Begin of standard login procedure -->
<tr>
 <td>open</td>
 <td>/manufacturing/control/logout</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>USERNAME</td>
 <td>admin</td>
</tr>
<tr>
 <td>type</td>
 <td>PASSWORD</td>
 <td>ofbiz</td>
</tr>
<tr>
 <td>select</td>
 <td>locale</td>
 <td>value=fr</td>
</tr>
<tr>
 <td>clickAndWait</td>
 <td>submitButton</td>
 <td></td>
</tr>
<tr>
 <td>assertElementNotPresent</td>
 <td>//div[@class='errorMessage']</td>
 <td></td>
</tr>
<!-- End of standard login procedure -->

...

Add the $OFBIZ/framework/base/config dir to the jar as a <resource> in your build file (Maven's pom.xml example, to be adapted for ant)

Code Block
<resources>
      <resource>
        <directory>../../../framework/base/config</directory>
      </resource>
      <resource>
        <directory>../../../framework/base/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/datafile/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/entity/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/entityext/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/minilang/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/security/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/service/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/widget/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/workflow/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/applications/content/dtd</directory>
      </resource>
    </resources>

...

Add a entity-resource entry of type "data" and reader-name as "ext" in ofbiz-components.xml of your application. For example:

Code Block
<entity-resource type="data" reader-name="ext" loader="main" location="data/GeoData_IN.xml"/>

And run the

Code Block
"run-install-extseed"

ant target instead of

Code Block
"run-install"

This should load your modified data along with the seed data and without any demo data.

...

Issue with createAcctgTransAndEntries service

If you see errors like

Error:Error trying to begin transaction, could not process method: The
current transaction is marked for rollback, not beginning a new
transaction
and aborting current operation; the rollbackOnly was caused by: Service
createAcctgTransAndEntries threw an unexpected
exception/errororg.ofbiz.service.ServiceValidationException: The following
required parameter is missing: OUT
createAcctgTransAndEntries.acctgTransId (The following required
parameter
is missing: OUT createAcctgTransAndEntries.acctgTransId) calling
service
balanceInventoryItems in receiveInventoryProduct

...

From a thread by Chris Howe and David Jones
Chris Howe: Lets say that I want to create an application that most closely matches the ecommerce app. I should start with copied versions the following files only.

Code Block
ofbizhome/specialized/myapp/build.xml
ofbizhome/specialized/myapp/ofbiz-component.xml
ofbizhome/specialized/myapp/webapp/myapp/WEB-INF/controller.xml
ofbizhome/specialized/myapp/webapp/myapp/WEB-INF/web.xml
ofbizhome/specialized/myapp/webapp/myapp/index.jsp

...

(For instance we are extending the Marketing component.)
1) Inside webapp of your customize application create a folder for component name. (marketing/WEB-INF)
2) Add controller.xml, web.xml
3) In controller.xml file include the  <include location="component://marketing/webapp/marketing/WEB-INF/controller.xml"/>
4) In ofbiz-component.xml (hot-deploy/customize_project/)
add following code :
<webapp name="marketing" title="Marketing-Customized" server="default-server" location="webapp/marketing" base-permission="OFBTOOLS,MARKETING" mount-point="/marketing"/>
(extending marketing component here.)Now here the basic setup for extend the component is completed, now you can add component specific request and view in controller.xml here. And create screens in the extanded componint.  Note : Please add if some of the information is missing here.
 

What is considered the best practice in creating a custom web application with OFBIZ?

...

  1. In framework/base/config/limited-containers.xml replace (or better comment out during tests)
    Code Block
    <property name="client-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory"/>
    <property name="server-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
    <property name="ssl-client-auth" value="true"/>
    

by

Code Block
<property name="client-factory" value="org.ofbiz.service.rmi.socket.zip.CompressionClientSocketFactory"/>
<property name="server-factory" value="org.ofbiz.service.rmi.socket.zip.CompressionServerSocketFactory"/>
<property name="ssl-client-auth" value="false"/>

...