- This topic has 12 replies, 5 voices, and was last updated 16 years, 3 months ago by Ton Huisman.
-
AuthorPosts
-
pete_999_IMemberHi,
was trying to generate entities and got following expection:
running
WindowsXP
MyEclipse: Version: 6.0.1 GA
Build id: 6.0.1-GA-200710driver: mysql-connector-java-5.0.8-bin.jar
Any idea what ight be the cause?
!ENTRY org.eclipse.core.jobs 4 2 2004-11-15 05:07:08.703
!MESSAGE An internal error occurred during: “Generating Artifacts”.
!STACK 0
org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoTypeDeclaration.vm. Invocation of method ‘eval’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.RenderTool threw exception class org.apache.velocity.exception.MethodInvocationException : Invocation of method ‘substring’ in class java.lang.String threw exception class java.lang.StringIndexOutOfBoundsException : String index out of range: -2
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.java:82)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:31)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:120)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportPOJO(VGenericExporter.java:84)
at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportPOJO(MEPOJOExporter.java:104)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportComponent(VGenericExporter.java:69)
at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportClasses(MEPOJOExporter.java:162)
at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.doStart(MEPOJOExporter.java:130)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VAbstractExporter.start(VAbstractExporter.java:97)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$3.execute(GenerateArtifactsJob.java:491)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:408)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template pojo/PojoTypeDeclaration.vm. Invocation of method ‘eval’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.RenderTool threw exception class org.apache.velocity.exception.MethodInvocationException : Invocation of method ‘substring’ in class java.lang.String threw exception class java.lang.StringIndexOutOfBoundsException : String index out of range: -2
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates.get(VTemplateHelper.java:111)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:302)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
… 14 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method ‘substring’ in class java.lang.String threw exception class java.lang.StringIndexOutOfBoundsException : String index out of range: -2
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:246)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:316)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:210)
at com.genuitec.eclipse.hibernate.tool.hbm2x.RenderTool.eval(RenderTool.java:115)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:327)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:144)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
… 28 more
pete_999_IMemberok I have unchecked – create abstract class and enable pagination for query results — and all got generated. I have not checked if all generated code is correct but at least I managed to narrow down what was causing the initial error
@pete_999_I wrote:
Hi,
was trying to generate entities and got following expection:
running
WindowsXP
MyEclipse: Version: 6.0.1 GA
Build id: 6.0.1-GA-200710driver: mysql-connector-java-5.0.8-bin.jar
Any idea what ight be the cause?
!ENTRY org.eclipse.core.jobs 4 2 2004-11-15 05:07:08.703
!MESSAGE An internal error occurred during: “Generating Artifacts”.
!STACK 0
org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoTypeDeclaration.vm. Invocation of method ‘eval’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.RenderTool threw exception class org.apache.velocity.exception.MethodInvocationException : Invocation of method ‘substring’ in class java.lang.String threw exception class java.lang.StringIndexOutOfBoundsException : String index out of range: -2
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.java:82)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:31)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:120)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportPOJO(VGenericExporter.java:84)
at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportPOJO(MEPOJOExporter.java:104)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportComponent(VGenericExporter.java:69)
at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportClasses(MEPOJOExporter.java:162)
at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.doStart(MEPOJOExporter.java:130)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VAbstractExporter.start(VAbstractExporter.java:97)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$3.execute(GenerateArtifactsJob.java:491)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:408)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template pojo/PojoTypeDeclaration.vm. Invocation of method ‘eval’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.RenderTool threw exception class org.apache.velocity.exception.MethodInvocationException : Invocation of method ‘substring’ in class java.lang.String threw exception class java.lang.StringIndexOutOfBoundsException : String index out of range: -2
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates.get(VTemplateHelper.java:111)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:302)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
… 14 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method ‘substring’ in class java.lang.String threw exception class java.lang.StringIndexOutOfBoundsException : String index out of range: -2
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:246)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:316)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:210)
at com.genuitec.eclipse.hibernate.tool.hbm2x.RenderTool.eval(RenderTool.java:115)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:327)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:144)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
… 28 more
Loyal WaterMemberCan you go through this FAQ and try the steps mentioned here:-
https://www.genuitec.com/forums/topic/db-error-generating-artifacts/
Sean ParsonsMemberI also find this error – removing abstract creation resolves it…can we get some info here?
ruchitkMemberHi,
Just had the same issue but did not have abstraction checked.
I am using oracle 10.2.0.3 DB and the latest ojdbc14.jar from oracle. It has been working OK for a while but today just suddenly it stopped generating for tables that have any single column primary keys.
The error dialogue boxes message:
An internal error occurred during: “Generating Artifacts”.
MethodInvocationException while processing template Pojo. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoPropertyAccessors.vm. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/Ejb3PropertyGetAnnotation.vm. Invocation of method ‘generateAnnIdGenerator’ in class com.genuitec.eclipse.hibernate.wizards.MEEntityPOJOClass threw exception class java.lang.NullPointerException : nullPlease help
Thanks
Ruchit
Loyal WaterMemberTry using the -clean and check if it helps:-
https://www.genuitec.com/forums/topic/troubleshoot-using-the-clean-command-line-argument/
ruchitkMemberHi,
I just checked my eclipse.ini file and the first line is “-clean” (I have never modified this file).
As far as I know this should do the same as running the eclipse.exe from command prompt with -clean.I have just tried the command after starting using command prompt “eclipse.exe -clean”, but I am still having the same issue as before when trying to hibernate reverse engineer a table from the DB browser.
Please help, this is very critical to our project.
ruchitkMemberHi
Just an update, I have reinstalled MyEclipse to see if there was any issue in my installation.
I have just finished and tried to do the hibernate reverse engineering (asking the process to Add Hibernate mappings to the POJO), and it failed with the same error message. If I allow it to create the hibernate mapping file then it seems to work without any errors.
We are using Hibernate 3.2 and I would like the mappings to be part of my POJO’s as we have a number of large tables, and it is very useful to have the mappings in the java file rather than in xml.
Awaiting your response.
Loyal WaterMemberruchitk ,
Can you switch to a new workspace (File > Switch Workspace > Temp) and test this again and let me know what result you get. You said it was working earlier so this might be an issue related to a workspace gone corrupt.
ruchitkMemberHi Nipun
Thanks for you response, unfortunately it didn’t work:
The steps I followed are:
-Switched to a brand new workspace folder.
-Created a new project.
-Created a new DB Connection.
-Added Hibernate capabilities to the new project.
-From DB Explorer view connect to the db, navigate to the table and right-click and select “Hibernate Reverse engineering”.
While generating the POJO’s I still get the following error:An internal error occurred during: “Generating Artifacts”.
MethodInvocationException while processing template Pojo. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoPropertyAccessors.vm. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/Ejb3PropertyGetAnnotation.vm. Invocation of method ‘generateAnnIdGenerator’ in class com.genuitec.eclipse.hibernate.wizards.MEEntityPOJOClass threw exception class java.lang.NullPointerException : nullAre there any other ideas on what I need to do, If not I’m going to have to look for another IDE supplier.
Tha
Ton HuismanMemberCan you reveal the table structure(s)?, some fieldnames could be reserved words (like: get, class), and so causing these errors to happen.
HTH
Ton
ruchitkMemberHi
It is an oracle db (v 10.2.0.3), I don’t think any of the fields are reserverd words (either java or oracle) but please correct me if I am wrong.
The table creation script (SQL) is below:CREATE TABLE APP_REFERENCES
(
RF_TYPE NUMBER(5) NOT NULL,
RF_CODE VARCHAR2(15 BYTE) NOT NULL,
RF_DESCRIPTION VARCHAR2(150 BYTE) NOT NULL,
RF_SHORT_DESCRIPTION VARCHAR2(30 BYTE),
RF_DATE_EFFECTIVE_TO DATE,
RF_LAST_UPDATED DATE,
RF_LAST_UPDATED_BY VARCHAR2(30 BYTE),
RF_SOURCE VARCHAR2(20 BYTE),
RF_SEQUENCE NUMBER(6),
RF_KEY_REFERENCE NUMBER(1),
RF_CREATED_BY VARCHAR2(40 BYTE),
RF_CREATED_DATE DATE,
RF_FLAG_1 CHAR(1 BYTE),
RF_FLAG_2 CHAR(1 BYTE),
RF_FLAG_3 CHAR(1 BYTE),
RF_FLAG_4 CHAR(1 BYTE),
RF_FLAG_5 CHAR(1 BYTE),
RF_MAX_VALUE NUMBER(9,3),
RF_ATT1_RT_TYPE NUMBER(5),
RF_ATT1_RF_CODE VARCHAR2(12 BYTE),
RF_ATT2_RT_TYPE NUMBER(5),
RF_ATT2_RF_CODE VARCHAR2(12 BYTE),
RF_ATT3_RT_TYPE NUMBER(5),
RF_ATT3_RF_CODE VARCHAR2(12 BYTE),
RF_ATT4_RT_TYPE NUMBER(5),
RF_ATT4_RF_CODE VARCHAR2(12 BYTE),
RF_DESCRIPTION_1 VARCHAR2(500 BYTE),
RF_DESCRIPTION_2 VARCHAR2(500 BYTE),
RF_DESCRIPTION_3 VARCHAR2(500 BYTE),
RF_DESCRIPTION_4 VARCHAR2(500 BYTE),
RF_DESCRIPTION_5 VARCHAR2(500 BYTE),
RF_NUMBER_1 NUMBER(15,2),
RF_NUMBER_2 NUMBER(15,2),
RF_NUMBER_3 NUMBER(15,2),
RF_NUMBER_4 NUMBER(15,2),
RF_NUMBER_5 NUMBER(15,2),
RF_RT_TYPE_VALIDATION NUMBER(5),
RF_DATA_SERVICE CHAR(1 BYTE),
RF_ID NUMBER(15)
)
Ton HuismanMemberHm, indeed, there don’t seem to be much reserved words in the above structure 😉 Must be some other ‘feature’ of hibernate that is playing up in your case.
Grtz
Ton -
AuthorPosts