Page 1 of 1

Problem running docx4j (Installation issue?)

PostPosted: Fri Oct 25, 2013 5:32 pm
by yoshiness
I looked through the forums and after reading a few posts about installation problems, I think I added all the necessary files to run docx4j but still get a lot of errors and program crashes. I am currently using Eclipse as my IDE.

I downloaded all the necessary .jar files for the project (I even tried to import every .jar file in the docx4j-2.8.1 package) and added them to my project via Java Build Path --> Libraries --> Add external JARs...

After importing the JAR files, I tried to test it by typing a simple command from a tutorial:
Code: Select all
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();


I loaded my android application into my tablet and from the start I get errors in LogCat just for running my application:
Code: Select all
10-24 23:30:28.412: E/AndroidRuntime(21464): FATAL EXCEPTION: main
10-24 23:30:28.412: E/AndroidRuntime(21464): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.example.arcorauditreporter; is package not installed?
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.ActivityThread.access$1300(ActivityThread.java:141)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.os.Looper.loop(Looper.java:137)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.ActivityThread.main(ActivityThread.java:5103)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at java.lang.reflect.Method.invokeNative(Native Method)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at java.lang.reflect.Method.invoke(Method.java:525)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at dalvik.system.NativeStart.main(Native Method)
10-24 23:30:28.412: E/AndroidRuntime(21464): Caused by: java.lang.IllegalStateException: Unable to get package info for com.example.arcorauditreporter; is package not installed?
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:369)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.LoadedApk.getClassLoader(LoadedApk.java:322)
10-24 23:30:28.412: E/AndroidRuntime(21464):    at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
10-24 23:30:28.412: E/AndroidRuntime(21464):    ... 11 more


Then, when I get to the page with the line of code written as above, I get more errors along with the application crashing with "Unfortunately, ____ has stopped":
Code: Select all
10-24 23:33:10.310: E/AndroidRuntime(21541): FATAL EXCEPTION: main
10-24 23:33:10.310: E/AndroidRuntime(21541): java.lang.VerifyError: com/example/arcorauditreporter/ReportPage
10-24 23:33:10.310: E/AndroidRuntime(21541):    at java.lang.Class.newInstanceImpl(Native Method)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at java.lang.Class.newInstance(Class.java:1130)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.os.Looper.loop(Looper.java:137)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at android.app.ActivityThread.main(ActivityThread.java:5103)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at java.lang.reflect.Method.invokeNative(Native Method)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at java.lang.reflect.Method.invoke(Method.java:525)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-24 23:33:10.310: E/AndroidRuntime(21541):    at dalvik.system.NativeStart.main(Native Method)


I'm not sure if I forgot a step when installing docx4j into my application aside from linking the .jar files to the project. None of the errors show up if I delete the one line of code noted in the beginning.
(I also checked stackoverflow without finding any answer to installation issues)

Any help would be appreciated!

Re: Problem running docx4j (Installation issue?)

PostPosted: Fri Oct 25, 2013 6:00 pm
by jason
You are trying to run it in an Android environment, so you can't expect the standard docx4j to work!

See instead http://www.docx4java.org/blog/2012/05/j ... n-android/
and https://github.com/plutext/AndroidDocxToHtml

There is a sub forum for Android related stuff. This obviously belongs there...

Re: Problem running docx4j (Installation issue?)

PostPosted: Fri Oct 25, 2013 8:56 pm
by yoshiness
Thanks for the very quick reply and help jason! I will definitely read up on those two links.
My apologies for posting it in the general docx4j forum section, maybe it's best to move this thread to the android sub forum now :D
If I run into any more problems, I shall post them here later

Re: Problem running docx4j (Installation issue?)

PostPosted: Mon Oct 28, 2013 2:15 pm
by yoshiness
I am still a bit confused in implementing the docx4j into the android system using the example shown in AndroidDocxToHtml. As a question in general, it is possible to generate DOCX reports using docx4j directly on the android system, correct? I am still getting the same exact errors, even using the additional JAR files in the AndroidDocxToHtml project

I am following the example on this page: http://blog.iprofs.nl/2012/09/06/creati ... th-docx4j/ to test report generation.

Re: Problem running docx4j (Installation issue?)

PostPosted: Mon Oct 28, 2013 7:36 pm
by jason
yoshiness wrote:even using the additional JAR files


Use those jars to the exclusion of the standard docx4j jars. To repeat myself, you can't use the standard docx4j jar in an Android environment. That's why there is an Android specific branch. Make sure the standard docx4j jar is not on your class path.

The error relating to com.example.arcorauditreporter on its face has nothing to do with docx4j