Tomcat 7 startup error: tcnative.dll is not valid - java

I use;
Windows 7 64 bit,
JAVA_HOME= JDK1.7 64 bit,
Tomcat-7 64 bit version
When I start tomcat from commandline it works ok, but when I use it within IntelliJ I get this error;
java.lang.UnsatisfiedLinkError: tcnative-1 (.\tcnative-1.dll is not a valid Win32 application.
I also point to an IBM 32bit JDK1.6 from IntelliJ in project settings, but this could not be a problem since this setup works on some other collegae's computers
I have read similar questions here, but none of them offers a solution for my case, any ideas, how can I fix this?

Here is a link which describes the problem :
Cause:
You get this message when you start Tomcat. Tomcat is looking for a shared object call tcnative (dll or so depending on the platform). If it doesn't find it, it'll revert to java libs. Either way, this shouldn't affect your application. tcnative dll is needed to address scalability in Tomcat.
Solution:
Turn down debugging level for Tomcat or
Get tcnative from http://tomcat.apache.org/native-doc/ (windows users can download the binary) and place it in your library path.
Lib path is usually: C:\Program Files\Apache Software Foundation{Apache Tomcat directory}\lib; for windows

Basically It seems that you may have an incorrect version.
Are you using multiple java on your machines if yes then try to look into environment variables for JAVA_HOME & PATH. Secondly, also paste the complete version of java and tomcat
Also run following commands at command prompt
java -version
javac -version
echo %JAVA_HOME%
And are you using MSI installer of tomcat or just a zip version of tomcat. Because in many cases MSI installer never work for some ghost reasons.

Related

How to resolve the "java.lang.UnsatisfiedLinkError" on Mac terminal?

I have a jar file 'myApp.jar' that I need to run through command line. When I run the jar on linux server it working perfect. However, when I tried to the same jar on mac terminal I am getting this error message:
Exception in thread "main" java.lang.UnsatisfiedLinkError: while loading kognac-core: Stream closed
at karmaresearch.vlog.VLog.loadLibrary(VLog.java:72)
at karmaresearch.vlog.VLog.<clinit>(VLog.java:22)
at org.semanticweb.rulewerk.reasoner.vlog.VLogReasoner.<init>(VLogReasoner.java:82)
at org.semanticweb.rulewerk.client.picocli.MyApp.someMethod(MyApp.java:150)
at org.semanticweb.rulewerk.client.picocli.MyApp.main(MyApp.java:110)
The command that I used to run the jar is:
java -jar myApp.java
The jar file is compiled and created by javaSE-1.8 through Eclipse on Mac.
The java version of Linux server is openjdk version "1.8.0_292"
The java versions on Mac are 3: Java SE 11.0.1(default version) , 1.8.0_202, 1.8.0_201 by these commands:
/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java -jar myApp.java
/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin/java -jar myApp.java
I tried to run the jar file on mac with all 3 java versions, but still getting the same error above.
How could I resolve this error on Mac terminal?
The problem isn't related to your app or how you run it.
Your app uses the karmaresearch project which I'm not familiar with (possibly, that's your own code, that you / your team wrote?) and this code attempts to load a so-called native library: These are libraries compiled straight for the OS/architecture your JVM is running on top of.
These take the form of a .jnilib file on mac, .dll on windows, and .so on linux and other posix-based OSes.
Native libraries are incredibly convoluted to ship: You need 1 such file for each combination of OS and underlying architecture. So, these days, you'd need at a minimum to make a reasonable claim that you're 'portable':
Mac AAarch64
Mac x84
Windows x64
Linux AArch64
Linux x64
Linux x32
BSD x64
and that's just a bare bones minimum.
These files cannot be inside the jar when you load them. The usual procedure is to obtain a location you can write to and load code out of (tricky), unpack the right file for the host OS to this folder, and then loadLibrary it. This is all very complicated. In general, either [A] you wrote karmaresearch and you need to think long and hard about using native libraries first, and if you truly need it, follow a tutorial, or [B] it's not your code, in which case you can't run this on a mac, at all, and there's nothing you can do about that, other than contact the makers of this library and ask them to add support for this.

Tomcat10 cannot start bootstrap.jar not found

