Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to install a package, and it fails reporting a missing dependency:

# rpm -ivh *
error: Failed dependencies:
    jre >= 1.7.0 is needed by Tomcat-7.0.37-1.noarch

At the same time, when I check my java version, here is what I get:

# java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Server VM (build 24.0-b56, mixed mode)

Isn't it the java that the rpm wants? Am I missing something? Does the rpm see a different java and how can I check that?

share|improve this question
1  
Have you installed the JRE or JDK and Tomcat from your distributions repositories? –  bigdaveyl Oct 8 '13 at 14:26
add comment

1 Answer

up vote 3 down vote accepted

The package manager is just that - a manager for package information, it doesn't really know whats on your system, just what packages it installed and thus what it assumes is on your system.

The obvious problem with this design is that the two can become out of sync, say, if you installed JRE by hand by downloading it from oracle, then the package manager has no clue that its there and hence does its job of pointing out the failed dependancy chain.

There are multiple options, assuming this is the problem (check your rpm package list, i forget rpm's parameters) in order of uglyness: (1) You can install your distributions version of JRE, which will make the package manager happy, (2) You can fudge the package manager so it thinks said dependancy "jre version 1.7.0" is actually installed, with or without installing it, then subvert the java binaries to use your installed version, or (3) you can just install tomcat with the --nodeps option to ignore dependancies. Be aware (3) is a slippery slope and you'll end up skipping more dependancies and sub dependancies over time.

share|improve this answer
    
Thanks. However, I did install java using rpm, and i also tried rpm -rebuilddb and even rebooting the system as the last resort. –  Ibolit Oct 8 '13 at 14:35
    
Hmm, noting the tomcat is a noarch build I wonder if its dependancies are correctly configured for your distribution, specifically it looks for "jre" as its tag, but (say) your package system may call it "java". It'd be worth investigating what your java packages are providing (rpm -q -i or something like that?) and see if the 'jre' dependancy is actually being met, or how it works in your distro. At that point your options are to correct the RPM you're trying to install to take the right dependancies, fake an installation in the package DB, or just --nodeps it once again. Dirty + effective –  iain Oct 8 '13 at 15:27
    
To be clearer, when i say "its tag" i dont mean the package name, the full package info should tell you about its dependancies, both what it requires, and what it provides (and possibly some recommended/optional dependancies too), these can simply be other packages but are also often "virtual" packages, such that "IBM JDK" and "Oracle JDK" are different packages, but both provide "java-runtime" or whatever that other non implementation specific packages (e.g. any java app such as tomcat) can depend on. –  iain Oct 8 '13 at 15:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.