UnsatisfiedLinkError - Native Library - jnidispatch.dll - java

I have a problem using waffle and tomcat 7 to enable login via windows authentication.
Everything is working fine but everytime I deploy the application, I get this error:
java.lang.UnsatisfiedLinkError: Native Library C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\seedInventory\loader\com\sun\jna\win32-x86\jnidispatch.dll already loaded in another classloader
When I restart tomcat, it started working again. However, I want to be
able to deploy the application without restarting.
I see that this file jnidispatch.dll is still being used even after the undeploy and I can't delete it manually.
What could I do?

Take a look at Apache Tomcat HowTo section about classloader problems when using JNI under Tomcat. It says, that:
The important thing to know about using JNI under Tomcat is that one cannot place the native libraries OR their JNI interfaces under the WEB-INF/lib or WEB-INF/classes directories of a web application and expect to be able to reload the webapp without restarting the server.
So, it seems, that some of your libraries contains a native jnidispatch.dll lib, which you should move out of jar or war into Tomcat's lib folder, to make it possible to redeploy you application.

Related

Java native library path in Tomcat web project

I have a web project with some native libraries. Most of them are loaded by JNA library.
I put them in this folder
WEB-INF\classes\*.dll
of a ROOT package.
When the application starts they are loaded by Tomcat in
${catalina.home}\webapps\ROOT\WEB-INF\classes\mylibrary.dll
All libraries are founded by JNA and work, however there is just one library managed by third parties (Zebra Multilink platform SDK) that I cannot load from that folder. Maybe because it doesn't work with JNA but with JNI.
If I move that libraries to
${catalina.home}\bin
that is the folder defined by java.library.path param in tomcat start command it works!
Can I distribute libraries in ROOT.war package and set tomcat to look into all my applications to find native libraries?
Well, you can modify java.library.path and let it point to the exploded webapp directory (your ${catalina.home}\webapps\ROOT\WEB-INF\classes\, but resolve ${catalina.home} yourself beforehands).

Deploy a .rar on cloudfoundry using eclipse plugin

I am currently using the cloudfoundry eclipse plugin to deploy my JSP/Servlet web application. My application is now using a Db (Sqlite). However I am having problem deploying the sqlitejdbc.rar to cloudfoundry (all i do to update the application is right click on my application under VMware Cloud-foundry server and select update. But that doesn't seem to work and i get an exception saying that it cant find the rar file.
In my local system i simply paste the sqlitejdb.rar to the lib directory of Tomcat and when i run the webapp locally it works
If you place the sqlitejdbc.rar file into your lib directory (inside your WEB-INF directory) that should get deployed as part of your application into cloudfoundry and become accessible.
You can also try to deploy your app using vmc push to see what errors you get from vmc.
I also recommend looking at the log files on cloudfoundry.com

Tomcat6 refuses to recognize the classes in WEB-INF/classes folder

Instead of using a certain jar in my WEB-INF/lib folder, I want to use its source code (same directory structure and everything) in my WEB-INF/classes folder, so that I may be able to modify its classes more story.
Yet (re)starting my tomcat after deleting the original jar and uploading the corresponding directory into WEB-INF/classes gives me the following error:
SEVERE: Error configuring application listener of class no.something.something1.http.LifecycleListener
java.lang.ClassNotFoundException: no.something.something1.http.LifecycleListener
I am certain that the directory path is the same as the one inside the jar. Also, I have previously tried using classes in my WEB-INF folder for this web application, and tomcat has also been unable to load them, for some reason.
Does anyone know how I go about troubleshooting this error?
Tomcat can only load .class files, it doesn't know what to do with raw source code files. Tomcat doesn't do hot loading of .class files like that anyway. You would have to restart the application or server after you recompiled them either way, packaging them as a .war isn't that much of a burden either way once you automate it.
If you take the time to automate the build and deployment of a proper .war you can just rebuild the .war and it will automagically undeploy and redeploy the application itself, which is many times faster than restarting the entire server.
You can't do what you are trying to do the way you are trying to do it. Tools like JRebel address these issues, but I don't find them as useful as their marketing makes them sound.
You could use embedded tomcat (or embedded jetty) to map directory structure of the application as you like. It probably will require some tinkering if you need some JNDI resources within your application but still worth the trouble.
Here's an example

Web Services in Unix. What should be the directory structure

I earlier got to create a simple RESTful webservice on my localhost using Eclipse IDE, Tomcat, and JAX-RS libraries.
I am now trying to move the same on to a different unix server which has Tomcat installed. I am not knowing how to get started as in what is equivalent to creating a "Dynamic Web Project" that I do in Eclipse. Do I need to just create a directory myself with all the sub-directories as created by Eclipse? Should this directory be placed in webapps folder in Tomcat container. Should META-INF and WEB-INF also be created by myself?
Where should I put my Java classes?
Can somebody please clarify this or direct me to any documentation about the same.
You need to package your application in a WAR file.
The Sun Java EE 6 Tutorial has a chapter deciated to packaging.
It's pretty easy to export a web application as a war in Eclipse.
Dynamic Web Project (right click) => Export => Web =>war file =>war export dialog
Creation of web application archive - WAR is the solution for your problem,
but take care about all libraries that you need there.
You can easily extract (unzip) WAR file content
and check your project structure and libraries needed
and they will be in WAR's WEB-INF/lib.
Make sure that both Tomcats are set same way,
make sure your code is all OS friendly (users, file paths, permissions)
Always write some test simple code that will run up on app start,
and check all dependencies and libs, system clock, outside world network communication, so you can trace it in web app console or logger easily.
regards

Deploying java applications to Tomcat using CruiseControl.net

I have CruiseControl.net setup on a machine which is currenly being used for Microsoft Projects.
I needed to add a java project to the same build server.
The java war files generated need to be copied to another server under Tomcat.
However, I face a lot of problems when it tries to copy to that network location, due to file access denied messages, as certain jar files are being used.
I tried to remotely stop tomcat before attempting to copy the files but wasnt successful doing that.
There are Ant tasks that allow you to admin Tomcat using build.xml. Maybe those can help.

Categories

Resources