I compiled a Servlet with java 15 and tried to run it with Tomcat 10 but got the error:
"java.lang.UnsupportedClassVersionError: Servlet1 has been compiled by a more recent version of the Java Runtime"
Looking at the Tomcat Properties I noticed Tomcat uses Java 8 that is installed also on my PC.
So I went to the Tomcat Properties under the Java tab and put down jdk-15.0.1\bin\jvm.dll
-> Tomcat didn't start anymore.
I noticed that in the same properties under the Java tab, there is "Java Classpath" but it's value was
Tomcat-Dir\bin\bootstrap.jar (I think). Then I changed this to jdk-15.0.1\bin (and variations thereof).
Now to my problem - Tomcat doesn't start anymore "ClassNotFoundException ... Bootstrap" I can change back the path to the JVM by checking "Use default", but I don't remember exactly the path under "Java Classpath". Can someone tell me what the default value needs to be here for Tomcat10. I would like to at least be able to start Tomcat again.
I'm talking about this Tab in the Tomcat properties
The problem you are describing (immediate service start failure, nothing in Tomcat's logs and a short line in commons-daemon.log) happens when there is a mismatch between the architecture of the Procrun service application (installed as bin\tomcat10.exe in your Tomcat installation) and the architecture of the jvm.dll: a 32-bit executable cannot load a 64-bit library and viceversa.
You can confirm it with tomcat10.exe version (works only in an administrator cmd)) and java -version.
To solve this you need to download the complete Apache Commons Daemon distribution for Windows (cf. download area) and replace tomcat10.exe with the appropriate prunsrv.exe executable (there are two versions in the zip archive).
Regarding which libraries should be in Tomcat's classpath, you just need bin\bootstrap.jar and bin\tomcat-juli.jar in your server's installation folder.
Remark: The Windows MSI installer for Tomcat contains both prunsrv.exe versions, but installs only one depending on the architecture of the Java executable you choose during installation. Probably you have a 32-bit Java 8 and 64-bit Java 15. For a long time the java.com page automatically proposed the 32-bit version of Java.

Yomu and Heroku

