- This topic has 11 replies, 3 voices, and was last updated 14 years, 1 month ago by support-shalini.
-
AuthorPosts
-
Alexander GarbuzMemberI have a web project that I set up by creating a new Java Maven Project and then added web capabilities to it. In that case I can use Maven to manage all my dependencies and let MyEclipse manage server deployments. However, when I started actually working on the project I noticed that my unit tests are failing with ClassNotFoundException. Currently my classpath file defines output folder as /src/main/webapp/WEB-INF/classes. If I change this location to /target/classes then my unit tests work just fine but I become unable to to deploy the project to Tomcat.
I know that this problem did not exist before I upgraded from version 7.x to version 8.6. I have used MyEclipse for at least 6 years now always liked it for its simplicity and reliability and I am really disappointed in the current version. This is really annoying and really get in a way of getting things done.
Does anyone have any idea how to solve this issue?
Just in case: I use Java 6 / Tomcat 6. This is my project structure
/src /main/ /java /resources /webapp /WEB-INF/classes /test /java
support-joyMembergarbuz,
Sorry to hear you are running into this issue. Can you answer below queries –
1. Can you copy and paste your installation details? Open MyEclipse IDE, from menu options click on MyEclipse > Installation Summary > Installation Details.
2. You mention ClassNotFoundException. Can you please copy and paste your stack trace? Also copy and paste relevant issues logged in your .log file. Your log file is located at [your workspace dir]/.metadata/.log.
3. Can you right click on your project > MyEclipse > Open in Explorer and copy and paste the contents of your .classpath, .project and .pom files?
Alexander GarbuzMemberInstallation summary:
*** Date: Monday, October 11, 2010 8:51:22 AM CDT ** System properties: OS=WindowsVista OS version=6.1.0 Java version=1.6.0_13 *** MyEclipse details: MyEclipse Enterprise Workbench Version: 8.6 Build id: 8.6-20100723 *** Eclipse details: MyEclipse Enterprise Workbench Version: 8.6 Build id: 8.6-20100723 Eclipse startup command=-os win32 -ws win32 -arch x86 -showsplash -launcher C:\Users\alex\AppData\Local\Genuitec\MyEclipse-8.6\myeclipse.exe -name Myeclipse --launcher.library C:\Users\alex\AppData\Local\Genuitec\MyEclipse-8.6\../Common/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519\eclipse_1206.dll -startup C:\Users\alex\AppData\Local\Genuitec\MyEclipse-8.6\../Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar -install C:/Users/alex/AppData/Local/Genuitec/MyEclipse-8.6 -configuration configuration -vm C:/Users/alex/AppData/Local/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client/jvm.dll
Alexander GarbuzMember.classpath file
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/main/resources"/> <classpathentry kind="src" path="src/test/java"/> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/> </classpath>
.project file
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>news-publishing-web</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.maven.ide.eclipse.maven2Builder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.wst.validation.validationbuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature> <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.maven.ide.eclipse.maven2Nature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature> </natures> </projectDescription>
mymetadata file
<?xml version="1.0" encoding="UTF-8"?> <project-module type="WEB" name="news-publishing-web" id="myeclipse.1286165717605" context-root="/news-publishing-web" j2ee-spec="5.0" archive="news-publishing-web.war"> <attributes> <attribute name="webrootdir" value="/src/main/webapp" /> </attributes> </project-module>
Alexander GarbuzMemberPOM
<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>com.newspub</groupId> <artifactId>request-manager</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>Request Management Application</name> <url>http://maven.apache.org</url> <developers> <developer> <id>agarbuz</id> <name>Alexander Garbuz</name> <email>alex@garbuz.com</email> <url>http://garbuz.com</url> <roles> <role>Lead Developer</role> <role>Project Manager</role> </roles> </developer> </developers> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>3.0.0.RELEASE</spring.version> <tiles.version>2.1.4</tiles.version> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <verbose>true</verbose> <fork>true</fork> <compilerVersion>1.6</compilerVersion> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <repositories> <repository> <id>codehaus-repository</id> <name>Codehaus Repository</name> <url>http://repository.codehaus.org</url> </repository> <repository> <id>codehaus-snapshots-repository</id> <name>Codehaus Snapshots Repository</name> <url>http://snapshots.repository.codehaus.org</url> </repository> <repository> <id>codehaus-dist-repository</id> <name>Codehaus Dist Repository</name> <url>http://dist.codehaus.org</url> </repository> </repositories> <dependencies> <!-- Provided Dependencies --> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <!-- Runtime components --> <!-- Test Components --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>easymock</groupId> <artifactId>easymock</artifactId> <version>2.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <scope>test</scope> </dependency> <!-- Spring Components --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-struts</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-asm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <!-- Tiles components --> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-api</artifactId> <version>${tiles.version}</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-core</artifactId> <version>${tiles.version}</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-jsp</artifactId> <version>${tiles.version}</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-servlet</artifactId> <version>${tiles.version}</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-servlet-wildcard</artifactId> <version>2.2.1</version> </dependency> <!-- Tiles Dependencies --> <dependency> <groupId>stax</groupId> <artifactId>stax</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>stax</groupId> <artifactId>stax-api</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.5.8</version> </dependency> <dependency> <groupId>aopalliance</groupId> <artifactId>aopalliance</artifactId> <version>1.0</version> </dependency> <!-- Apache Commons Components --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.9</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.4</version> </dependency> <!-- Apache Struts Dependencies --> <dependency> <groupId>struts</groupId> <artifactId>struts</artifactId> <version>1.2.9</version> </dependency> <!-- Database Components --> <dependency> <groupId>org.apache.ibatis</groupId> <artifactId>ibatis-sqlmap</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency> </dependencies> </project>
Alexander GarbuzMemberStack trace
Class not found com.newspub.ui.web.validator.ValidatorTest java.lang.ClassNotFoundException: com.newspub.ui.web.validator.ValidatorTest 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) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Alexander GarbuzMemberand finally a piece from error log:
!ENTRY org.eclipse.core.jobs 4 2 2010-10-11 09:05:15.237 !MESSAGE An internal error occurred during: "Items filtering". !STACK 0 java.lang.IllegalArgumentException: Class file name must end with .class at org.eclipse.jdt.internal.core.PackageFragment.getClassFile(PackageFragment.java:182) at org.eclipse.jdt.internal.core.search.TypeNameMatchRequestorWrapper.createTypeFromJar(TypeNameMatchRequestorWrapper.java:146) at org.eclipse.jdt.internal.core.search.TypeNameMatchRequestorWrapper.acceptType(TypeNameMatchRequestorWrapper.java:108) at org.eclipse.jdt.internal.core.search.BasicSearchEngine$3.acceptIndexMatch(BasicSearchEngine.java:1111) at org.eclipse.jdt.core.search.SearchPattern.acceptMatch(SearchPattern.java:289) at org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(SearchPattern.java:2124) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.findIndexMatches(MatchLocator.java:264) at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:97) at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute(PatternSearchJob.java:63) at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(JobManager.java:276) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchAllTypeNames(BasicSearchEngine.java:1122) at org.eclipse.jdt.core.search.SearchEngine.searchAllTypeNames(SearchEngine.java:815) at org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog.fillContentProvider(FilteredTypesSelectionDialog.java:556) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.filterContent(FilteredItemsSelectionDialog.java:2182) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.internalRun(FilteredItemsSelectionDialog.java:2124) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.doRun(FilteredItemsSelectionDialog.java:2096) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.run(FilteredItemsSelectionDialog.java:2083) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
support-shaliniMembergarbuz,
Since you have created a java maven project and then added web capabilities, output directory is not added to your pom.xml.
You need to specify the output folder under <build> as follows<outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
Replace the above value with appropriate value.
Let me know if that helps
Alexander GarbuzMemberIt worked, however, I am not sure how this worked. Could you explain this, please?
support-shaliniMembergarbuz,
Since this is maven project, maven needs to know the output directory else it just considers the default output directory.
Specifying the output folder in pom.xml will fix this.
Alexander GarbuzMemberthat makes sense. I did not know that in this case eclipse will actually use maven to do that build.
support-shaliniMembergarbuz,
Glad that its clarified.
Let us know if you have any issues. -
AuthorPosts