It looks like you have the dependency's scope set to "test" when it should be "compile". I'd suggest removing the scope element from your dependency since compile is the default.

Matt

On Feb 27, 2009, at 4:55 AM, jackalista <j...@twaxx.com> wrote:


ok, I looked around and found examples that had the groupId set a s
commons-collections so I change the <dependency> to look like this:

<dependency>
 <groupId>org.apache.commons</groupId>
 <artifactId>commons-collections</artifactId>
 <version>${commons.collections.version}</version>
 <scope>test</scope>
</dependency>

This resulted in a different error with another commons-collections class,
the root exception is this:

Invocation of init method failed; nested exception is
java.lang.NoClassDefFoundError:
org/apache/commons/collections/SequencedHashMap.



I ran the mvn dependency:tree command again and got only references to 3.2
version of commons-collections, but it didn't resolve the problem.

Another developer said he upgraded maven2 from 2.0.8 to 2.0.10 and the
original problem with the LinkedMap NoClassDefFoundError was resolved. I'm
on ubuntu and running 2.0.8:

Maven version: 2.0.8
Java version: 1.5.0_15
OS name: "linux" version: "2.6.24-23-generic" arch: "i386" Family: "unix"

I ran apt-get install maven2 and it seems to think it's at the latest
version:

sudo apt-get install maven2
Reading package lists... Done
Building dependency tree
Reading state information... Done
maven2 is already the newest version.
The following packages were automatically installed and are no longer
required:
 linux-headers-2.6.24-16-generic linux-headers-2.6.24-16
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

This might mean the ubuntu repositories aren't populated yet with later versions as 2.0.10 is out there now on the maven site. Could this be the
problem?


In case it helps, here's the output of the mvn dependency:tree command:

com.dnb.supplierportal:supplierportal:pom:1.0-SNAPSHOT
[INFO] +- mysql:mysql-connector-java:jar:5.0.5:compile
[INFO] +- org.jmock:jmock:jar:2.4.0:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] |  \- org.hamcrest:hamcrest-library:jar:1.1:test
[INFO] +- org.jmock:jmock-junit4:jar:2.4.0:test
[INFO] |  \- junit:junit-dep:jar:4.4:test
[INFO] +- junit:junit:jar:4.4:test
[INFO] +- org.springframework:spring-test:jar:2.5.4:test
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:test
[INFO] +- org.subethamail:subethasmtp-wiser:jar:1.2:test
[INFO] |  +- org.subethamail:subethasmtp-smtp:jar:1.2:test
[INFO] |  \- javax.mail:mail:jar:1.4:test
[INFO] |     \- javax.activation:activation:jar:1.1:test
[INFO] \- commons-collections:commons-collections:jar:3.2:test

...

[INFO] [dependency:tree]
[INFO] com.dnb.supplierportal:supplierportal-core:jar:1.0-SNAPSHOT
[INFO] +- mysql:mysql-connector-java:jar:5.0.5:compile
[INFO] +- org.jmock:jmock:jar:2.4.0:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] |  \- org.hamcrest:hamcrest-library:jar:1.1:test
[INFO] +- org.jmock:jmock-junit4:jar:2.4.0:test
[INFO] |  \- junit:junit-dep:jar:4.4:test
[INFO] +- junit:junit:jar:4.4:test (scope not updated to compile)
[INFO] +- org.springframework:spring-test:jar:2.5.4:test
[INFO] +- org.subethamail:subethasmtp-wiser:jar:1.2:test
[INFO] |  \- org.subethamail:subethasmtp-smtp:jar:1.2:test
[INFO] +- commons-collections:commons-collections:jar:3.2:test (scope not
updated to compile)

...


[INFO] snapshot com.dnb.supplierportal:supplierportal-core:1.0- SNAPSHOT:
checking for updates from appfuse
[INFO] [dependency:tree]
[INFO] com.dnb.supplierportal:supplierportal-webapp:war:1.0-SNAPSHOT
[INFO] +- mysql:mysql-connector-java:jar:5.0.5:compile
[INFO] +- org.jmock:jmock:jar:2.4.0:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] |  \- org.hamcrest:hamcrest-library:jar:1.1:test
[INFO] +- org.jmock:jmock-junit4:jar:2.4.0:test
[INFO] |  \- junit:junit-dep:jar:4.4:test
[INFO] +- junit:junit:jar:4.4:test (scope not updated to compile)
[INFO] +- org.springframework:spring-test:jar:2.5.4:test
[INFO] +- org.subethamail:subethasmtp-wiser:jar:1.2:test
[INFO] |  \- org.subethamail:subethasmtp-smtp:jar:1.2:test
[INFO] +- commons-collections:commons-collections:jar:3.2:test (scope not
updated to compile)





jackalista wrote:

I don't see *any* reference to commons nor dbcp at all. So, I'm guessing I need to add a dependency for commons- collections:3.2 as you suggest
below.  To do this I tried:

