f



compile fail as regular user but ok as root on linux

I compile my java programs with tomcat & axis successfully as root on
linux.
I setup myself with sudo privilege but compiling them as regular (non-
root) user fail.

$ set |grep HOME
ANT_HOME=/usr/local/ant/apache-ant-1.7.1
AXIS2_HOME=/opt/axis2-1.1.1
CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
HOME=/home/powah
JAVA_HOME=/home/powah/jdk1.6.0_06


# visudo
....
powah ALL= /usr/src/redhat/, /bin/touch, /bin/mv, /bin/rm, /usr/bin/
perl makeMY.pl

$ sudo perl makeMY.pl

....
/usr/tomcat/bin/tomcat-native-1.1.8-src/jni/native/include -I/home/
powah/jdk1.6.0_06/include -I/home/powah/jdk1.6.0_06/include/linux  -I/
usr/local/apr/include/apr-1   -o os/unix/system.lo -c os/unix/system.c
&& touch os/unix/system.lo
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=link  gcc -g -
O2 -pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -
D_LARGEFILE64_SOURCE   -g -O2 -DHAVE_OPENSSL   -I/usr/tomcat/bin/
tomcat-native-1.1.8-src/jni/native/include -I/home/powah/jdk1.6.0_06/
include -I/home/powah/jdk1.6.0_06/include/linux  -I/usr/local/apr/
include/apr-1   -version-info 1:8:1    -o libtcnative-1.la -rpath /usr/
local/apr/lib src/multicast.lo src/os.lo src/info.lo src/address.lo
src/poll.lo src/pool.lo src/misc.lo src/error.lo src/shm.lo src/
proc.lo src/mmap.lo src/network.lo src/sslcontext.lo src/dir.lo src/
user.lo src/sslnetwork.lo src/sslutils.lo src/thread.lo src/ssl.lo src/
file.lo src/sslinfo.lo src/stdlib.lo src/lock.lo src/jnilib.lo os/unix/
uxpipe.lo os/unix/system.lo   /usr/local/apr/lib/libapr-1.la -luuid -
lrt -lcrypt  -lpthread -ldl -lssl -lcrypto
make[1]: Leaving directory `/usr/tomcat/bin/tomcat-native-1.1.8-src/
jni/native'
make[1]: Entering directory `/usr/tomcat/bin/tomcat-native-1.1.8-src/
jni/native'
make[1]: Nothing to be done for `local-all'.
make[1]: Leaving directory `/usr/tomcat/bin/tomcat-native-1.1.8-src/
jni/native'
/usr/local/apr/build-1/mkdir.sh /usr/local/apr/include/apr-1 /usr/
local/apr/lib/pkgconfig \
                     /usr/local/apr/lib /usr/local/apr/bin
/usr/bin/install -c -m 644 tcnative.pc /usr/local/apr/lib/pkgconfig/
tcnative-1.pc
list=''; for i in $list; do \
                ( cd $i ; make DESTDIR= install ); \
        done
/bin/sh /usr/local/apr/build-1/libtool --mode=install /usr/bin/install
-c -m 755 libtcnative-1.la /usr/local/apr/lib
/usr/bin/install -c -m 755 .libs/libtcnative-1.so.0.1.8 /usr/local/apr/
lib/libtcnative-1.so.0.1.8
(cd /usr/local/apr/lib && { ln -s -f libtcnative-1.so.0.1.8
libtcnative-1.so.0 || { rm -f libtcnative-1.so.0 && ln -s
libtcnative-1.so.0.1.8 libtcnative-1.so.0; }; })
(cd /usr/local/apr/lib && { ln -s -f libtcnative-1.so.0.1.8
libtcnative-1.so || { rm -f libtcnative-1.so && ln -s libtcnative-1.so.
0.1.8 libtcnative-1.so; }; })
/usr/bin/install -c -m 755 .libs/libtcnative-1.lai /usr/local/apr/lib/
libtcnative-1.la
/usr/bin/install -c -m 755 .libs/libtcnative-1.a /usr/local/apr/lib/
libtcnative-1.a
ranlib /usr/local/apr/lib/libtcnative-1.a
chmod 644 /usr/local/apr/lib/libtcnative-1.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/apr/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apr/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Buildfile: build.xml

init:

pre.compile.test:

BUILD FAILED
/home/powah/myproj_1.1rose/myproj_src/myCrypto/build.xml:30: /home/
powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.

Total time: 0 seconds
Building the MyCryptoService failed!  Return Code: 256 at makeMY.pl
line 362.



