Page 2 of 3

Re: How obtain stable version?

Posted: Sun Jun 02, 2013 4:20 pm
by Eustace
Could you help? What way the two different war files can be deployed if they use the same database tables?

Re: How obtain stable version?

Posted: Mon Jun 03, 2013 2:10 pm
by Eustace
Please advise. I cannot proceed to researche broadleaf.

Re: How obtain stable version?

Posted: Mon Jun 03, 2013 5:36 pm
by phillipuniverse
The problem you're running into is probably because the default memory allocation for the JVM is too small. I wouldn't try to run both applications at the same time without giving the JVM at least 1GB of memory.

If you're in Tomcat, create/modify setenv.sh in the bin/ directory (the same directory that catalina.sh is in) and add the following:

export CATALINA_OPTS="-XX:MaxPermSize=512M -Xmx1024M"

This will expand the JVM heap to 1GB and the PermSize (which is what the JVM uses to essentially store classes loaded into memory) to 512MB.

Re: How obtain stable version?

Posted: Mon Jun 03, 2013 5:38 pm
by phillipuniverse
And yes, to answer your question, you should be able to deploy both site and admin in the same Tomcat container.

Also, make sure that in your setenv.sh file you are exporting CATALINA_OPTS rather than JAVA_OPTS. If you give that to JAVA_OPTS then it will not actually make any difference to the Tomcat container (which is what's running out of memory).

Re: How obtain stable version?

Posted: Tue Jun 04, 2013 7:37 am
by Eustace
Thank you for answer.
But I stil cannot understand how these two separate war files interact?
1) mycompany.war has own persistence context and admin.war has own persistence context. But both persistence contexts uses the same tables. For example the entity from blc_address can be created inside persistence context of mycompany, and the same entity can be created inside persistence context of admin application. They will be in different persistence context but will try to change the state of the same table. Is it correct?

2) when I make the deploy mycompany.war all tables will be dropped and created. The same happens when make the I deploy admin.war, correct?
So what war should be deployed primarily?

Re: How obtain stable version?

Posted: Tue Jun 04, 2013 11:41 am
by phillipuniverse
So both wars should be deployed if you want to access both the site and admin. The reason they are split into 2 wars is so that you can deploy them on different Tomcat containers and completely different servers if you want. In a high-traffic environment, you will usually have a large number of application servers that only have the mycompany.war application deployed in the single Tomcat instane, while admin.war is deployed on some other server.

That's why there are 2 separate wars. Previously we had a 'combined' war that attempted to merge the resources in-between the admin and site to produce a single war that ran 2 unique servlet contexts but that has been deprecated. If you look at older versions of Broadleaf you can see it still around (it was removed in this commit: https://github.com/BroadleafCommerce/De ... 93808a2a54).

1) mycompany.war has own persistence context and admin.war has own persistence context. But both persistence contexts uses the same tables. For example the entity from blc_address can be created inside persistence context of mycompany, and the same entity can be created inside persistence context of admin application. They will be in different persistence context but will try to change the state of the same table. Is it correct?


Yes.

2) when I make the deploy mycompany.war all tables will be dropped and created. The same happens when make the I deploy admin.war, correct?
So what war should be deployed primarily?


If you want them to both run on the same Tomcat instance, then you should deploy them both. In the default configuration, the admin starts up with its ddl set to 'none' so it won't do anything (you can see this in development.properties in the admin project). The site starts up with create-drop (in development.properties in the site project) which means it will start up and run all of the import sql files that are located in core. When you shut the application down (stop tomcat) then all the tables will be dropped, and then recreated again on startup.

Re: How obtain stable version?

Posted: Wed Jun 05, 2013 4:11 am
by Eustace
Thank you for explanation.
I set these settings : export CATALINA_OPTS="-XX:MaxPermSize=512M -Xmx1024M"
admin.war was deployed, mycompany.war was deployed as well.
This exception occurs while deploying mycompany.war:

Code: Select all

org.hibernate.tool.hbm2ddl.ImportScriptException: Error during statement execution (file: '/sql/load_catalog_data.sql'): INSERT INTO BLC_FIELD (FIELD_ID, ENTITY_TYPE, PROPERTY_NAME, ABBREVIATION, SEARCHABLE, FACET_FIELD_TYPE) VALUES (1,  'PRODUCT', 'manufacturer', 'mfg', 1, 's')                                                                                                                                                                                                   
        at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:451)                                                                                                                                                       
        at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:378)     
.....
Caused by: org.postgresql.util.PSQLException: ERROR: column "searchable" is of type boolean but expression is of type integer
  You will need to rewrite or cast the expression.
  Position 151
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)


The link http://localhost:8080/mycompany/ works
But if I trying to click "Register" link https://localhost:8443/mycompany/regist ... 2738788F76 doesn't work.

The link http://localhost:8080/admin/ works, shows the form for login and password.
I enter admin-admin. The admin dashboard opens.
I click Add Category, fill fields, click Save. An error occurred message appears.
I see this exception in Tomcat console:

Code: Select all

[ERROR] 11:56:37 BasicPersistenceModule - Error getting primary key
java.lang.NumberFormatException: null
        at java.lang.Long.parseLong(Long.java:375)
        at java.lang.Long.valueOf(Long.java:525)
        at org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.getPrimaryKey(BasicPersistenceModule.java:605)
        at org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.add(BasicPersistenceModule.java:784)
        at org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.add(BasicPersistenceModule.java:742)


I click the "An error occurred" message.
Tomcat console shows:

Code: Select all

A soft-locked cache entry was expired by the underlying Ehcache. If this happens regularly you should consider increasing the cache timeouts and/or capacity limits
[ERROR] 11:56:37 TemplateEngine - [THYMELEAF][3] Exception processing template "utility/blcRedirect": Error resolving template "utility/blcRedirect", template might not exist or might not be accessible by any of the configured Template Resolvers
[ERROR] 11:58:17 TemplateEngine - [THYMELEAF][7] Exception processing template "modules/modalContainer": Exception evaluating SpringEL expression: "fields['defaultSku.skuMedia---primary'].media.url" (fields/media:5)
[ERROR] 11:59:17 TemplateEngine - [THYMELEAF][9] Exception processing template "modules/modalContainer": Exception evaluating SpringEL expression: "fields['defaultSku.skuMedia---primary'].media.url" (fields/media:5)



Can you help?
The demosite was obtained from this link:
http://www.broadleafcommerce.org/worksp ... ersion=dev

Re: How obtain stable version?

Posted: Wed Jun 05, 2013 9:05 am
by phillipuniverse
Try changing to BLC version 3.0.0-BETA3: viewtopic.php?f=13&t=1885

I'll be putting out the BETA3 version today.

Re: How obtain stable version?

Posted: Thu Jun 06, 2013 9:07 am
by Eustace
I changed version to BETA-3.
It was uploaded.
But compilation error occured:

Code: Select all

/Projects/Broadleaf/DemoSite-3.0.0/site/src/main/java/com/mycompany/api/endpoint/cart/CartEndpoint.java:[75,20] cannot find symbol
symbol  : method addSkuToOrder(javax.servlet.http.HttpServletRequest,javax.ws.rs.core.UriInfo,java.lang.Long,java.lang.Long,java.lang.Long,int,boolean)
location: class org.broadleafcommerce.core.web.api.endpoint.order.CartEndpoint

/Projects/Broadleaf/DemoSite-3.0.0/site/src/main/java/com/mycompany/api/endpoint/cart/CartEndpoint.java:[65,4] method does not override or implement a method from a supertype


What repositories should be set?

Re: How obtain stable version?

Posted: Thu Jun 06, 2013 9:38 am
by Eustace
I commented out the method in CartEndpoint class

Code: Select all

//    @POST
//    @Path("{categoryId}/{productId}")
//    public OrderWrapper addSkuToOrder(@Context HttpServletRequest request,
//            @Context UriInfo uriInfo,
//            @PathParam("categoryId") Long categoryId,
//            @PathParam("productId") Long productId,
//            @QueryParam("skuId") Long skuId,
//            @QueryParam("quantity") @DefaultValue("1") int quantity,
//            @QueryParam("priceOrder") @DefaultValue("true") boolean priceOrder) {
//        return super.addSkuToOrder(request, uriInfo, categoryId, productId, skuId, quantity, priceOrder);
//    }


While deploying exception occured :

Code: Select all

[ERROR] 17:16:33 SchemaExport - HHH000389: Unsuccessful: alter table BLC_CUSTOMER_ADDRESS add constraint key1 unique (CUSTOMER_ID, ADDRESS_NAME)                                                                                             
[ERROR] 17:16:33 SchemaExport - ERROR: relation "key1" already exists                                                                                                                                                                       
[ERROR] 17:16:33 SchemaExport - HHH000389: Unsuccessful: alter table BLC_CUSTOMER_PAYMENT add constraint key1 unique (CUSTOMER_ID, PAYMENT_TOKEN)                                                                                           
[ERROR] 17:16:33 SchemaExport - ERROR: relation "key1" already exists                                                                                                                                                                       
[ERROR] 17:16:33 SchemaExport - HHH000389: Unsuccessful: alter table BLC_CUSTOMER_PHONE add constraint key1 unique (CUSTOMER_ID, PHONE_NAME)                                                                                               
[ERROR] 17:16:33 SchemaExport - ERROR: relation "key1" already exists                                                                                                                                                                       
[ERROR] 17:16:49 SchemaExport - HHH000231: Schema export unsuccessful                                                                                                                                             
org.hibernate.tool.hbm2ddl.ImportScriptException: Error during statement execution (file: '/sql/load_catalog_data.sql'): INSERT INTO BLC_FIELD (FIELD_ID, ENTITY_TYPE, PROPERTY_NAME, ABBREVIATION, SEARCHABLE, FACET_FIELD_TYPE) VALUES (1, 'PRODUCT', 'manufacturer', 'mfg', 1, 's')                                                                                                                                             
        at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:451)                                                                                                                           
        at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:378)                                                                                                                                 
        at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:304)
        at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:293)


But mycompany and admin applications work. I tried to create Product.
Exception occured:

Code: Select all

[ERROR] 17:25:30 TemplateEngine - [THYMELEAF][3] Exception processing template "utility/blcRedirect": Error resolving template "utility/blcRedirect", template might not exist or might not be accessible by any of the configured Template Resolvers


I tried create category. The same exception occured.