5

I've been running into some trouble coding a java console application.

I want to create, external from the Content Manager, pdf pages containing data pulled from the broker database. This program uses java and the content delivery .jar files and it seems to have no problem when running it directly from eclipse. I exported this to an executable jar file.

When I try to to run the .jar file from command line using " java -jar generate_pdf.jar -cp "app.properties"" I end up with this error and stacktrace:

09:02:14.261 [main] WARN c.t.storage.StorageManagerFactory - Attempt to use license file cd_licenses.xml failed, file does not exist. A LicenseException will be thrown. 09:02:14.374 [main] ERROR c.t.storage.StorageManagerFactory - Fatal error, unable to load the StorageManagerFactory java.lang.NullPointerException: null at com.tridion.services.BaseService.getLicenseManager(BaseService.java:1 79) ~[jar:rsrc:cd_core.jar!/:na] at com.tridion.services.BaseService.proce

When I add the license files (cd_licenses.xml, cd_storage_conf.xml and cd_link_conf.xml) to the directory of the jar I eliminate some of the licensing errors, but not all and I get the following in the stacktrace:

09:38:48.228 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cache d instance of singleton bean 'lifecycleProcessor' 09:38:48.241 [main] ERROR c.t.storage.StorageManagerFactory - Fatal error, unabl e to load the StorageManagerFactory java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(Unknown Source) ~[na:1.6.0_ 23] at sun.misc.URLClassPath.findResource(Unknown Source) ~[na:1.6.0_23] at java.net.URLClassLoader$2.run(Unknown Source) ~[na:1.6.0_23] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0 _23] at java.net.URLClassLoader.findResource(Unknown Source) ~[na:1.6.0_23] at java.lang.ClassLoader.getResource(Unknown Source) ~[na:1.6.0_23] at com.tridion.services.BaseService.locateAndLoadLicenseFile(BaseService .java:212) ~[jar:rsrc:cd_core.jar!/:na] at com.tridion.services.BaseService.processLicensing(BaseService.java:11 8) ~[jar:rsrc:cd_core.jar!/:na] at com.tridion.services.BaseService.configure(BaseService.java:158) ~[ja r:rsrc:cd_core.jar!/:na] at com.tridion.storage.StorageManagerFactory.configure(StorageManagerFac tory.java:125) [jar:rsrc:cd_datalayer.jar!/:na] at com.tridion.services.BaseService.(BaseService.java:107) ~[jar:r src:cd_core.jar!/:na] at com.tridion.storage.StorageManagerFactory.(StorageManagerFactor y.java:105) [jar:rsrc:cd_datalayer.jar!/:na] at com.tridion.storage.StorageManagerFactory.reloadInstance(StorageManag erFactory.java:85) [jar:rsrc:cd_datalayer.jar!/:na] at com.tridion.storage.StorageManagerFactory.(StorageManagerFact ory.java:56) [jar:rsrc:cd_datalayer.jar!/:na] at com.tridion.storage.services.TaxonomyService.(TaxonomyService.j ava:49) [jar:rsrc:cd_datalayer.jar!/:na] at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:228) [jar:rsrc:cd_broker.jar!/:na] at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:174) [jar:rsrc:cd_broker.jar!/:na] at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:124) [jar:rsrc:cd_broker.jar!/:na] at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:110) [jar:rsrc:cd_broker.jar!/:na] at app.UMLCache.getKeywords(UMLCache.java:4041) [rsrc:./:na] at app.UMLCache.main(UMLCache.java:137) [rsrc:./:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6. 0_23] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.6. 0_23] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na: 1.6.0_23] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.6.0_23] at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa der.java:58) [uml_generate_pdf.jar:na] Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa der.java:58) Caused by: java.lang.ExceptionInInitializerError at com.tridion.storage.services.TaxonomyService.(TaxonomyService.j ava:49) at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:228) at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:174) at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:124) at com.tridion.taxonomies.TaxonomyFactory.getTaxonomyKeywords(TaxonomyFa ctory.java:110) at app.UMLCache.getKeywords(UMLCache.java:4041) at app.UMLCache.main(UMLCache.java:137) ... 5 more Caused by: java.lang.RuntimeException: Fatal error, unable to load the StorageMa nagerFactory at com.tridion.storage.StorageManagerFactory.reloadInstance(StorageManag erFactory.java:92) at com.tridion.storage.StorageManagerFactory.(StorageManagerFact ory.java:56) ... 12 more Caused by: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(Unknown Source) at sun.misc.URLClassPath.findResource(Unknown Source) at java.net.URLClassLoader$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findResource(Unknown Source) at java.lang.ClassLoader.getResource(Unknown Source) at com.tridion.services.BaseService.locateAndLoadLicenseFile(BaseService .java:212) at com.tridion.services.BaseService.processLicensing(BaseService.java:11 8) at com.tridion.services.BaseService.configure(BaseService.java:158) at com.tridion.storage.StorageManagerFactory.configure(StorageManagerFac tory.java:125) at com.tridion.services.BaseService.(BaseService.java:107) at com.tridion.storage.StorageManagerFactory.(StorageManagerFactor y.java:105) at com.tridion.storage.StorageManagerFactory.reloadInstance(StorageManag erFactory.java:85) ... 13 more

I have also tried adding the license files to the classpath when running it from the console like this:

java -jar uml_generate_pdf.jar -cp "app.properties:cd_licenses.xml:cd_link_conf.xml:cd_storage_conf.xml"

,but no luck. I get the same error as above. Any ideas?

1
  • Could you share some of your code...may be the skelton. Also, did you ensure while creating JAR files you have taken up all options in place. May be you try to compile into the JAR file from the Eclipse and carefully selecting all the options applicable in the wizard. Aug 19, 2014 at 14:08

1 Answer 1

2

The last stack trace you've pasted contains these line:

java.net.URLClassLoader.findResource(Unknown Source) ~[na:1.6.0_23] at java.lang.ClassLoader.getResource(Unknown Source) ~[na:1.6.0_23] at

This does indicate that java is looking for something in the classpath, but it's not present. Let's explore this further...

Note that cd_storage_conf.xml and cd_link_conf.xml have entries inside for the license file path. So, these two files need to be in the classpath. You typically put them inside the /classes folder. The license file itself can be anywhere on the file system where your process has read permissions. So, don't put your license file into the classpath, but make sure that it exists in the location where cd_storage and _link_conf files specify.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.