Sculptor generation is failing on 2.1.0

38 views
Skip to first unread message

Mahmood Lebbai

unread,
Jan 28, 2012, 4:11:38 AM1/28/12
to Fornax-Platform
Sculptor generation is failing in 2.1.0 , if the model has enum used
as attribute in service api method but not used in entity.

It used to work in 2.0 version.


Following is the error


[INFO]
[INFO] --- fornax-oaw-m2-plugin:3.2.3:run-workflow (default) @
emailtemplate ---
[INFO] Fornax Model Workflow Maven2 Plugin V3.2.3
[INFO] src/main/resources/emailtemplate.btdesign has been modified
since last generator run at 20120128-02:02:58.
[INFO] 2616 INFO o.e.emf.mwe.utils.StandaloneSetup - Registering
platform uri '/Users/mahmoodlebbai/HigherPlane/projects/fos/irep/
common'
[INFO] 2659 INFO o.e.emf.mwe.utils.StandaloneSetup - Adding generated
EPackage
'org.fornax.cartridges.sculptor.dsl.sculptordsl.SculptordslPackage'
[INFO] 2687 INFO o.e.emf.mwe.utils.StandaloneSetup - Adding generated
EPackage 'sculptormetamodel.SculptormetamodelPackage'
[INFO] 4725 INFO o.f.c.s.g.util.GenerationHelper - Partial:
[emailtemplate]
[INFO] 4901 INFO o.f.c.s.g.util.GenerationHelper - Partial:
[emailtemplate]
[INFO] 7346 ERROR org.eclipse.xpand2.Generator - Error in Component
of type org.eclipse.xpand2.Generator:
[INFO] EvaluationException : Nullevaluation
[INFO] templates::jpa::Hibernate.xpt[3787,47] on line 105
'javaFileName(basePackage.+(".util.EnumUserType"))'
[INFO] templates::jpa::Hibernate.xpt[1052,15] on line 31 'EXPAND
enumType'
[INFO] templates::Root.xpt[3065,43] on line 76 'EXPAND
templates::jpa::Hibernate::hibernate'
[INFO] [23,49] on line 1 'EXPAND templates::Root::Root FOR
transformedModel'
[INFO]
[INFO] 7350 ERROR o.e.e.m.launch.runtime.Mwe2Launcher - Problems
running workflow generator.Workflow: Nullevaluation
[INFO] java.lang.RuntimeException: Problems running workflow
generator.Workflow: Nullevaluation
[INFO] at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:82)
~[org.eclipse.emf.mwe2.launch-1.0.0.v201006150907.jar:na]
[INFO] at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
~[org.eclipse.emf.mwe2.launch-1.0.0.v201006150907.jar:na]
[INFO] at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:
74) ~[org.eclipse.emf.mwe2.launch-1.0.0.v201006150907.jar:na]
[INFO] at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:
35) ~[org.eclipse.emf.mwe2.launch-1.0.0.v201006150907.jar:na]
[INFO] Caused by:
org.eclipse.emf.mwe.core.WorkflowInterruptedException: Nullevaluation
[INFO] at
org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent.invokeInternal(AbstractExpressionsUsingWorkflowComponent.java:
247) ~[org.eclipse.xtend-1.0.1.v201008251147.jar:na]
[INFO] at
org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:
126) ~[org.eclipse.emf.mwe.core-1.0.0.v201006150535.jar:na]
[INFO] at
org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
~[org.eclipse.emf.mwe.core-1.0.0.v201006150535.jar:na]
[INFO] at
org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:
201) ~[org.eclipse.emf.mwe.core-1.0.0.v201006150535.jar:na]
[INFO] at
org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:
31) ~[org.eclipse.emf.mwe2.runtime-1.0.0.v201006150446.jar:na]
[INFO] at
org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:
31) ~[org.eclipse.emf.mwe2.runtime-1.0.0.v201006150446.jar:na]
[INFO] at
org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
~[org.eclipse.emf.mwe2.runtime-1.0.0.v201006150446.jar:na]
[INFO] at
org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:80)
~[org.eclipse.emf.mwe2.launch-1.0.0.v201006150907.jar:na]
[INFO] ... 3 common frames omitted
[ERROR] ExitStatusException occurred while running workflow: Java
returned: 1

Oliver Ringel

unread,
Jan 28, 2012, 8:56:35 AM1/28/12
to fornax-...@googlegroups.com
Thanks for reporting. I will have a look.

Oliver

Oliver Ringel

