OpenIdentityPlatform / OpenAM-JEE-Agents

OpenAM Java EE Policy Agents is an OpenAM add-on component that functions as a Policy Enforcement Point (PEP) for applications deployed on a Java EE-based servlet container or application server. The policy agent protects web-based applications and implements single sign-on (SSO) capabilities for the applications deployed in the container.
Other
6 stars 13 forks source link

Missing com.sun.identity.install.tools.launch.AdminToolLauncher #3

Closed ghost closed 5 years ago

ghost commented 5 years ago

I tried running agentadmin --install and the I received the following error: image

vharseko commented 5 years ago

JDK version ?

На 6 мар. 2019 г., 11:43, в 11:43, Choo Chen Wei notifications@github.com написал:п>I tried running agentadmin --install and the I received the following

error: image

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/OpenIdentityPlatform/OpenAM-JEE-Agents/issues/3

ghost commented 5 years ago

JDK 1.8 image

vharseko commented 5 years ago

java --version?

На 6 мар. 2019 г., 11:57, в 11:57, Choo Chen Wei notifications@github.com написал:п>JDK 1.8

image

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/OpenIdentityPlatform/OpenAM-JEE-Agents/issues/3#issuecomment-470023861

ghost commented 5 years ago

image

spetix commented 5 years ago

I've branched master and i have a fix available for this. I'm performing a pull request soon

vharseko commented 5 years ago

@spetix thanks for https://github.com/OpenIdentityPlatform/OpenAM-JEE-Agents/pull/4

ghost commented 5 years ago

In agentadmin.bat - There is a typo for AGENT_CLASSPATH, change: openam-installtools-launcher-14.1.17-SNAPSHOT to openam-installtools-14.1.17-SNAPSHOT.jar.

There is now a new problem. MissingResourceException: image

spetix commented 5 years ago

I fixed linux launcher only that's why. I'm gonna change windows one as well

spetix commented 5 years ago

latest change may be fixing osx but breaks linux if JAVA_HOME is not set.

i'd rather try to fill JAVA_VM with which java given that 'which' exists both on linux and macosx.. ..another option is to distinguish among os type using OS_TYPE environment variable

vharseko commented 5 years ago

please provide export out

vharseko commented 5 years ago

linux will work

spetix commented 5 years ago

but this forces user to have ${JAVA_HOME} present as prerequisite.. while all it's needed is position of java executable that can be in path (and 'which java' finds it) I'm proposing this instead:

if [ -z "$AGENT_HOME" ]; then
    AGENT_HOME=`dirname $0`/..
fi

OS_TYPE=`uname -s | tr '[a-z]' '[A-Z]'`

if [ "$OS_TYPE" = "AIX" ]; then
  # aix
    AGENT_OPTS="-DamKeyGenDescriptor.provider=IBMJCE -DamCryptoDescriptor.provider=IBMJCE -DamRandomGenProvider=IBMJCE"
  if [[ -z "$JAVA_HOME" ]] ; then
    JAVA_VM=${JAVA_HOME}/bin/java
  else
    JAVA_VM=`which java`
  fi
elif [[ "$OS_TYPE" = "LINUX" ]] ; then
  # linux
  AGENT_OPTS=
  if [[ -z "$JAVA_HOME" ]] ; then
    JAVA_VM=${JAVA_HOME}/bin/java
  else
    JAVA_VM=`which java`
  fi
else
  # osx
  AGENT_OPTS=  
  if [[ -z "$JAVA_HOME" ]] ; then
    JAVA_VM=${JAVA_HOME}/bin/java
  else
    JAVA_VM=java
  fi
fi
vharseko commented 5 years ago

will work

if [[ -z "$JAVA_HOME/bin/java" ]] ; then
    JAVA_VM=${JAVA_HOME}/bin/java
  else
    JAVA_VM=java
  fi

if exists file "$JAVA_HOME/bin/java" then run ${JAVA_HOME}/bin/java else run java from PATH

spetix commented 5 years ago

Thats' what i was thinking too looking at the code but:

[root@test-agent ~]# /home/tomcat/tomcat_v6_agent/bin/agentadmin /home/tomcat/tomcat_v6_agent/bin/agentadmin: line 54: /bin/java: No such file or directory

[root@test-agent ~]# cat /home/tomcat/tomcat_v6_agent/bin/agentadmin

#!/bin/sh

#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
#
# The contents of this file are subject to the terms
# of the Common Development and Distribution License
# (the License). You may not use this file except in
# compliance with the License.
#
# You can obtain a copy of the License at
# https://opensso.dev.java.net/public/CDDLv1.0.html or
# opensso/legal/CDDLv1.0.txt
# See the License for the specific language governing
# permission and limitations under the License.
#
# When distributing Covered Code, include this CDDL
# Header Notice in each file and include the License file
# at opensso/legal/CDDLv1.0.txt.
# If applicable, add the following below the CDDL Header,
# with the fields enclosed by brackets [] replaced by
# your own identifying information:
# "Portions Copyrighted [year] [name of copyright owner]"
#
# $Id: agentadmin,v 1.5 2009/04/07 17:19:09 leiming Exp $
#
#

# Portions Copyrighted 2010-2013 ForgeRock AS.

if [ -z "$AGENT_HOME" ]; then
    AGENT_HOME=`dirname $0`/..
fi

if [ -z "$JAVA_HOME/bin/java" ]; then
    JAVA_VM=java
else
    JAVA_VM=${JAVA_HOME}/bin/java
fi

OS_TYPE=`uname -s | tr '[a-z]' '[A-Z]'`

if [ "$OS_TYPE" = "AIX" ]; then
    AGENT_OPTS="-DamKeyGenDescriptor.provider=IBMJCE -DamCryptoDescriptor.provider=IBMJCE -DamRandomGenProvider=IBMJCE"
else

    AGENT_OPTS=
fi

AGENT_CLASSPATH=${AGENT_HOME}/lib/openam-installtools-launcher-14.2.2-SNAPSHOT.jar:${AGENT_HOME}/lib/commons-io-1.4.jar

$JAVA_VM -classpath "$AGENT_CLASSPATH"  $AGENT_OPTS com.sun.identity.install.tools.launch.AdminToolLauncher $*
vharseko commented 5 years ago

please provide output

export ; whereis java; ls  ${JAVA_HOME}
spetix commented 5 years ago

Sure:

[root@test-agent empty_folder]# export ; whereis java; ls  ${JAVA_HOME}
declare -x CVS_RSH="ssh"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTCONTROL="ignoredups"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="test-agent"
declare -x LANG="en_US.utf8"
declare -x LESSOPEN="||/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lz=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.bz=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.rar=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:"
declare -x MAIL="/var/spool/mail/root"
declare -x OLDPWD="/root"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
declare -x PWD="/root/empty_folder"
declare -x SELINUX_LEVEL_REQUESTED=""
declare -x SELINUX_ROLE_REQUESTED=""
declare -x SELINUX_USE_CURRENT_RANGE=""
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_CLIENT="172.20.52.51 56706 22"
declare -x SSH_CONNECTION="172.20.52.51 56706 192.168.0.8 22"
declare -x SSH_TTY="/dev/pts/1"
declare -x TERM="xterm-256color"
declare -x USER="root"
declare -x XMODIFIERS="@im=none"
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz

maybe you meant this in bash:

if [[ ! -f "$JAVA_HOME/bin/java" ]]; then
    JAVA_VM=java
else
    JAVA_VM=${JAVA_HOME}/bin/java
fi