I solved this problem! I had made a simple mistake of not making sure the correct dependencies were downloaded in Maven. The required jars for WrapperManager and WrapperListener were not available which were causing the errors.
Answer from G.One on Stack OverflowThe error about the native library is because the wrapper.dll is version 3.4.0 which the version of the Wrapper.exe and wrapper.jar are 3.5.15. Please be sure to use the same version.
The main problem you are seeing is with the launching of the application. The error is saying that the WrapperSimpleApp class's main method is not receiving the correct arguments.
Looking at your configuration file, the first argument is: wrapper.app.parameter.1=esq.logreader.DbTestDriver
This looks correct. But the command line looks like this: ..bin\esq.logreader.DbTestDriver
Are you sure that the wrapper.conf file you posted is the same as the one used to create the wrapper.log file? From the log output, it looks like the following setting was being used: wrapper.app.parameter.1=..bin\esq.logreader.DbTestDriver
Cheers, Leif
I encountered a similar error. For me the solution was making sure the matching wrapper.dll version was located in the search paths defined by the "wrapper.java.library.path." property entries [1] in the wrapper.conf file
1 - https://wrapper.tanukisoftware.com/doc/english/prop-java-library-path-n.html.
java - Error: Wrapper cannot find servlet class VendorRegistration or a class it depends on - Stack Overflow
Java Wrapper Class not found - Stack Overflow
java - Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain - Stack Overflow
What is exception wrapping in Java? - Stack Overflow
The servlet or one of its dependencies is missing in the classpath.
First of all, always put Java classes in a package, also servlets. Packageless classes are invisible to classes in a normal package. For servlets, this works in specific environments only. You don't want to be dependent on that.
package com.example;
public class VendorRegistration extends HttpServlet {
// ...
}
With this package, the compiled .class file must end up in /WEB-INF/classes/com/example/VendorRegistration.class. Don't forget to alter the associated <servlet-class> entry in web.xml accordingly.
<servlet>
<servlet-name>VendorRegistration</servlet-name>
<servlet-class>com.example.VendorRegistration</servlet-class>
</servlet>
If that doesn't help, then you should put the classes or JAR files containing the (in)direct classes which are specified in any of the servlet's import statements also in /WEB-INF/classes (for .class files) or /WEB-INF/lib (for JAR files). The root cause in the exception stacktrace should tell which class exactly it is. Just read the stacktrace.
See also:
- Servlets info page - contains a Hello World and several useful links
From tomcat 6.0 onwards, there is change in <url-pattern>
<servlet>
<servlet-name>VendorRegistration</servlet-name>
<servlet-name>VendorRegistration</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>VendorRegistration</servlet-name>
<url-pattern>/servlets/servlet/VendorRegistration</url-pattern>
</servlet-mapping>
It worked in my case!
Phil's answer is correct.
And here is how to create .mvn directory with needed jar inside.
I found the answer here
(https://www.baeldung.com/maven-wrapper)
If you have maven and you want to make maven wrapper working, you need to setup maven wrapper:
mvn -N io.takari:maven:wrapper
It should create .mvn directory and put needed jar in it.
You're missing the .mvn folder in your git repository. You should have a folder called .mvn which contains the files wrapper/maven-wrapper.jar, wrapper/maven-wrapper.properties and jvm.config. Perhaps you missed it because it's a hidden folder.
Try doing git add -f .mvn from the command line then commit and push.
Exception wrappingis when you catch an exception, wrap it in a different exception and throw that exception.Here is an example:
try{ dao.readPerson(); } catch (SQLException sqlException) { throw new MyException("error text", sqlException); }
Source: http://tutorials.jenkov.com/java-exception-handling/exception-wrapping.html
On the Other Hand
Exception Propagation: An exception is first thrown from the top of the stack and if it is not caught, it drops down the call stack to the previous method, if not caught there, the exception again drops down to the previous method, and so on until they are caught or until they reach the very bottom of the call stack.
Source: http://www.javatpoint.com/exception-propagation
I think Neeraj's answer is spot on. To add on to it, I think one particularly good case is to manage the number of exceptions thrown by abstracting exceptions. To expand on Neeraj's example:
class Manager {
public void sendPerson() throws ManagerException {
try{
Person person = dao.readPerson();
Socket socket = getSocket();
OutputStream os = socket.getOutputStream();
String personJson = objectMapper.writeValueAs(person);
os.write(personJson);
} catch (SQLException | SocketException | OutputStreamException | SerializationException e) {
throw new ManagerException("error text", e);
}
}
}
This way, the client only needs to do the following:
try {
manager.sendPerson();
} catch (ManagerException e) {
// Handle fail by manager
}
instead of worrying about the fine-grained details of what may have gone wrong in the manager.
since there is also no output of the JVM from the Wrapper's initialization, I suppose there is sth wrong with your wrapper.java.command...
can you please enable debug mode by setting wrapper.debug=true in your conf file? you should see the command line of the JVM the Wrapper is trying to execute.
If you don't see any problem in both places, please post the output and let me have a look at it...
cheers,
Your application is throwing some exception while starting up. You need to find a log of what's being thrown, or else set an catch-all exception handler for the program to print a log. You do that by having your main find out its thread group, and then setting a ThreadGroup uncaught exception handler for it.