Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Error: Could not find or load main class com.raj.spring.springormagain.Test

What I have tried:

Test.java
Java
package com.raj.spring.springormagain;
public class Test {
	public static void main(String[] args) {
		System.out.println("hello world");
	}
}
POM.xml
Java
<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

	<groupid>com.raj.spring
	<artifactid>springormagain
	<version>0.0.1-SNAPSHOT
	<packaging>jar

	<name>springormagain
	<url>http://maven.apache.org

	<properties>
		<springframework.version>5.0.8.RELEASE
	

	<dependencies>
		<dependency>
			<groupid>org.springframework
			<artifactid>spring-core
			<version>${springframework.version}
		

		<dependency>
			<groupid>org.springframework
			<artifactid>spring-context
			<version>${springframework.version}
		

		<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
		<dependency>
			<groupid>org.springframework
			<artifactid>spring-orm
			<version>${springframework.version}
		

		<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
		<dependency>
			<groupid>org.hibernate
			<artifactid>hibernate-core
			<version>5.3.6.Final
		

		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
		<dependency>
			<groupid>mysql
			<artifactid>mysql-connector-java
			<version>8.0.12
		
	
	
	<build>
		<pluginmanagement>
			<plugins>
				<plugin>
					<groupid>org.apache.maven.plugins
					<artifactid>maven-compiler-plugin
					<version>3.8.0
					<configuration>
						<source />1.8
						<target>1.8
Posted
Updated 23-Sep-18 21:05pm
v3
Comments
wseng 24-Sep-18 3:03am    
how you run this ?
Member 13994629 24-Sep-18 3:57am    
By configuring TOMCAT Server and using mysql database.
rightclick on the test file and run as java application.
wseng 24-Sep-18 12:07pm    
Did it worked when you run it using the run button in IDE ?
Richard MacCutchan 24-Sep-18 4:17am    
I don't know spring but I wonder if you have the correct structure. Your XML has the following:

<groupid>com.raj.spring
<artifactid>springormagain
<version>0.0.1-SNAPSHOT
<packaging>jar

Does that mean that the framework expects your program to be part of a jar?
Member 13994629 24-Sep-18 4:56am    
I might be wrong, but according to my knowledge, pom create a jar for you when you package(compile the code) it and put it somewhere in the target directory (by default), but it will also put the package in your local repository.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900