When generating a Job in Studio it fails with the 'Failed to generate code' error

Problem Description

A Job using a tAdvancedFileOutputXML component fails to run, and it is not able to generate the code.

 

Sample error message:

org.talend.commons.exception.PersistenceException: org.talend.designer.runprocess.ProcessorException: Failed to generate code.
at org.talend.repository.ui.wizards.exportjob.scriptsmanager.BuildJobManager.buildJob(BuildJobManager.java:244)
at org.talend.repository.ui.wizards.exportjob.scriptsmanager.BuildJobManager.buildJob(BuildJobManager.java:165)
at org.talend.repository.ui.wizards.exportjob.scriptsmanager.BuildJobManager.buildJobs(BuildJobManager.java:109)
at org.talend.repository.ui.wizards.exportjob.JobScriptsExportWizardPage.buildJobWithMaven(JobScriptsExportWizardPage.java:1487)
at org.talend.repository.ui.wizards.exportjob.JobScriptsExportWizardPage$8.run(JobScriptsExportWizardPage.java:1389)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1059)
at org.talend.repository.ui.wizards.exportjob.JobScriptsExportWizardPage.finish(JobScriptsExportWizardPage.java:1394)
at org.talend.repository.ui.wizards.exportjob.JavaJobScriptsExportWSWizardPage.finish(JavaJobScriptsExportWSWizardPage.java:1244)
at org.talend.repository.ui.wizards.exportjob.JobScriptsExportWizard.performFinish(JobScriptsExportWizard.java:126)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:853)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:438)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:619)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4454)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
at org.eclipse.jface.window.Window.open(Window.java:808)
at org.talend.repository.ui.actions.ExportJobScriptAction.doRun(ExportJobScriptAction.java:117)
at org.talend.repository.ui.actions.AContextualAction$2.run(AContextualAction.java:632)
at org.talend.repository.RepositoryWorkUnit.executeRun(RepositoryWorkUnit.java:99)
at org.talend.core.repository.model.AbstractRepositoryFactory.executeRepositoryWorkUnit(AbstractRepositoryFactory.java:258)
at org.talend.repository.localprovider.model.LocalRepositoryFactory.executeRepositoryWorkUnit(LocalRepositoryFactory.java:3377)
at org.talend.repository.gitprovider.core.GitRepositoryFactory.executeRepositoryWorkUnit(GitRepositoryFactory.java:369)
at org.talend.repository.remoteprovider.RemoteRepositoryFactory.executeRepositoryWorkUnit(RemoteRepositoryFactory.java:850)
at org.talend.core.repository.model.ProxyRepositoryFactory.executeRepositoryWorkUnit(ProxyRepositoryFactory.java:2108)
at org.talend.repository.ui.actions.AContextualAction.run(AContextualAction.java:641)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4454)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3409)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.talend.rcp.intro.Application.start(Application.java:255)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: org.talend.designer.runprocess.ProcessorException: Failed to generate code.
at org.talend.designer.runprocess.java.JavaProcessor.generateCode(JavaProcessor.java:573)
at org.talend.designer.runprocess.maven.MavenJavaProcessor.generateCode(MavenJavaProcessor.java:84)
at org.talend.designer.runprocess.ProcessorUtilities.generateContextInfo(ProcessorUtilities.java:707)
at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:929)
at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:741)
at org.talend.designer.runprocess.ProcessorUtilities.generateCode(ProcessorUtilities.java:1363)
at org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler.generateJobFiles(BuildJobHandler.java:159)
at org.talend.repository.ui.wizards.exportjob.scriptsmanager.BuildJobManager$1.run(BuildJobManager.java:212)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.talend.repository.ui.wizards.exportjob.scriptsmanager.BuildJobManager.buildJob(BuildJobManager.java:238)
... 61 more
Caused by: org.talend.designer.codegen.exception.CodeGeneratorException: org.eclipse.emf.codegen.jet.JETException: InvocationTargetException in hm2 job
at org.talend.designer.codegen.CodeGenerator.generateComponentCode(CodeGenerator.java:765)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:536)
at org.talend.designer.codegen.CodeGenerator.generatesTreeCode(CodeGenerator.java:680)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:537)
at org.talend.designer.codegen.CodeGenerator.generatesTreeCode(CodeGenerator.java:680)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:537)
at org.talend.designer.codegen.CodeGenerator.generatesTreeCode(CodeGenerator.java:680)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:537)
at org.talend.designer.codegen.CodeGenerator.generatesTreeCode(CodeGenerator.java:680)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:537)
at org.talend.designer.codegen.CodeGenerator.generatesTreeCode(CodeGenerator.java:680)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:537)
at org.talend.designer.codegen.CodeGenerator.generateComponentsCode(CodeGenerator.java:482)
at org.talend.designer.codegen.CodeGenerator.generateProcessCode(CodeGenerator.java:226)
at org.talend.designer.runprocess.java.JavaProcessor.generateCode(JavaProcessor.java:570)
... 70 more
Caused by: org.eclipse.emf.codegen.jet.JETException: InvocationTargetException
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:469)
at org.talend.designer.codegen.config.TalendJetEmitter.generate(TalendJetEmitter.java:684)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:441)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:432)
at org.talend.designer.codegen.proxy.JetProxy.generate(JetProxy.java:54)
at org.talend.designer.codegen.CodeGenerator.generateComponentCode(CodeGenerator.java:755)
... 84 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:461)
... 89 more
Caused by: java.lang.NullPointerException
at org.talend.designer.codegen.translators.file.output.TAdvancedFileOutputXMLMainJava$1XMLTool.getValue(TAdvancedFileOutputXMLMainJava.java:1479)
at org.talend.designer.codegen.translators.file.output.TAdvancedFileOutputXMLMainJava.generate(TAdvancedFileOutputXMLMainJava.java:3907)
... 93 more

 

Root Cause

This error is due to a misconfiguration/invalid setup of the component. In this case, the Static Value used in the Link Target of the tAdvancedFileOutputXMLcomponent wasn't configured correctly.

 

Solution

In the Studio logs or the logs prompted in the error window, look for an error line that points you to the faulty component, similar to the following:

org.talend.designer.codegen.translators.file.output.TAdvancedFileOutputXMLMainJava.generate(TAdvancedFileOutputXMLMainJava.java:3907)

Because the issue is specific to the Job and the error occurred due to a single component, you need to replace or reuse the component, then carefully configure it to meet your requirements and make sure it valid.

Version history
Revision #:
6 of 6
Last update:
‎04-13-2019 12:22 PM
Updated by: