for example

in the docker shell

root@apis-rc-y7pox:/# echo $AUTH_SQL_URL
jdbc:oracle:thin:@bbdd:1521/sid

but on java when i recover that value is empty so  i get a null pointer 
exception.


> El 12 sept 2016, a las 12:04, Julio Saura <jsa...@hiberus.com> escribió:
> 
> hello, no i don’t use official jboss images..
> 
> i use a custom image build by me ..
> 
> on my dockerfile there is nothing related to env variables ..  is on my entry 
> point script where i read em and do some substitutions in jboss config files 
> before launching jboss process  .. that part works ok
> 
> but after that reading them from our java app does not work , their value is 
> null, .. and starting that same docker image in a docker standalone engine , 
> and passing the same variables, works ok ..
> 
> my docker file is simple
> 
> FROM debian
> 
> RUN apt-get update -y
> RUN apt-get install -y vim
> RUN apt-get install -y sudo
> USER root
> COPY jboss.tar.gz / ( custom jboss tar.gz )
> COPY jboss-as.conf /etc/init.d
> COPY jboss-as /etc/init.d
> RUN useradd -ms /bin/bash jbossadmin
> RUN chmod +x /etc/init.d/jboss-as && chown jbossadmin: /etc/init.d/jboss-as
> RUN cd / && tar xvfz jboss.tar.gz && rm jboss.tar.gz && chown -R jbossadmin: 
> /opt
> RUN /opt/jboss/jboss-as/bin/add-user.sh admin Developer#2015 --silent
> 
> EXPOSE 8080 
> 
> ENTRYPOINT ["/etc/init.d/jboss-as", "start”]
> 
> 
> and in my entry point script i just do some replaces before starting jboss.
> 
> for example ( i have ASYNC_POOL word in the value entry of the xml inside the 
> jboss.tar.gz i use,  so it get replaced ok )
> 
> sed -i -e 's/ASYNC_POOL/'"$ASYNC_POOL"'/g' 
> /opt/jboss/jboss-as/standalone/configuration/standalone.xml
> 
> 
> and in my RC i set it as follows :
> 
>            "env": [
>      {
>        "name”:"ASYNC_POOL",
>        "value”:"300"
>      },
> 
> etc etc
> 
> that works like a charm, but all this variables are NULL when recovering them 
> from my java app.
> 
> 
> best regards
> 
> 
>> El 12 sept 2016, a las 11:37, Aleksandar Kostadinov <akost...@redhat.com 
>> <mailto:akost...@redhat.com>> escribió:
>> 
>> Do you use official Wildfly/JBossEAP images for OpenShift? OpenShift does 
>> not run containers as root by default (this is the reason most standard 
>> docker images need extra configuration to run on OpenShift).
>> 
>> To check why env vars are not visible, I think you'd need to post your 
>> dockerfile somewhere.
>> 
>> Julio Saura wrote on 09/12/16 12:11:
>>> hello
>>> 
>>> i have just started the process as root inside the docker just to be
>>> sure that  was the problem ,but still the same issue
>>> 
>>> java process running inside jboss is not reading variable values but
>>> when connected to the docker shell , echoing them shows the values
>>> properly ..
>>> 
>>> what i am doing wrong? shell processes are able to read values but app
>>> inside jboss no..
>>> 
>>> best regards
>>> 
>>> thanks again.
>>> 
>>> 
>>>> El 12 sept 2016, a las 11:04, Julio Saura <jsa...@hiberus.com 
>>>> <mailto:jsa...@hiberus.com>
>>>> <mailto:jsa...@hiberus.com <mailto:jsa...@hiberus.com>>> escribió:
>>>> 
>>>> do i need to do something to make the env variables i pass on son when
>>>> creating the RC to all users? or shall i do it manually dumping them
>>>> into /etc/profile or user bash_profile file prior launching jboss?
>>>> 
>>>> thanks
>>>> 
>>>>> El 12 sept 2016, a las 10:45, Julio Saura <jsa...@hiberus.com 
>>>>> <mailto:jsa...@hiberus.com>
>>>>> <mailto:jsa...@hiberus.com <mailto:jsa...@hiberus.com>>> escribió:
>>>>> 
>>>>> hi
>>>>> 
>>>>> we have found the problem
>>>>> 
>>>>> the process inside the docker is launched with sudo to a non
>>>>> privileged user por starting the jboss server  , don’t want the
>>>>> process to be launched as root.
>>>>> 
>>>>> env variables are only available for the root user of the docker, not
>>>>> for the user that launches jboss process, and so code finds em as null
>>>>> 
>>>>> Best regards
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>> El 9 sept 2016, a las 17:49, Julio Saura <jsa...@hiberus.com 
>>>>>> <mailto:jsa...@hiberus.com>
>>>>>> <mailto:jsa...@hiberus.com <mailto:jsa...@hiberus.com>>> escribió:
>>>>>> 
>>>>>>> 
>>>>>>> El 9 sept 2016, a las 17:47, Aleksandar Kostadinov
>>>>>>> <akost...@redhat.com <mailto:akost...@redhat.com> 
>>>>>>> <mailto:akost...@redhat.com <mailto:akost...@redhat.com>>> escribió:
>>>>>>> 
>>>>>>> Julio Saura wrote on 09/09/16 18:41:
>>>>>>>> 
>>>>>>>>> El 9 sept 2016, a las 17:39, Aleksandar Kostadinov
>>>>>>>>> <akost...@redhat.com <mailto:akost...@redhat.com> 
>>>>>>>>> <mailto:akost...@redhat.com <mailto:akost...@redhat.com>>> escribió:
>>>>>>>>> 
>>>>>>>>> Julio Saura wrote on 09/09/16 17:09:
>>>>>>>>>> Hello
>>>>>>>>>> 
>>>>>>>>>> just to be sure ..
>>>>>>>>>> 
>>>>>>>>>> i need to pass some env variables containing @ and / characters
>>>>>>>>>> 
>>>>>>>>>> so far i did always scape them
>>>>>>>>>> 
>>>>>>>>>> for example
>>>>>>>>>> 
>>>>>>>>>>  {
>>>>>>>>>>     "name”:"URL",
>>>>>>>>>>     "value”:”http:\/\/www.example.com <http://www.example.com/>
>>>>>>>>>> <http://www.example.com/ <http://www.example.com/>>\/uri"
>>>>>>>>>>  },
>>>>>>>>> 
>>>>>>>>> This is not OpenShift specific. You need just correct JSON. As
>>>>>>>>> far as ruby JSON parser says, there is no need to escape anything
>>>>>>>>> in the above URL.
>>>>>>>> 
>>>>>>>> yeah i know is not open shift specific but since this an open
>>>>>>>> shift group i though it would be the right way to answer this :)
>>>>>>>> 
>>>>>>>> ok, i will investigate further then why i am having problems in
>>>>>>>> the app recovering variable values
>>>>>>> 
>>>>>>> You need to provide to the list more details of what you are seeing
>>>>>>> exactly. I said JSON escaping is not specific to OpenSHift. But
>>>>>>> issue might not be escaping itself.
>>>>>> 
>>>>>> yeah agree. let me do some investigations in the code i had .. i am
>>>>>> sure is a code problem if escaping is not needed ..
>>>>>> 
>>>>>> i am getting is a null pointer exception when recovering the env
>>>>>> variables values.
>>>>>> 
>>>>>> i will share conclusions as soon as i have
>>>>>> 
>>>>>> thanks
>>>>>> 
>>>>>>> 
>>>>>>>> thanks aleksandar
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> this is the right way ? i am having problems recovering this
>>>>>>>>>> variable on a java app in my pods
>>>>>>>>>> 
>>>>>>>>>> on shell if i echo the variable’s value shows the value ok.
>>>>>>>>>> 
>>>>>>>>>> thanks in advance
>>>>>>>>>> Best regards.
>>>>>>>>>> 
>>>>>>>>>> _______________________________________________
>>>>>>>>>> users mailing list
>>>>>>>>>> users@lists.openshift.redhat.com 
>>>>>>>>>> <mailto:users@lists.openshift.redhat.com>
>>>>>>>>>> <mailto:users@lists.openshift.redhat.com 
>>>>>>>>>> <mailto:users@lists.openshift.redhat.com>>
>>>>>>>>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
>>>>>>>>>> <http://lists.openshift.redhat.com/openshiftmm/listinfo/users>
>>>>> 
>>>>> _______________________________________________
>>>>> users mailing list
>>>>> users@lists.openshift.redhat.com <mailto:users@lists.openshift.redhat.com>
>>>>> <mailto:users@lists.openshift.redhat.com 
>>>>> <mailto:users@lists.openshift.redhat.com>>
>>>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
>>>>> <http://lists.openshift.redhat.com/openshiftmm/listinfo/users>
>>>> 
>>>> _______________________________________________
>>>> users mailing list
>>>> users@lists.openshift.redhat.com <mailto:users@lists.openshift.redhat.com> 
>>>> <mailto:users@lists.openshift.redhat.com 
>>>> <mailto:users@lists.openshift.redhat.com>>
>>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users 
>>>> <http://lists.openshift.redhat.com/openshiftmm/listinfo/users>
> _______________________________________________
> users mailing list
> users@lists.openshift.redhat.com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users

_______________________________________________
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to