[excel module] NoClassDefFoundError: org/apache/poi/ss/usermodel/WorkbookFactory

1,641 views
Skip to first unread message

Peter Hilton, Lunatech

unread,
Jul 19, 2011, 5:18:38 AM7/19/11
to play-fr...@googlegroups.com
I’m using version 1.2.3 of the Excel module with Play 1.2.2 and have a 'NoClassDefFoundError: org/apache/poi/ss/usermodel/WorkbookFactory’. Everything works fine if I switch to version 1.2.2 of the Excel module.

To reproduce:
  1. Create a new application
  2. Add the dependency '- play -> excel 1.2.3’
  3. Run ‘play dependencies’
  4. Change the first default route to GET / Application.index(format:'xls’)
  5. Save a new Excel spreadsheet as views/Application.index.xls
  6. Start the application
  7. Request http://localhost:9000/ - causes the NoClassDefFoundError
  8. In dependencies.yml, change the dependency to '- play -> excel 1.2.2’
  9. Stop the application, run ‘play dependencies --sync’, and restart the application
  10. Request http://localhost:9000/ - an .xls file is generated as expected without errors.
Here’s a transcript…

$ /Applications/play-1.2.2/play new test-excel
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~
~ The new application will be created in /Users/pedro/Documents/code/play/test-excel
~ What is the application name? [test-excel] 
~
~ OK, the application is created.
~ Start it with : play run test-excel
~ Have fun!
~
$ /Applications/play-1.2.2/play deps test-excel
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~
~ Resolving dependencies using /Users/pedro/Documents/code/play/test-excel/conf/dependencies.yml,
~
~ play->excel 1.2.3 (from playContributedModules)
~
~ Installing resolved dependencies,
~
~ modules/excel-1.2.3
~
~ Done!
~
$ /Applications/play-1.2.2/play run test-excel
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~
~ Ctrl+C to stop
Listening for transport dt_socket at address: 8000
11:05:37,198 INFO  ~ Starting /Users/pedro/Documents/code/play/test-excel
11:05:37,202 INFO  ~ Module excel is available (/Users/pedro/Documents/code/play/test-excel/modules/excel-1.2.3)
11:05:37,800 WARN  ~ You're running Play! in DEV mode
11:05:37,894 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
11:05:45,624 INFO  ~ Application 'test-excel' is now started !

11:08:19,539 ERROR ~ 

@67628l6oj
Internal Server Error (500) for request GET /

Oops: NoClassDefFoundError
An unexpected error occured caused by exception NoClassDefFoundError: org/apache/poi/ss/usermodel/WorkbookFactory

play.exceptions.UnexpectedException: Unexpected Error
at play.Invoker$Invocation.onException(Invoker.java:232)
at play.Invoker$Invocation.run(Invoker.java:273)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/WorkbookFactory
at net.sf.jxls.transformer.XLSTransformer.transformXLS(XLSTransformer.java:217)
at play.modules.excel.RenderExcel.apply(RenderExcel.java:106)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:243)
... 1 more
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.WorkbookFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 4 more
11:08:19,539 ERROR ~ 

@67628l6ok
Error during the 500 response generation

Template not found
The template errors/500.xls does not exist.

play.exceptions.TemplateNotFoundException: Template not found : errors/500.xls
at play.templates.TemplateLoader.load(TemplateLoader.java:192)
at play.server.PlayHandler.serve500(PlayHandler.java:707)
at Invocation.HTTP Request(Play!)

VijayKiran

unread,
Jul 19, 2011, 6:19:48 AM7/19/11
to play-fr...@googlegroups.com
Hi Peter,

I followed the same steps and didn't get any error. I tried with 1.2.3 and 1.2.2 excel module, and no exception was thrown. FWIW, jars in both 1.2.3 and 1.2.2 seem to be the same, except 1.2.3 contains xbean.jar.

I used the XLS from http://www.chicopee.mec.edu/pages/Excel%20-%20PPoint%20workshop/Excel%20samples/excel_samples.htm

Not sure if your XLS is triggering this error.

./Vijay

PS: Here's the zip file of the project I created - http://cl.ly/2n29031b2a3S3a3B2e09 

green

unread,
Jul 19, 2011, 7:06:22 AM7/19/11
to play-fr...@googlegroups.com
Hi Peter,

Please install excel module again. There is a silly mistake when I package v1.2.3 which has been repackaged and uploaded.

Sorry for the inconvenience.

Regards,
Green


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/F0C0yv2Xi4QJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Reply all
Reply to author
Forward
0 new messages