I just installed the 'yomu' gem (https://github.com/Erol/yomu) in my application and deployed to heroku. On my local machine (Mac OS) it runs fine. I noticed in the documentation it states that JRE is required for it to work.
When I run the application on Heroku I get the following error:
Errno::ENOENT (No such file or directory - java -Djava.awt.headless=true -jar /app/.bundle/gems/ruby/1.9.1/gems/yomu-0.1.1/jar/tika-app-1.1.jar -t):
I'm assuming that yomu can't find the java compiler on Heroku. Am I reading this right? If I am, is there an add-on that I'm not considering?
By the way, the reason I'm using yomu is because it can extract text from doc and docx files.
Thanks!
If you're running on the Cedar stack then a JDK is available to you at: /usr/lib/jvm/java-6-openjdk
I'm not sure how Yomu finds your Java install, but it's probably looking in JAVA_HOME. If so then setting JAVA_HOME on Heroku should make it work:
heroku config:add JAVA_HOME=/usr/lib/jvm/java-6-openjdk
Not a java compiler - a java runtime (a JRE, like the documentation said). Installing a JRE as an addon is not (yet?) supported on Heroku.
In the new Heroku-16 stack, you can add jvm as a buildpack and you don't need to configure paths or anything else. Just make sure to have it set as your first buildpack. I tried it with Yomu/Henkei and it worked for me.

Finding the JRE on Windows

I know this question is going to sound very stupid but here goes nonetheless. I need to bundle the new version of the JRE with my applicaiton and I cannot find either a version of the JRE that is not in .exe nor can I find where the jre is installed to on Windows 7 (windows 7 search cannot find anything so it is not helpful). Can anyone tell me where I can download a version of the JRE the would be good to bundle or where I can find the path that windows installed the JRE too?
Not sure about Windows 7 but on Windows XP the installation defaults to C:\Program Files\Java\jre6
corsiKa is correct about Windows 7
I found that the file path for jre is
C:\Program Files (x86)\Java\jre7
For my purposes I needed to install the Connector/J JDBC driver in the ext directory.
jre7\lib\ext\
Alternatively, install a JDK, if you haven't done it yet, and take the jre folder in its installation directory.
The JDK can also install it in Program Files (64-bit on 64-bit Windows, always on 32-bit Windows) or Program Files (x86) (32-bit on 64-bit Windows) as explained above.
It also installs java.exe, javaw.exe and javaws.exe in C:\Windows\system32
It will be the last installed version...
I have found another, more generic solution that I'm using in Powershell. The problem is that Java is now using symlinks to java, javaw and javac, so you can't always rely on using "where.exe java" because it returns the symlink.
I now rely on Java to report where it's actually running from by using verbose mode and parsing the output.
$javapath=((java -verbose -version | ? {$_ -match "Opened" }).replace("[Opened ","")).replace("\lib\rt.jar]","")
It will find the path that java reports it's actually using and return the installation directory. The only problem I haven't quite resolved is that it outputs extra information because of the "-version" option, but the only other option is the help, which is worse. However, when run from a script, the console output can simply be ignored. If someone else has a way of keeping it quiet, I'd like to hear it.

Trying to run ant - getting error

I have just installed ant and JDK 6 and am trying to run an ant task. I get the following:
C:\Users\Giles Roadnight\workspace\Parsley\build>ant compile_spicelib_complete_flex
Buildfile: build.xml
compile_spicelib_complete_flex:
[exec] Error loading: C:\Program Files\Java\jdk1.6.0_17\jre\bin\server\jvm.dll
[exec] Result: 6
BUILD SUCCESSFUL
Total time: 0 seconds
C:\Users\Giles Roadnight\workspace\Parsley\build>
That file - jvm.dll is definitely there. I have tried running as an administrator with the same result.
To install I ran the JDK installer (I already had a JRE installed), I set up JAVA_HOME in my environment variables.
I unzipped ant and added my ant bin directory to my PATH.
I am clueless about Java and how it all works so am a bit lost with this.
I am on 64 bit windows 7. I downloaded a 64 bit JDK.
Any help much appreciated.
you must have Unzipped your flex to some folder. I am referring to this folder as flex_sdk.
Add flex_sdk to the FLEX_HOME environment variable (creating the environment variable if necessary).
Flex compiler needs a 32 bit JRE since there is currently no support for 64 bit JRE. For this, first download a 32 bit(or X86) version of jdk and later have the flex sdk point to it.To do so, you'll need to edit the jvm.config file located in FLEX_HOME\bin. Within jvm.config, set java.home to the location of your 32 bit JDK as shown.(Note that these are not backslashes)
Example: java.home=C:/Program Files (x86)/Java/jdk1.6.0_25 Alternatively, you can also add an environment variable with the name JAVA_HOME and have it point to the above location if you are not able to find the jvm.config file.
/I had the same problem and researched on this for a couple of days. Tried 100s of classpaths and loads of corrupted registry issues. The above solution seemed to work for me. Let me know if it works for you as well/
-Prasad K
It looks to me as if the ant script is running a native program which in turn tries to load the JVM to run some java code, and fails. I would guess that there is a mismatch between 32-bit and 64-bit-ness. The package you are trying to run is, in this theory, using a 32-bit Windows executable which is failing to LoadLibrary the 64-bit JVM DLL.
A simpler possible explanation is that many things in the Java universe get befuddled by spaces on pathnames. Try installing the JDK in a pathname with no embedded spaces.
You can solve this by creating a bat file in the flex-sdk bin directory with the following:
"%JAVA_HOME%\bin\java.exe" -Xmx384m -Dsun.io.useCanonCaches=false -jar "%~dp0\..\lib\mxmlc.jar" +flexlib="%~dp0\..\frameworks" %*
Then invoke this bat file instead of mxmlc.exe
Note: solution found at https://web.archive.org/web/20120327204229/http://sray.squidpower.com/2010/01/13/solution-to-error-running-mxmlcexe-with-windows-64bit-jvm/
The first part that surprises me is that it tries to use the server JVM instead of the regular one, but that might be a feature of your build. The second thing I'd try is to run ant -v instead of plain ant. This should give you a lot more output and hopefully more information as to what ant is trying to do at this point in time.

Categories