makeMY.pl line 362 is:
system("ant") == 0
    or die "Building the XmCryptoService failed!  Return Code: $?";

build.xml is:
<project basedir="." default="jar.server">
<!--Auto generated ant build file-->
<property environment="env"/>
<property name="axis2.home" value="${env.AXIS2_HOME}"/>
<property name="project.base.dir" value="."/>
<property name="maven.class.path" value=""/>
<property name="name" value="XmCryptoService"/>
<property name="src" value="${project.base.dir}/src"/>
<property name="test" value="${project.base.dir}/test"/>
<property name="build" value="${project.base.dir}/build"/>
<property name="classes" value="${build}/classes"/>
<property name="lib" value="${build}/lib"/>
<property name="resources" value="${project.base.dir}/resources"/>
<property name="jars.ok" value=""/>
<path id="axis2.class.path">
<pathelement path="${java.class.path}:${project.base.dir}/lib/
MycompJCASP.jar:${project.base.dir}/lib/MycompJCESP.jar:$
{project.base.dir}/lib/xmlsec-1.4.1.jar:${project.base.dir}/lib/
log4j-1.2.14.jar:${project.base.dir}/lib/bcprov-jdk16-139.jar"/>
<pathelement path="${maven.class.path}"/>
<fileset dir="${axis2.home}">
<include name="lib/*.jar"/>
</fileset>
</path>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${lib}"/>
<mkdir dir="${test}"/>
</target>
<target name="pre.compile.test" depends="init">
<!--Test the classpath for the availability of necesary classes-->
<available classname="javax.xml.stream.XMLStreamReader"
property="stax.available" classpathref="axis2.class.path"/>
<available classname="org.apache.axis2.engine.AxisEngine"
property="axis2.available" classpathref="axis2.class.path"/>
....


$ uname -a
Linux linuxpc 2.6.22.14-72.fc6 #1 SMP Wed Nov 21 15:12:59 EST 2007
i686 i686 i386 GNU/Linux
0
wong_powah (118)
4/13/2009 3:36:25 PM
comp.lang.java.programmer 52711 articles. 1 followers. Post Follow

11 Replies
469 Views

Similar Articles

[PageSpeed] 13

On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:

> I compile my java programs with tomcat & axis successfully as root on
> linux.
> I setup myself with sudo privilege but compiling them as regular (non-
> root) user fail.
>
Then your setup is borked by you or somebody else. A fresh Linux install 
doesn't have those problems and there's no reason why carefully 
installing Sun Java would cause them.

The only part of development you should need to do as root is installing 
jar libs for general use - and that should be doable with sudo.

Have you used scripts in /etc/profile.d to define your login environment, 
PATH variable, etc? Are they being exported? Did you test the steps as 
you set them up and fix the bits that were wrong?


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |
0
martin5229 (287)
4/13/2009 9:04:37 PM
On Apr 13, 5:04=A0pm, Martin Gregorie
<mar...@see.sig.for.address.invalid> wrote:
> On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
> > I compile my java programs with tomcat & axis successfully as root on
> > linux.
> > I setup myself with sudo privilege but compiling them as regular (non-
> > root) user fail.
>
> Then your setup is borked by you or somebody else. A fresh Linux install
> doesn't have those problems and there's no reason why carefully
> installing Sun Java would cause them.
>
> The only part of development you should need to do as root is installing
> jar libs for general use - and that should be doable with sudo.
>
> Have you used scripts in /etc/profile.d to define your login environment,
> PATH variable, etc? Are they being exported? Did you test the steps as
> you set them up and fix the bits that were wrong?
>
> --
> martin@ =A0 | Martin Gregorie
> gregorie. | Essex, UK
> org =A0 =A0 =A0 |

I define the environment variables in the /etc/profile file as
follows:
export JAVA_HOME=3D/home/powah/jdk1.6.0_06
export AXIS2_HOME=3D/opt/axis2-1.1.1
export ANT_HOME=3D/usr/local/ant/apache-ant-1.7.1
export CATALINA_HOME=3D/usr/local/apache-tomcat-6.0.13
0
wong_powah (118)
4/14/2009 2:30:54 PM
In article 
<e192ce00-012b-4cf4-83c8-d290129055ea@k38g2000yqh.googlegroups.com>,
 powah <wong_powah@yahoo.ca> wrote:

