ECLIPSE JAVA JRE
When using Eclipse, in the Java Build environment, the JRE runtime should use JAVA_HOME, not JRE_HOME.
CAN'T START TOMCAT7 as Windows Service
If Tomcat7 service can not be started and got an error message about "%1 is not a valid Win32 application.", it is caused by running a 32-bit version of T Tomcat7 in a 64-bit OS.
To correct the problem, download the 64-bit version of Tomcat7 and it should be started as a Windows service.
Prepare TOMCAT8 as Windows Service
1. Define CATALINA_HOME=$tomcat_installation_directory$
2. Start a new Windows command window
3. cd "%CATALINE_HOME%\bin"
4. type in "service.bat install". A new service "Apache Tomcat8" is created.
5. Start Windows Services program and start Tomcat8.
6. Open a browser and type in "http://localhost:8080". Tomcat8 home page shows up. One needs to add a privileged user to manager and deploy WAR files.
7. Any time you change Tomcat's configuration file, you need to stop and start Tomcat.
Add TOMCAT8 Privilege User
1. Open and edit Tomcat user definition file - %CATALINA_HOME%\conf\tomcat-users.xml
2. Add the following lines in the <tomcat-users> section for a user/pswd 'tomcat/tomcat'. Change this to whatever you like.
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui, admin-gui"/>
3. Stop and start Tomcat8. You will be prompted to enter id/pswd for management tasks.
JDK 1,8 NOT COMPATIBLE with OLDER Spring Framework
Error message ---- [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
Downloaded JDK 1,7 version and undeployed from Tomcat7. Brought up Eclipse and did a 'mvn clean' , then 'mvn build.'
REPLACE JDK1.5 with JDK1.7
Error Message ----- A resource exists with a different case: '/funtoro-core/src/test/Java'.
This is due to name conflict between this package and another package, probably the 'main' package.
Either remove or do a search on the package name conflict (is there an easy way to do this?)
TEST Directory
The 'test' directory should be under 'src' and not at the same level as 'src.'
API Update -
OLD : import org.springframework.security.userdetails.UsernameNotFoundException;
NEW: import org.springframework.security.core.userdetails.UsernameNotFoundException;
OLD: import org.springframework.security.providers.encoding.PasswordEncoder;
NEW: import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
OLD: protected PasswordEncoder passwordEncoder;
NEW : protected BCryptPasswordEncoder passwordEncoder;
OLD : String eventId = passwordEncoder.encodePassword(time + "", "eventId");
NEW : String eventId = passwordEncoder.encodePassword(time + "");
JRE VERSION
See this URL: http://stackoverflow.com/questions/3539139/what-causes-a-new-maven-project-in-eclipse-to-use-java-1-5-instead-of-java-1-6-b
The m2eclipse plugin doesn't use Eclipse defaults, the m2eclipse
plugin derives the settings from the POM. So if you want a Maven project
to be configured to use Java 1.6 settings when imported under Eclipse,
configure the
maven-compiler-plugin
appropriately, as I already suggested:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
If your project is already imported, update the project configuration (
right-click on the project then
Maven V Update Project Configuration).
Unable to locate Spring NamespaceHandler for XML schema namespace
Read this page - http://www.baeldung.com/unable-to-locate-spring-namespacehandler-for-xml-schema-namespace.
Add the following to the webapp .pom file -
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
M2Eclipse Plugin Site URL
|
Basically, I needed to add the m2eclipse plugin to Eclipse. You can find instructions at http://m2eclipse.sonatype.org/installing-m2eclipse.html
|
MAVEN pom.xml Error
- web.xml is missing and <failOnMissingWebXml> is set to true
Solved - just deleted folders within my project
.metada
.project
.settings
.classpath
Check WAR after Build
Make sure the correct libraries are included. POM can be confusing.
Eclipse warning for web.xml:
“No grammar constraints (DTD or XML schema) detected for the document.”
Add second line so the first two lines of pom.xml are:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
"Welcome Files cannot begin or end with a /."
- solution : remove the "/"
"An error occurred while filtering resources"
solution - Right click project -> maven -> update project.
"Spring-context has a <test> scope, so org.springframework.stereotype was not found."
So remove the <scope>test<scope> from spring-context dependency section.
"org.springframework.cache.ehcache is missing"
"the EHCache support classes in the org.springframework.cache.ehcache
package moved from the spring-context module to spring-context-support".
"IOException is not compatible" in later versions of org.springframework.cache.ehcache.EhCacheManagerFactoryBean
// public void afterPropertiesSet() throws CacheException, IOException {
public void afterPropertiesSet() throws CacheException {
"CronTriggerBean is missing"
From Spring 3.1+, Change the Class names for the CronTriggerFactoryBean & JobDetailFactoryBean as like below
org.springframework.scheduling.quartz.CronTriggerBean
org.springframework.scheduling.quartz.CronTriggerFactoryBean
org.springframework.scheduling.quartz.JobDetailBean
org.springframework.scheduling.quartz.JobDetailFactoryBean
So your steps are:
Change
CronTriggerBean to CronTriggerFactoryBean
JobDetailBean to
JobDetailFactoryBean
See this link http://stackoverflow.com/questions/30520265/migrating-from-spring-3-to-spring-4-org-springframework-scheduling-quartz-cron
Eclipse Maven Local Repository
1. define the M2_REPO linked resource in project properties 'Resource->Linked Resources->Path Variables'
2. select the 'local' repository in project properties 'task repository'
3.
Window > Preferences > Maven > User Settings as shown below:
4. check the repository is used and rebuild indexWindows->Show View->Other
In the pop-up:
Maven->Maven Repositories
Once the view is displayed, right click on the appropriate repo, and select "Rebuild Index"
"Missing artifact javax.jms:jms:jar:1.1"
This needs jboss repository even though it is our local repository.
See URL - http://stackoverflow.com/questions/3622773/java-net-maven-repo-jms-artifact-missing
"Maven Dependency Library is not including the desired version."
Need to use 'exclusions' in POM to stop the transitive dependencies. See below.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>app</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
The wildcard on both groupId and artifactId exclude all dependencies
that normally would propagate through to the module using this
dependency.
This wildcard expression only works for Maven 3.3 and later.
"Jersey-spring 1.19 dependency problem."
The Jersy-spring POM had dependencies on spring-core, spring-context, etc., which have version limitation up to 3.0.0. So Jersey-spring always includes those 3.0.0.RC3 version. Need to exclude those inside this dependency block.
"Spring framework 3.2.4 can work with Hibernate 3 or Hibernate 4"
Watch out the diferent path names form 3 or 4 in the POM of bean spec.
"In hibernate.xml file"
"Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.2.xsd). For more information, right click on the
message in the Problems View and select "Show Details..."
If use
"In applicationContext-services.xml"
Change all http://www.springframework.org/schema/*3.2.xsd to 3.1.xsd to remove beans-3.2.xml error.
"No Spring WebApplicationInitializer types detected on classpath"
Two sets of solutions -
1.
That has nothing to do with spring . It is something specified in the servlet 3.0 spec. As I stated it tells the container (in this case Tomcat 7) to not scan for classes implementing ServletContainerInitializer (which is something new in the servlet 3.0 spec it allows you to write a web app without providing a web.xml and use a class implementing that interface to register your servlets etc. Spring provides a wrapper with the SpringServletContainerInitializer which in turn scans for the WebApplicationInitializer interface. So basically your full class path is now scanned twice which in case of a large class path can be killing for your startup time).
2.
Two
slf4j.jar (log4j jars) are included in the project POM. Commented out one of them and problem solved.
If not, do the following:
There are couple of solutions to this:
- Make sure that you include only one slf4j jar(probably with the higher version) if you have couple of them with different versions on your class path.
- Sometimes it may not be possible to exclude multiple slf4j jars, as they may be used by other jars internally, which are on your class path. These dependent jar may refer to different versions of slf4j jars which causes your application to fail. In such cases, make sure that you have the jar with higher version of SLF4j added before other jar using SLF4J jars. This will make sure that your java program will pick up the latest version of the SLF4J which obviously is backward compatible.
|
|
|
"IncompatibleClassChangeError: class ClassMetadataReadingVisitor has interface ClassVisitor as super class"
This error happens when the loaded class i.e. ClassMetadataReadingVisitor
does not respect the contract of inherited abstract class or interface i.e. ClassVisitor
.
Looks like at load time different versions of the above classes are getting loaded in your case.
Seems you have new spring-core jar and old spring-asm jar in your application. ClassMetadataReadingVisitor
class is getting loaded from spring-core and ClassVisitor
from spring-asm.
Please check using maven
dependency:tree
command to see the dependent jars.
Cannot change version of project facet Dynamic Web Module to 3.0.
Another way is to edit the project facet configuration file itself: org.eclipse.wst.common.project.facet.core.xml
Change the dynamic web module version in this line to 3.0 - <installed facet="jst.web" version="2.5"/>
And then:
- Right-click on the project (in the Project Explorer panel).
- Select Maven » Update Project (or press Alt+F5)
You'll find this file in the .settings
directory within the Eclipse project.
Eclipse won't respond to Restful URL with glassfish.jersey jax-rs 2.0
The problem came from the project properties settings - namely the "Java EE Integration" under Maven.
Solution - Open up this property page, uncheck the "Enable Project Specific Settings."
- Click on the "Configure Workspace Settings"
- Check four items "Enable Java EE Integration", "Maven Archiver gen...", "JAX-RS Configurator", and "JPA Configurator".
This turns on the web services URL processing.