2

When I try to type command to deploy my servlet:

mvn clean package wildfly:deploy

I got error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wildfly-helloworld: Compilation failure: Compilation failure:
[ERROR] /data/helloworld/src/main/java/org/jboss/as/quickstarts/helloworld/q2Servlet.java:[11,39] package org.apache.commons.codec.binary does not exist
[ERROR] /data/helloworld/src/main/java/org/jboss/as/quickstarts/helloworld/q2Servlet.java:[15,31] package org.apache.commons.dbcp does not exist
[ERROR] /data/helloworld/src/main/java/org/jboss/as/quickstarts/helloworld/q2Servlet.java:[16,31] package org.apache.commons.dbcp does not exist

seems missing packages, I have in my code:

import org.apache.commons.codec.binary.Hex;
import org.apache.commons.dbcp.ConnectionFactory;
import org.apache.commons.dbcp.DriverManagerConnectionFactory;
import org.apache.commons.dbcp.PoolableConnectionFactory;
import org.apache.commons.dbcp.PoolingDataSource;

How do I solve this, thank you very much

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
Robin
  • 25
  • 1
  • 6
  • Do you have that dependency ([commons-dbcp](http://mvnrepository.com/artifact/commons-dbcp/commons-dbcp/1.4))? Show your pom – Paul Samsotha Nov 06 '14 at 03:22
  • Hi peeskillet, thanks for answering. I added dependencies into the pom.xml and resolved many errors. but still I have one package missing, which is "org.apache.commons.dbcp", do you know what is the for it? thanks – Robin Nov 06 '14 at 05:04
  • Click that link. The packages should be included in that artifact – Paul Samsotha Nov 06 '14 at 05:09
  • May you also need [commons-codec](http://mvnrepository.com/artifact/commons-codec/commons-codec/1.9) for `org.apache.commons.codec.binary.Hex` – Paul Samsotha Nov 06 '14 at 05:11
  • Thank you peeskillet, all set! – Robin Nov 06 '14 at 06:14
  • yes sure, btw why did you post in cemments rather than in answer, so I can accept your fast and wonderful answer? – Robin Nov 06 '14 at 11:53
  • I was being lazy :-). Will post now. Also sometimes there are versioning problems with dependencies, so wasn't sure without seeing your pom, if everything would play well together :-) – Paul Samsotha Nov 06 '14 at 11:57

1 Answers1

6

org.apache.commons.dbcp are in the commons-dbcp jar

<dependency>
    <groupId>commons-dbcp</groupId>
    <artifactId>commons-dbcp</artifactId>
    <version>1.4</version>
</dependency>

org.apache.commons.codec.binary are in commons-codec jar

<dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <version>1.9</version>
</dependency>
Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720