> On Apr 13, 5:04 pm, Martin Gregorie
> <mar...@see.sig.for.address.invalid> wrote:
> > On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
> > > I compile my java programs with tomcat & axis successfully as 
> > > root on linux. I setup myself with sudo privilege but compiling 
> > > them as regular (non- root) user fail.
> >
> > Then your setup is borked by you or somebody else. A fresh Linux 
> > install doesn't have those problems and there's no reason why 
> > carefully installing Sun Java would cause them.
> >
> > The only part of development you should need to do as root is 
> > installing jar libs for general use - and that should be doable 
> > with sudo.
> >
> > Have you used scripts in /etc/profile.d to define your login 
> > environment, PATH variable, etc? Are they being exported? Did you 
> > test the steps as you set them up and fix the bits that were wrong?
> 
> I define the environment variables in the /etc/profile file as 
> follows:
> export JAVA_HOME=/home/powah/jdk1.6.0_06
> export AXIS2_HOME=/opt/axis2-1.1.1
> export ANT_HOME=/usr/local/ant/apache-ant-1.7.1
> export CATALINA_HOME=/usr/local/apache-tomcat-6.0.13

This what they are supposed to be, but you might look for spurious, 
non-printing characters. Also, check directory permissions on /opt if 
you are writing to AXIS2_HOME.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
0
nospam59 (11089)
4/14/2009 2:48:05 PM
On Tue, 14 Apr 2009 07:30:54 -0700, powah wrote:

> On Apr 13, 5:04 pm, Martin Gregorie
> <mar...@see.sig.for.address.invalid> wrote:
>> On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
>> > I compile my java programs with tomcat & axis successfully as root on
>> > linux.
>> > I setup myself with sudo privilege but compiling them as regular
>> > (non- root) user fail.
>>
>> Then your setup is borked by you or somebody else. A fresh Linux
>> install doesn't have those problems and there's no reason why carefully
>> installing Sun Java would cause them.
>>
>> The only part of development you should need to do as root is
>> installing jar libs for general use - and that should be doable with
>> sudo.
>>
>> Have you used scripts in /etc/profile.d to define your login
>> environment, PATH variable, etc? Are they being exported? Did you test
>> the steps as you set them up and fix the bits that were wrong?
>>
>> --
>> martin@   | Martin Gregorie
>> gregorie. | Essex, UK
>> org       |
> 
> I define the environment variables in the /etc/profile file as follows:
> export JAVA_HOME=/home/powah/jdk1.6.0_06 export
> AXIS2_HOME=/opt/axis2-1.1.1
> export ANT_HOME=/usr/local/ant/apache-ant-1.7.1 export
> CATALINA_HOME=/usr/local/apache-tomcat-6.0.13
>
OK, so why don't they work? Are all the ownerships and permissions 
correct for the files you reference? 

Going back to basics, in a normal login:
- does env show them correctly?
- can you compile and run a 'Hello World' program?

If not, rince, wash and repeat until you can.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |
0
martin5229 (287)
4/14/2009 3:03:43 PM
On Apr 14, 10:48=A0am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <e192ce00-012b-4cf4-83c8-d29012905...@k38g2000yqh.googlegroups.com>,
>
>
>
>
>
> =A0powah <wong_po...@yahoo.ca> wrote:
> > On Apr 13, 5:04=A0pm, Martin Gregorie
> > <mar...@see.sig.for.address.invalid> wrote:
> > > On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
> > > > I compile my java programs with tomcat & axis successfully as
> > > > root on linux. I setup myself with sudo privilege but compiling
> > > > them as regular (non- root) user fail.
>
> > > Then your setup is borked by you or somebody else. A fresh Linux
> > > install doesn't have those problems and there's no reason why
> > > carefully installing Sun Java would cause them.
>
> > > The only part of development you should need to do as root is
> > > installing jar libs for general use - and that should be doable
> > > with sudo.
>
> > > Have you used scripts in /etc/profile.d to define your login
> > > environment, PATH variable, etc? Are they being exported? Did you
> > > test the steps as you set them up and fix the bits that were wrong?
>
> > I define the environment variables in the /etc/profile file as
> > follows:
> > export JAVA_HOME=3D/home/powah/jdk1.6.0_06
> > export AXIS2_HOME=3D/opt/axis2-1.1.1
> > export ANT_HOME=3D/usr/local/ant/apache-ant-1.7.1
> > export CATALINA_HOME=3D/usr/local/apache-tomcat-6.0.13
>
> This what they are supposed to be, but you might look for spurious,
> non-printing characters. Also, check directory permissions on /opt if
> you are writing to AXIS2_HOME.
>
> --
> John B. Matthews
> trashgod at gmail dot com
> <http://sites.google.com/site/drjohnbmatthews>

