deployment - Apache POI java.lang.NoClassDefFoundError: Jboss 7.1.1 -
i trying deploy jar application in jboss server 7.1.1 configured via maven , have added dependencies in pom.xml.
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>samplegroupid</groupid> <artifactid>sampleartifactid</artifactid> <version>0.0.1-snapshot</version> <name>projectname</name> <dependencies> <dependency> <groupid>commons-fileupload</groupid> <artifactid>commons-fileupload</artifactid> <version>1.2.1</version> </dependency> <dependency> <groupid>commons-io</groupid> <artifactid>commons-io</artifactid> <version>1.3.2</version> </dependency> <dependency> <groupid>commons-logging</groupid> <artifactid>commons-logging</artifactid> <version>1.0.4</version> </dependency> <dependency> <groupid>org.freemarker</groupid> <artifactid>freemarker</artifactid> <version>2.3.13</version> </dependency> <dependency> <groupid>opensymphony</groupid> <artifactid>ognl</artifactid> <version>2.6.11</version> </dependency> <dependency> <groupid>org.apache.struts</groupid> <artifactid>struts2-core</artifactid> <version>2.1.6</version> </dependency> <dependency> <groupid>com.opensymphony</groupid> <artifactid>xwork</artifactid> <version>2.1.2</version> </dependency> <dependency> <groupid>commons-fileupload</groupid> <artifactid>commons-fileupload</artifactid> <version>1.2.1</version> </dependency> <dependency> <groupid>commons-io</groupid> <artifactid>commons-io</artifactid> <version>1.3.2</version> </dependency> <dependency> <groupid>commons-logging</groupid> <artifactid>commons-logging</artifactid> <version>1.0.4</version> </dependency> <dependency> <groupid>org.freemarker</groupid> <artifactid>freemarker</artifactid> <version>2.3.13</version> </dependency> <dependency> <groupid>opensymphony</groupid> <artifactid>ognl</artifactid> <version>2.6.11</version> </dependency> <dependency> <groupid>org.apache.struts</groupid> <artifactid>struts2-core</artifactid> <version>2.1.6</version> </dependency> <dependency> <groupid>com.opensymphony</groupid> <artifactid>xwork</artifactid> <version>2.1.2</version> </dependency> <dependency> <groupid>ecview_1_10_jar_test</groupid> <artifactid>ecview_1_10_jar_test</artifactid> <version>0.0.1-snapshot</version> </dependency> <dependency> <groupid>javax.activation</groupid> <artifactid>activation</artifactid> <version>1.1.1</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.annotation</groupid> <artifactid>jboss-annotations-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.ejb</groupid> <artifactid>jboss-ejb-api_3.1_spec</artifactid> <version>1.0.1.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.el</groupid> <artifactid>jboss-el-api_2.2_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>javax.enterprise</groupid> <artifactid>cdi-api</artifactid> <version>1.0-sp4</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.enterprise.deploy</groupid> <artifactid>jboss-jad-api_1.2_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.faces</groupid> <artifactid>jboss-jsf-api_2.1_spec</artifactid> <version>2.0.0.final</version> </dependency> <dependency> <groupid>javax.inject</groupid> <artifactid>javax.inject</artifactid> <version>1</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.interceptor</groupid> <artifactid>jboss-interceptors-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.jms</groupid> <artifactid>jboss-jms-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>javax.jws</groupid> <artifactid>jsr181-api</artifactid> <version>1.0-mr1</version> </dependency> <dependency> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> <version>1.4.4</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.management.j2ee</groupid> <artifactid>jboss-j2eemgmt-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.hibernate.javax.persistence</groupid> <artifactid>hibernate-jpa-2.0-api</artifactid> <version>1.0.1.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.resource</groupid> <artifactid>jboss-connector-api_1.6_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.rmi</groupid> <artifactid>jboss-rmi-api_1.0_spec</artifactid> <version>1.0.4.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.security.auth.message</groupid> <artifactid>jboss-jaspi-api_1.0_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.security.jacc</groupid> <artifactid>jboss-jacc-api_1.4_spec</artifactid> <version>1.0.1.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.servlet</groupid> <artifactid>jboss-servlet-api_3.0_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.servlet.jsp</groupid> <artifactid>jboss-jsp-api_2.2_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.servlet.jstl</groupid> <artifactid>jboss-jstl-api_1.2_spec</artifactid> <version>1.0.2.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.transaction</groupid> <artifactid>jboss-transaction-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>javax.validation</groupid> <artifactid>validation-api</artifactid> <version>1.0.0.ga</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.ws.rs</groupid> <artifactid>jboss-jaxrs-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>wsdl4j</groupid> <artifactid>wsdl4j</artifactid> <version>1.6.2</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.xml.bind</groupid> <artifactid>jboss-jaxb-api_2.2_spec</artifactid> <version>1.0.3.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.xml.registry</groupid> <artifactid>jboss-jaxr-api_1.0_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.xml.rpc</groupid> <artifactid>jboss-jaxrpc-api_1.1_spec</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.xml.soap</groupid> <artifactid>jboss-saaj-api_1.3_spec</artifactid> <version>1.0.1.final</version> </dependency> <dependency> <groupid>org.jboss.spec.javax.xml.ws</groupid> <artifactid>jboss-jaxws-api_2.2_spec</artifactid> <version>2.0.0.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>4.2.0.final</version> </dependency> <dependency> <groupid>org.picketbox</groupid> <artifactid>picketbox-commons</artifactid> <version>1.0.0.final</version> </dependency> <dependency> <groupid>org.picketbox</groupid> <artifactid>picketbox-infinispan</artifactid> <version>4.0.6.final</version> </dependency> <dependency> <groupid>org.jboss.as</groupid> <artifactid>jboss-as-controller-client</artifactid> <version>7.1.0.final</version> </dependency> <dependency> <groupid>org.jboss</groupid> <artifactid>jboss-dmr</artifactid> <version>1.1.1.final</version> </dependency> <dependency> <groupid>org.jboss.logging</groupid> <artifactid>jboss-logging</artifactid> <version>3.1.0.ga</version> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>resteasy-jaxb-provider</artifactid> <version>2.3.1.ga</version> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>async-http-servlet-3.0</artifactid> <version>2.3.1.ga</version> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>resteasy-jaxrs</artifactid> <version>2.3.1.ga</version> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>resteasy-multipart-provider</artifactid> <version>2.3.1.ga</version> </dependency> <dependency> <groupid>org.jboss.ejb3</groupid> <artifactid>jboss-ejb3-ext-api</artifactid> <version>2.0.0</version> </dependency> <dependency> <groupid>c3p0</groupid> <artifactid>c3p0</artifactid> <version>0.9.1</version> </dependency> <dependency> <groupid>ecs</groupid> <artifactid>ecs</artifactid> <version>1.4.2</version> </dependency> <dependency> <groupid>net.sf.ehcache</groupid> <artifactid>ehcache</artifactid> <version>1.2.3</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-c3p0</artifactid> <version>3.3.2.ga</version> </dependency> <dependency> <groupid>org.cheffo</groupid> <artifactid>jeplite</artifactid> <version>0.8.7a</version> </dependency> <dependency> <groupid>org.cheffo</groupid> <artifactid>jeplite</artifactid> <version>0.8.7a</version> <classifier>sources</classifier> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.10</version> </dependency> <dependency> <groupid>com.sun</groupid> <artifactid>tools</artifactid> <version>1.5.0</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi</artifactid> <version>3.9</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi-ooxml</artifactid> <version>3.9</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi-ooxml-schemas</artifactid> <version>3.9</version> </dependency> <dependency> <groupid>org.apache.poi</groupid> <artifactid>poi-scratchpad</artifactid> <version>3.9</version> </dependency> </dependencies> <build> <sourcedirectory>src</sourcedirectory> <resources> <resource> <directory>src</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
all dependecies apache poi 3.9 defined , jars correctly included in classpath. when try deploy jar file deployment fails due
" java.lang.noclassdeffounderror: org/apache/poi/ss/usermodel/font"
after reading on google, have changed jboss-deployment-structure
<?xml version="1.0" encoding="utf-8"?> <jboss-deployment-structure> <deployment> <dependencies> <module name="org.hibernate" export="true" /> <system export="true"> <paths> <path name="org/apache/poi/ss/usermodel/row"/> <path name="org/apache/poi/ss/usermodel/font"/> </paths> </system> </dependencies> </deployment> </jboss-deployment-structure>
but still facing same problem not happen war file able deploy without issues , uses same class. insight how solve issue of great help
in manifest.mf
add
manifest-version: 1.0 class-path: dependencies: org.apache.poi
also, make sure have modules inside jboss setup correctly, should have folder in org/apache
called poi
, main
inside main have jars , module.xml, jars need are:
poi
poi-ooxml
poi-ooxml-schemas
poi-scratchpad
dom4j
stax-api
xmlbeans
your module.xml
like
<module xmlns="urn:jboss:module:1.1" name="org.apache.poi"> <properties> <property name="jboss.api" value="private"/> </properties> <resources> <resource-root path="poi-3.9-20121203.jar"/> <resource-root path="poi-ooxml-3.9-20121203.jar"/> <resource-root path="poi-ooxml-schemas-3.9-20121203.jar"/> <resource-root path="poi-scratchpad-3.9-20121203.jar"/> <resource-root path="dom4j-1.6.1.jar"/> <resource-root path="stax-api-1.0.1.jar"/> <resource-root path="xmlbeans-2.3.0.jar"/> </resources> <dependencies> <module name="javax.api"/> </dependencies> </module>
poi-ooxml
reading 2007 excel , above needs poi
, poi-ooxml-schema
along dom4j
, stax-api
, xmlbean
, xmlbeans needs dependency "javax.api".
last thing make sure versions compatible
Comments
Post a Comment