2
In the project a Pojo class was created that receives the type of the serializable variable for indexing and treating the convert in a generic way:
Pojo.java:
{...}
public abstract class Pojo<T extends Serializable> implements Serializable {
private static final long serialVersionUID = -519803732136444707L;
public abstract T getId();
public abstract void setId(T id);
}
When creating a class in the Domain package and extending it, the declaration line looks like this:
Empresa.java:
{...}
public class Empresa extends Pojo<Long> implements Serializable{
{...}
Then we run Nimble for crud generation of the same, I’m using a custom template, based on JSF2(primefaces 3)CRUD. When manipulating the code generation class, groovy shows the following error:
java.io.FileNotFoundException: C:[...]\src\main\java\br\com\djsystem\
projeto\domain\Pojo<Long>.java (A sintaxe do nome do arquivo, do nome do diretório ou
do rótulo do volume está incorreta)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at japa.parser.JavaParser.parse(JavaParser.java:138)
at japa.parser.JavaParser.parse(JavaParser.java:159)
at japa.parser.JavaParser$parse.call(Unknown Source)
at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil.getCompilationUnit(Pars
erUtil.groovy:278)
at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil$getCompilationUnit.call
Static(Unknown Source)
at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil.getAttributesFromClass(
ParserUtil.groovy:96)
at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil$getAttributesFromClass.
callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteAr
ray.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSi
te.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSi
te.java:165)
at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil.getAttributesFromClassF
ile(ParserUtil.groovy:120)
at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil$getAttributesFromClassF
ile.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:116)
at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:5)
at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.
java:165)
at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine
.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoU
nwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite
.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:112)
at br.gov.frameworkdemoiselle.tools.nimble.template.GroovyTemplate.applyTemplate(G
roovyTemplate.groovy:58)
at br.gov.frameworkdemoiselle.tools.nimble.template.Template$applyTemplate.call(Un
known Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:120)
at br.gov.frameworkdemoiselle.tools.nimble.util.TemplateUtil.applyTemplate(Templat
eUtil.groovy:58)
at br.gov.frameworkdemoiselle.tools.nimble.util.TemplateUtil$applyTemplate.call(Un
known Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:120)
at br.gov.frameworkdemoiselle.tools.nimble.DemoiselleNimble.applyFileTemplate(Demo
iselleNimble.groovy:438)
at br.gov.frameworkdemoiselle.tools.nimble.DemoiselleNimble.this$2$applyFileTempla
te(DemoiselleNimble.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMeta
Class.java:361)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClas
sSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteA
rray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallS
ite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallS
ite.java:153)
at br.gov.frameworkdemoiselle.tools.nimble.DemoiselleNimble$_applyTemplates_closur
e4.doCall(DemoiselleNimble.groovy:252)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)(continua...)
The same error occurs when I use in my entity a compound attribute whose class also extends the Pojo, under annotations Manytomany, Manytoone etc... In this second case the error occurs in the generation of select / Picklist. I also found that it only occurs when groovy commands are used, as . vm files are normally generated.
Someone who once had this problem could help me find a solution?
Standard class
@Entity
@Table(name = "Cliente", uniqueConstraints = {
@UniqueConstraint(columnNames = {"cnpj"})})
public class Cliente extends Pojo<Long> implements Serializable {
private static final long serialVersionUID = 1654193767247607000L;
@Id
@Column(name = "id", columnDefinition = "serial")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "razao_social", nullable = false, length = 80)
private String razaoSocial;
@Column(name = "cnpj", nullable = false, length = 14)
private Long cnpj;
@Column(name = "fantasia", nullable = false, length = 60)
private String fantasia;
public Cliente() {
super();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRazaoSocial() {
return razaoSocial;
}
public void setRazaoSocial(String razaoSocial) {
this.razaoSocial = razaoSocial;
}
public Long getCnpj() {
return cnpj;
}
public void setCnpj(Long cnpj) {
this.cnpj = cnpj;
}
public String getFantasia() {
return fantasia;
}
public void setFantasia(String fantasia) {
this.fantasia = fantasia;
}
}
Due to the error: java.io.Filenotfoundexception the file was not found. you can post the custom template and the full pojo classes?
– Saito
@Thank you for your reply. The Pojo.java class is as described above, below an example of a class I made, which presents the error, with respect to the custom template the error is reproduced when using the default Demoiselle template(JSF2(primefaces 3)CRUD).
– Michel Simões