1. added this to the properties section that contains other dependency versions (like "Framework dependency versions" and "Testing dependency
versions"):

<commons.collections.version>3.2</commons.collections.version>

Then I added a dependency to the <dependencies>...</dependencies> element, which already contains dependencies for jmock, junit, etc. I think I may
havef the groupId wrong though.  Here's now it looks:

<dependency>
 <groupId>org.apache.commons</groupId>
 <artifactId>commons-collections</artifactId>
 <version>${commons.collections.version}</version>
 <scope>test</scope>
</dependency>

This didn't work, am I doing the right things, do I have things in the
right place, and is the stuff I put for the groupId correct?

The build said it failed to resolve artifact, so I'm guessing I have
something wrong here as it started to give me instructions to manually download the stuff which seems ludicrous for something out of the commons
stuff.  What did I do wrong?  See below for the attempt, it tried to
download it but couldn't resolve it. I'm thinking I specified either the groupId or the artifactId or both incorrectly, can you see what's wrong? Below is the build output, in case that might tell more specifically than
what I've said.  Thanks, BTW...



build output:

[INFO] Building AppFuse Modular Application
[INFO]    task-segment: [install]
[INFO]
--- --------------------------------------------------------------------- [INFO] artifact org.apache.maven.plugins:maven-site-plugin: checking for
updates from appfuse
[INFO] artifact org.apache.maven.plugins:maven-install-plugin: checking
for updates from appfuse
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /home/jack/java/af/foo/spring/myproject/pom.xml to
/home/jack/.m2/repository/com/foo/myproject/myproject/1.0-SNAPSHOT/ myproject-1.0-SNAPSHOT.pom
[INFO]
--- ---------------------------------------------------------------------
[INFO] Building AppFuse Modular Application - Core
[INFO]    task-segment: [install]
[INFO]
--- --------------------------------------------------------------------- [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking
for updates from appfuse
[INFO] artifact org.apache.maven.plugins:maven-surefire-plugin: checking
for updates from appfuse
[INFO] artifact org.apache.maven.plugins:maven-jar-plugin: checking for
updates from appfuse
Downloading:
http://repo1.maven.org/maven2/org/apache/commons/commons-collections/3.2/commons-collections-3.2.pom
Downloading:
http://static.appfuse.org/repository/org/apache/commons/commons-collections/3.2/commons-collections-3.2.pom
[INFO] [aspectj:compile {execution: default}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] Preparing hibernate3:hbm2ddl
[WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive
invocation.
[INFO] [aspectj:compile {execution: default}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading:
http://repo1.maven.org/maven2/org/apache/commons/commons-collections/3.2/commons-collections-3.2.jar
Downloading:
http://static.appfuse.org/repository/org/apache/commons/commons-collections/3.2/commons-collections-3.2.jar
[INFO]
--- ---------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
--- ---------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.apache.commons:commons-collections:jar:3.2

 Try downloading the file manually from the project website.

 Then, install it using the command:
     mvn install:install-file -DgroupId=org.apache.commons
-DartifactId=commons-collections -Dversion=3.2 -Dpackaging=jar
-Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file
there:
     mvn deploy:deploy-file -DgroupId=org.apache.commons
-DartifactId=commons-collections -Dversion=3.2 -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

 Path to dependency:
     1) com.dnb.supplierportal:supplierportal-core:jar:1.0-SNAPSHOT
     2) org.apache.commons:commons-collections:jar:3.2






mraible wrote:

If you have commons-dbcp as a dependency in your pom, exclude commons-
collections from it. Either that, or add a dependency for commons-
collections:3.2 to your pom.

Matt

On Feb 26, 2009, at 10:04 PM, jackalista <j...@twaxx.com> wrote:


I ran that and found a reference to commons-collections 3.2, and this
reference to commons-collections 2.1:

+- commons-dbcp:commons-dbcp:jar:1.2.1:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:
2.1:compile

Does this mean that the old 2.1 version of commons-collections is a
dependency of  commons-dbcp:commons-dbcp:jar version 1.2.1?

So exclude commons-dbcp?  There is no other reference to commons-
dbcp...
isn't this going to leave me without a connection pool, or is
commons-dbcp
no longer in use, in which case why is it still in here?

Also, how do I exclude commons-dbcp, if that's what needs to be
excluded?

Thanks



mraible wrote:

I would run mvn dependency:tree and look for where the older version
of commons-collections is coming from. Then exclude it in your
pom.xml.

Matt

On Feb 26, 2009, at 9:04 PM, jackalista <j...@twaxx.com> wrote:


Hi,

I'm trying to create a new project and am doing the following steps:

1. run archetype mvn command for modular spring project, which runs
successfully.
2. cd into myproject and run "mvn" to do the massive download.
3. it results in this (I'll only list if from the error but can post
more of
the mvn command's output if needed):

[INFO] [talledLocalContainer] Tomcat 5.x starting...
[INFO] [talledLocalContainer] Feb 26, 2009 10:53:48 PM
org.apache.coyote.http11.Http11Protocol init
[INFO] [talledLocalContainer] INFO: Initializing Coyote HTTP/ 1.1 on
http-8081
[INFO] [talledLocalContainer] Feb 26, 2009 10:53:48 PM
org.apache.catalina.startup.Catalina load
[INFO] [talledLocalContainer] INFO: Initialization processed in
720 ms
[INFO] [talledLocalContainer] Feb 26, 2009 10:53:48 PM
org.apache.catalina.core.StandardService start
[INFO] [talledLocalContainer] INFO: Starting service Catalina
[INFO] [talledLocalContainer] Feb 26, 2009 10:53:48 PM
org.apache.catalina.core.StandardEngine start
[INFO] [talledLocalContainer] INFO: Starting Servlet Engine: Apache
Tomcat/6.0.14
[INFO] [talledLocalContainer] Feb 26, 2009 10:53:53 PM
org.apache.catalina.core.ApplicationContext log
[INFO] [talledLocalContainer] INFO: Initializing Spring root
WebApplicationContext
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:09 PM
org.apache.catalina.core.StandardContext listenerStart
[INFO] [talledLocalContainer] SEVERE: Exception sending context
initialized
event to listener instance of class
net.sf.navigator.menu.MenuContextListener
[INFO] [talledLocalContainer] java.lang.NoClassDefFoundError:
org/apache/commons/collections/map/LinkedMap
[INFO] [talledLocalContainer]    at
net.sf.navigator.menu.MenuRepository.<init>(MenuRepository.java: 38)
[INFO] [talledLocalContainer]    at
net.
sf.
navigator.
menu.
MenuContextListener.contextInitialized(MenuContextListener.java:
57)
[INFO] [talledLocalContainer]    at
org.
apache.
catalina.core.StandardContext.listenerStart(StandardContext.java:
3830)
[INFO] [talledLocalContainer]    at
org. apache.catalina.core.StandardContext.start(StandardContext.java:
4337)
[INFO] [talledLocalContainer]    at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
1045)
[INFO] [talledLocalContainer]    at
org.apache.catalina.core.StandardHost.start(StandardHost.java: 719)
[INFO] [talledLocalContainer]    at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
1045)
[INFO] [talledLocalContainer]    at
org. apache.catalina.core.StandardEngine.start(StandardEngine.java:
443)
[INFO] [talledLocalContainer]    at
org. apache.catalina.core.StandardService.start(StandardService.java:
516)
[INFO] [talledLocalContainer]    at
org. apache.catalina.core.StandardServer.start(StandardServer.java:
710)
[INFO] [talledLocalContainer]    at
org.apache.catalina.startup.Catalina.start(Catalina.java:566)
[INFO] [talledLocalContainer]    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [talledLocalContainer]    at
sun.
reflect.
NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[INFO] [talledLocalContainer]    at
sun.
reflect.
DelegatingMethodAccessorImpl.
invoke(DelegatingMethodAccessorImpl.java:25)
[INFO] [talledLocalContainer]    at
java.lang.reflect.Method.invoke(Method.java:585)
[INFO] [talledLocalContainer]    at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
[INFO] [talledLocalContainer]    at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:09 PM
org.apache.catalina.core.StandardContext start
[INFO] [talledLocalContainer] SEVERE: Error listenerStart
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:09 PM
org.apache.catalina.core.StandardContext start
[INFO] [talledLocalContainer] SEVERE: Context
[/supplierportal-webapp-1.0-SNAPSHOT] startup failed due to previous
errors
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:09 PM
org.apache.catalina.core.ApplicationContext log
[INFO] [talledLocalContainer] INFO: Closing Spring root
WebApplicationContext
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:10 PM
org.apache.catalina.startup.HostConfig deployWAR
[INFO] [talledLocalContainer] INFO: Deploying web application
archive
cargocpc.war
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:10 PM
org.apache.coyote.http11.Http11Protocol start
[INFO] [talledLocalContainer] INFO: Starting Coyote HTTP/1.1 on
http-8081
[INFO] [talledLocalContainer] Feb 26, 2009 10:54:10 PM
org.apache.catalina.startup.Catalina start
[INFO] [talledLocalContainer] INFO: Server startup in 22241 ms
[INFO] [talledLocalContainer] Tomcat 5.x started on port [8081]
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
 [mkdir] Created dir:
/home/jack/java/af/foo/spring/myproject/web/target/webtest-data
  [echo] Testing 'supplierportal-webapp-1.0-SNAPSHOT' with locale
'en'

Login:
[INFO]
---
---
--- ---------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
---
---
--- ---------------------------------------------------------------
[INFO] Error executing ant tasks


--
View this message in context:
http://www.nabble.com/java.lang.NoClassDefFoundError%3A-org-apache-commons-collections-map-LinkedMap-tp22239225s2369p22239225.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---
--- ---------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net


--- ------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net




--
View this message in context:
http://www.nabble.com/java.lang.NoClassDefFoundError%3A-org-apache-commons-collections-map-LinkedMap-tp22239225s2369p22239657.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


--- ------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net


--- ------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net






--
View this message in context: 
http://www.nabble.com/java.lang.NoClassDefFoundError%3A-org-apache-commons-collections-map-LinkedMap-tp22239225s2369p22244441.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net






--
View this message in context: 
http://www.nabble.com/java.lang.NoClassDefFoundError%3A-org-apache-commons-collections-map-LinkedMap-tp22239225s2369p22244441.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to