I added /opt/axis2-1.1.1 to sudo.
# visudo
powah ALL=3D /usr/src/redhat/, /opt/axis2-1.1.1, /bin/touch, /bin/mv, /
bin/rm, /usr/bin/, perl makeMY.pl

# ls -ld /opt/axis2-1.1.1
drwxr-xr-x 8 powah powah 4096 Sep  7  2007 /opt/axis2-1.1.1

# ls -l /opt/axis2-1.1.1
total 56
drwxr-xr-x  2 powah powah  4096 Jan  9  2007 bin
drwxr-xr-x  2 powah powah  4096 Jan  9  2007 conf
-rw-r--r--  1 powah powah  5524 Jan  9  2007 INSTALL.txt
drwxr-xr-x  2 powah powah  4096 Jan  9  2007 lib
-rw-r--r--  1 powah powah 11359 Jan  9  2007 LICENSE.txt
-rw-r--r--  1 powah powah   656 Jan  9  2007 NOTICE.txt
-rw-r--r--  1 powah powah  1460 Jan  9  2007 README.txt
-rw-r--r--  1 powah powah  3695 Jan  9  2007 release-notes.html
drwxr-xr-x  4 powah powah  4096 Jan  9  2007 repository
drwxr-xr-x 19 powah powah  4096 Jan  9  2007 samples
drwxr-xr-x  4 powah powah  4096 Jan  9  2007 webapp

Recompiling all still fail with the same /home/
powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.
0
wong_powah (118)
4/14/2009 5:22:57 PM
On Apr 14, 11:03=A0am, Martin Gregorie
<mar...@see.sig.for.address.invalid> wrote:
> On Tue, 14 Apr 2009 07:30:54 -0700, powah wrote:
> > On Apr 13, 5:04=A0pm, Martin Gregorie
> > <mar...@see.sig.for.address.invalid> wrote:
> >> On Mon, 13 Apr 2009 08:36:25 -0700, powah wrote:
> >> > I compile my java programs with tomcat & axis successfully as root o=
n
> >> > linux.
> >> > I setup myself with sudo privilege but compiling them as regular
> >> > (non- root) user fail.
>
> >> Then your setup is borked by you or somebody else. A fresh Linux
> >> install doesn't have those problems and there's no reason why carefull=
y
> >> installing Sun Java would cause them.
>
> >> The only part of development you should need to do as root is
> >> installing jar libs for general use - and that should be doable with
> >> sudo.
>
> >> Have you used scripts in /etc/profile.d to define your login
> >> environment, PATH variable, etc? Are they being exported? Did you test
> >> the steps as you set them up and fix the bits that were wrong?
>
> >> --
> >> martin@ =A0 | Martin Gregorie
> >> gregorie. | Essex, UK
> >> org =A0 =A0 =A0 |
>
> > I define the environment variables in the /etc/profile file as follows:
> > export JAVA_HOME=3D/home/powah/jdk1.6.0_06 export
> > AXIS2_HOME=3D/opt/axis2-1.1.1
> > export ANT_HOME=3D/usr/local/ant/apache-ant-1.7.1 export
> > CATALINA_HOME=3D/usr/local/apache-tomcat-6.0.13
>
> OK, so why don't they work? Are all the ownerships and permissions
> correct for the files you reference?
>
> Going back to basics, in a normal login:
> - does env show them correctly?
> - can you compile and run a 'Hello World' program?
>
> If not, rince, wash and repeat until you can.
>
> --
> martin@ =A0 | Martin Gregorie
> gregorie. | Essex, UK
> org =A0 =A0 =A0 |

me:
$ env |grep HOME
ANT_HOME=3D/usr/local/ant/apache-ant-1.7.1
AXIS2_HOME=3D/opt/axis2-1.1.1
CATALINA_HOME=3D/usr/local/apache-tomcat-6.0.13
HOME=3D/home/powah
JAVA_HOME=3D/home/powah/jdk1.6.0_06

root:
# env |grep HOME
ANT_HOME=3D/usr/local/ant/apache-ant-1.7.1
AXIS2_HOME=3D/opt/axis2-1.1.1
CATALINA_HOME=3D/usr/local/apache-tomcat-6.0.13
HOME=3D/root
JAVA_HOME=3D/home/powah/jdk1.6.0_06