unread,
Jan 28, 2012, 10:15:33 AM1/28/12
to fornax-...@googlegroups.com
I created a simple project to check the problem, but I was not able to reproduce the error.

Looking at the error stacktrace it seems that your Application basePackage is not set.
But I think this should not be possible.

Would you please provide the affected model.btdesign files.




Am Samstag, den 28.01.2012, 01:11 -0800 schrieb Mahmood Lebbai:

Shamsul Kamal

unread,
Jan 28, 2012, 10:26:25 AM1/28/12
to fornax-...@googlegroups.com
I think I have the same issue.

If I code:

Entity Relative {
    String name
}

in the model-user.btdesign

then 

enum Relative {
    TEST;
}

in the model-etc.btdesign

then generation failed:

[INFO] [ERROR]: Duplicate name.  There is already an existing Domain Object named 'Relative'.(Element: UserPart.user.Relative Feature: name; Reported by: -UNKNOWN-)

/Shamsul

Oliver Ringel

unread,
Jan 28, 2012, 11:19:40 AM1/28/12
to fornax-...@googlegroups.com
I can't see a relation between this errors.

Your error comes from a constraint violation.
It is not allowed to have two domain objects with the same name,
even in different ApplicationParts.

The other error comes from a EvaluationException (NullEvaluation) in the following line
in Hibernate.xpt

«DEFINE enumType FOR Application»
    «FILE javaFileName(basePackage + ".util.EnumUserType")-»
...

On the first look I see only one potential cause, basePackage is null.
But who knows?

Oliver

Mahmood Lebbai

unread,
Jan 28, 2012, 1:35:58 PM1/28/12
to Fornax-Platform
Please find the attached template. I donot think baseBackage is an issue. I had set the base package in the model.

