I'm trying to transfer the project to maven. I use the default directory structure, in pom I describe only dependencies. The project compiles successfully, but when I run on tomcat all the time I get the following actions and the listener does not start accordingly.

The context.xml settings for tomcat have not changed. And the code too. Before trying to transfer the application to maven, everything started and worked. Maybe for mavena need some kind of separate setting to work with jdbc? I tried to recreate the project and put my source code there - the result is the same.

  • one
    Well, of course .. an error message clearly indicates that there is no corresponding resource. How did you run your project before? How did you prescribe these resources? You do not expect them to appear in the web container with a holy spirit. - cy6erGn0m
  • You apparently lost a file (for example, mysqldb.xml or datatsource.xml) or a section of a configuration file (for example, web.xml) with a description of your database. google "datasource.xml tomcat" - jmu
  • @kisuxa, do not forget to accept the correct answer. - angry

1 answer 1

Maybe it's classloader'e maven'a and tomcat'a. The problem may occur due to the fact that when you start the dependency is loaded in a different order. I do not know how tomkat loads frying, maven loads them in the order in which they are listed in the list. The fact is that some kind of dependency can pull a dependency of a different version behind you than it is listed in the pom-file, and, accordingly, who first booted, that class will be used.

Although I can say from the spectra that you need to look at the place where the data is added to jndi. Apparently, you want to start Tomcat through the Mavin plugin, and earlier the server started separately, and somewhere in it was the config file for jndi. And when starting through the plugin, this config is not pulled up.

  • You were absolutely right. Tomkat just did not see the jndi config file. I’ve treated it by specifying the path to the resource: <build> <plugins> <plugin> <groupId> org.apache.maven.plugins </ groupId> <artifactId> maven-war-plugin </ artifactId> <version> 2.1.1 </ version> <configuration> <webResources> <resource> <directory> resource2 </ directory> </ resource> </ webResources> </ configuration> </ plugin> </ plugins> </ build> - trierra
  • Put a tick if the issue is resolved. - Gautama Buddha