Error while creating the new artifact

I have been trying to create a new artifact but keeps on throwing error. The code is given below.

skCase = Case.getCurrentCase().getSleuthkitCase();
artId = skCase.addArtifactType(“TSK_WAZIRX_WAL_HISTORY”, “WAZIRX Wal History”)
artifact = file.newArtifact(artId.getTypeID())

I have tried the below code too,

blackboard = Case.getCurrentCase().getServices().getBlackboard()
artId = blackboard.getOrAddArtifactType(“TSK_WAZIRX_WAL_HISTORY”, “WAZIRX Wal History”)
artifact = file.newArtifact(artId.getTypeID())

Can anyone help me with this please.

Hmm a lot of that code is deprecated but should still work. It would be better to use the getOrAddArtifactType version with a category (given the name I’m pretty sure it’s a DataArtifact you’re making) and then use AbstractFile.newDataArtifact() after you’ve created your list of attributes.

Can you look in the log and post the error you’re getting? Autopsy User Documentation: Troubleshooting