ApplicationPart EmailTemplatePart {

Module emailtemplate {

basePackage=com.fos.common.emailtemplate

/* Template FTL Model Value Object for UserRegisteration */

DataTransferObject UserRegisteration {

String userFirstName

String userLastName

String emailAddress

String password

String userId

String applicationUrl

String changePasswordUrlLink

String emailSenderDetail

Integer changePasswordLinkExpiry

String  passwordLinkExpiry

}

/* 

enum PassworkLinkExpiry {

            SECONDS("Seconds"),

            MINUTES("Minutes"),

            HOURS("Hours"),

            DAYS("Days")

        }

       

       

        

        enum EmailTemplatesEnum {

        USER_REG_EMAIL("USER_REG_EMAIL"),

        RESET_PASSWORD_EMAIL("RESET_PASSWORD_EMAIL")

        } */

/* Email Template File to store Email Tempalte */

Entity EmailTemplate {

cache

    scaffold

    databaseTable="EMAIL_TEMPLATE"

    reference @EmailTemplateKey emailTemplateKey key

    String ftlFilePath databaseColumn="TEMPLATE_FILE_PATH" length="100"

    Boolean status databaseColumn="ACTIVE_FLAG"

   

    Repository EmailTemplateRepository {

List<@EmailTemplate> getEmailTemplate(String countryCode, String languageCode , String templateId) throws EmailTemplateNotFoundException;

}

/* Email Tempalte Key Attributes to reterive the tempalte file */

        BasicType EmailTemplateKey {

  String country_code key databaseColumn="COUNTRY_CODE" length="2"

  String lang_code key databaseColumn="LANG_CODE" length="2"

  String template_id key databaseColumn="TEMPLATE_ID" length="50"

}

/* Email Tempalte Service */

Service EmailTemplateService {

          getEmailTemplate => EmailTemplateRepository.getEmailTemplate;

          String getEmailContent(String countryCode , String languageCode , String emailTemplateType , Map<String,Object> dataModel) throws EmailTemplateException;

          

        }

}

    



}



Currently I had commented the Enumeration to make it work. I have 4 module project set in the parent pom and tried to buid the project.


To make it work , I had commented the enum


Regards,

Mahmood

Mahmood Lebbai

unread,
Jan 28, 2012, 1:47:19 PM1/28/12
to Fornax-Platform
Following are the setup.

I'm trying to build the common module which has following project each has its own Module. ( ApplicationPart ) and module has its own basePackage.

1. crypto
2. security
3. emailtemplate
4. emailclient.

security has crypto dependency. I have one parent project which has all the above four module. 


Application basepackage has been created and all the four dependency has been included in the application layer.

When I tried to build the common-parent using maven, I got the error reported earlier , when I tried to comment the enum , it runs successfully.

Following are the sculptor generator properties for emailtemplate.

project.nature=business-tier


#App Server Configuration

deployment.applicationServer=JBoss


#Database Vendor

db.product=mysql

db.mysql.onDeleteCascade=false

generate.ddl=true



#db.useTablePrefixedIdColumn=true

#db.useUnderscoreNaming=false


#Package Names

package.serviceInterface=service

package.serviceImplementation=serviceimpl

package.serviceProxy=serviceproxy

package.consumer=consumer

package.xmlmapper=consumer

package.domain=domain

package.repositoryInterface=repository

package.exception=exception

package.repositoryImplementation=repositoryimpl

package.accessInterface=dao

package.accessImplementation=daoimpl

package.dto=dto

package.web=web

package.richClient=richclient

package.common=common


#Cache Provider

cache.provider=EhCache


# specifies if ServiceContext is to be generated

generate.serviceContext=false

generate.repository.finders=true

generate.NotFoundException=false

generate.module.crypto=false


Regards,

Mahmood

Mahmood Lebbai

unread,
Jan 28, 2012, 3:58:11 PM1/28/12
to Fornax-Platform
All,
   I got the problem and have a workaround atleast for my situation to make it work.

Issue : If the model has enum , by default generator code expect the application base package to exists and generate the EnumUserType class in ( <<Appliaction.basePackage>>.util ). Since my common model does not have application and applicatoin basepackage defined , it throws an error noted earlier. 

If my assumption  is right , the logic has been coded in hibernate.xpt.


My thoughts : 
     
    1. Enum should not always been associated to domain , value object , DTO attributes and hence we should have an option/propertoes  to specify its own package for enum

    2. If hibernate / openjpa options are enabled and enum is defined in persistence entity , it is recommended to generate the enumUserType under << Model basepackage >> .util rather than applicationbase package.

Please feel free share your thoughts if my analysis is not right.

Regards,
Mahmood

Shamsul Kamal

unread,
Jan 28, 2012, 8:30:53 PM1/28/12
to fornax-...@googlegroups.com
Yes, basePackage null is my error cause.

If I create an Entity on basePackage and the enum on the other model with same name, the generation successful. 
Thanks for explanation.

/Shamsul

Oliver Ringel

unread,
Jan 29, 2012, 7:34:09 AM1/29/12
to fornax-...@googlegroups.com
Am Sonntag, den 29.01.2012, 09:30 +0800 schrieb Shamsul Kamal:
Yes, basePackage null is my error cause.


I thought so. And I think I found the reason why basePackage is null.
This happens if you only specify ApplicationParts in your model files without an Application.
This is allowed now. I think there should be at least one Application.

I would prefer to add a constraint for this. But it is also easy to fix the NullEvaluation with that constraint.



If I create an Entity on basePackage and the enum on the other model with same name, the generation successful. 
Thanks for explanation.


I have to correct myself.
It is not possible to have two DomainObjects with the same name in different Modules in the same Application/ApplicationPart.
But you can use two DomainObjects with the same name in different ApplicationParts.

It is possible to have the same Modules in two different ApplicationParts.
I think we should add a constraint to avoid splitting a Module over ApplicationParts.

Patrik Nordwall

unread,
Jan 29, 2012, 1:09:10 PM1/29/12
to fornax-...@googlegroups.com
On Sun, Jan 29, 2012 at 1:34 PM, Oliver Ringel <ori...@intrapro.de> wrote:
Am Sonntag, den 29.01.2012, 09:30 +0800 schrieb Shamsul Kamal:

Yes, basePackage null is my error cause.


I thought so. And I think I found the reason why basePackage is null.
This happens if you only specify ApplicationParts in your model files without an Application.
This is allowed now. I think there should be at least one Application.

I would prefer to add a constraint for this. But it is also easy to fix the NullEvaluation with that constraint.



If I create an Entity on basePackage and the enum on the other model with same name, the generation successful. 
Thanks for explanation.


I have to correct myself.
It is not possible to have two DomainObjects with the same name in different Modules in the same Application/ApplicationPart.
But you can use two DomainObjects with the same name in different ApplicationParts.

I think we base some things (dsl and transformation) on the simplification that domain object names are unique in the whole model, including all application parts. So if it happens to work it is more an accident, and nothing I think we should support.
 

It is possible to have the same Modules in two different ApplicationParts.
I think we should add a constraint to avoid splitting a Module over ApplicationParts.

Yes, that should not be allowed.

/Patrik
Reply all
Reply to author
Forward
0 new messages