Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Trying to import jar into custom component

I've started creating a custom component for inserting raw java objects into a mongodb using the morphia library. I started with the tMongoDBOutput as a base and stripped out all the code that I didn't need. After I successfully did this I tried to import some Morphia packages in my code but I keep getting this error at run time:

1. ERROR in /home/jordan/development/talend-bd/workspace/.JETEmitters/src/org/talend/designer/codegen/translators/gd/itno/TMorphiaOutputBeginJava.java (at line 9)
import org.mongodb.morphia.Datastore;
      ^^^^^^^^^^^
The import org.mongodb cannot be resolved



I have the necessary IMPORT lines in my tMorphiaOutput_java.xml file (The jars is in the same directory as all the component files):

<IMPORT MODULE="morphia-1.1.0-SNAPSHOT.jar" NAME="morphia-1.1.0-SNAPSHOT" REQUIRED="true"/> 


And the import statement in my tMorphiaOutput_begin.javajet:

<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
java.util.Map
org.mongodb.morphia.Datastore
org.mongodb.morphia.Morphia
"
%>


I've searched but these are the only things that I can find that are required to use an external jar in a custom component but I still get that very vague error.
Anyone run into this, or know what I'm missing?

Labels (2)
1 Reply
_AnonymousUser
Specialist III
Specialist III
Author

Now I've tried taking the import out of the import section of the javajet file and put the full classpath in the code but I'm getting the same sort of error:
1. ERROR in /home/jordan/development/talend-bd/workspace/.JETEmitters/src/org/talend/designer/codegen/translators/gd/itno/TMorphiaOutputBeginJava.java (at line 119)
org.mongodb.morphia.Morphia morphia = new org.mongodb.morphia.Morphia();
^^^^^^^^^^^
org.mongodb cannot be resolved to a type