The only difference is in $HOME (/home/powah vs /root).
I (non-root) can compile and run a 'Hello World' program.
I do not understand why I get this error:
/home/powah/myproj_1.1rose/myproj_src/myCrypto/build.xml:30: /home/
powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found
0
wong_powah (118)
4/14/2009 5:28:57 PM
In article 
<5e71d8a5-088d-4744-8f82-932c5d342105@r36g2000vbr.googlegroups.com>,
 powah <wong_powah@yahoo.ca> wrote:

> On Apr 14, 10:48 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> > In article
> > <e192ce00-012b-4cf4-83c8-d29012905...@k38g2000yqh.googlegroups.com>,
[...]
> > Also, check directory permissions on /opt if
> > you are writing to AXIS2_HOME.

[Please trim signatures lines when responding.]

> # ls -ld /opt/axis2-1.1.1
> drwxr-xr-x 8 powah powah 4096 Sep  7  2007 /opt/axis2-1.1.1
> 
> # ls -l /opt/axis2-1.1.1
> total 56
> drwxr-xr-x  2 powah powah  4096 Jan  9  2007 bin
> drwxr-xr-x  2 powah powah  4096 Jan  9  2007 conf
> -rw-r--r--  1 powah powah  5524 Jan  9  2007 INSTALL.txt
> drwxr-xr-x  2 powah powah  4096 Jan  9  2007 lib
> -rw-r--r--  1 powah powah 11359 Jan  9  2007 LICENSE.txt
> -rw-r--r--  1 powah powah   656 Jan  9  2007 NOTICE.txt
> -rw-r--r--  1 powah powah  1460 Jan  9  2007 README.txt
> -rw-r--r--  1 powah powah  3695 Jan  9  2007 release-notes.html
> drwxr-xr-x  4 powah powah  4096 Jan  9  2007 repository
> drwxr-xr-x 19 powah powah  4096 Jan  9  2007 samples
> drwxr-xr-x  4 powah powah  4096 Jan  9  2007 webapp
> 
> Recompiling all still fail with the same /home/
> powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.

Surely you have access to axis2-1.1.1 , but I don't see the ownership 
and permissions on the parent directory, /opt. Try 'ls -l /opt'.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
0
nospam59 (11089)
4/14/2009 5:30:39 PM
powah <wong_powah@yahoo.ca> wrote:
> [env says:] AXIS2_HOME=/opt/axis2-1.1.1
> I do not understand why I get this error:
> /home/powah/myproj_1.1rose/myproj_src/myCrypto/build.xml:30: /home/
> powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found

Even if the env-var got substituted, the complete path would then be 
  /home/powah/myproj_1.1rose/myproj_src/myCrypto//opt/axis2-1.1.1
Does this exist?  Why is the value of ${env.AXIS2_HOME} appended to 
that subdir rather than used itself?

PS: I haven't read the whole thread, so, sorry if I missed something.

0
avl1 (2748)
4/14/2009 7:35:23 PM
powah <wong_powah@yahoo.ca> wrote:
> me:
> $ env |grep HOME
> AXIS2_HOME=/opt/axis2-1.1.1
> ...

Ok, now I did reread this thread, and I wonder, why two things haven't 
yet been addressed:

 - what do the perl script and the build.xml look like around
      the line numbers indicated by the error messages?

 - could you add some code to the perl script to print out the 
      environment which it really sees?
      I don't know perl well enough, but I'd guess that
        system("env > /dev/tty");
      (before it starts ant build) should do it.

0
avl1 (2748)
4/14/2009 7:48:58 PM
On Tue, 14 Apr 2009 10:22:57 -0700, powah wrote:

> 
> Recompiling all still fail with the same /home/
> powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.
>
Was SELinux part of FC6? If so:

- what mode is it running in?
- If its running in Enforcing mode does disabling it and rebooting help?
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |
0
martin5229 (287)
4/14/2009 10:24:45 PM
On Apr 14, 6:24=A0pm, Martin Gregorie
<mar...@see.sig.for.address.invalid> wrote:
> On Tue, 14 Apr 2009 10:22:57 -0700, powah wrote:
>
> > Recompiling all still fail with the same /home/
> > powah/myproj_1.1rose/myproj_src/myCrypto/${env.AXIS2_HOME} not found.
>
> Was SELinux part of FC6? If so:
>
> - what mode is it running in?
> - If its running in Enforcing mode does disabling it and rebooting help?
>
No.  SELinux is not installed on FC6.
0
wong_powah (118)
4/15/2009 1:04:55 PM
Reply: