How do I set System properties within WL6.0?

I am setting WL6.0 up to have a startup class, but this class needs to
read system properties which have not yet been set. How do I set these
up within weblogic? I was able to get the startup class set up, but it
needs these system properties to continue.
gmo

Correct on all points. The one advantage of doing this in java is that you can more easily do more
complex things like accessing configuration information from a remote data store (like a database).
Dimitri Rakitine wrote:
These are not needed if you simply replace java ...lots of options... weblogic.Server with
java ...lots of options... startmyWLS in the script which starts WebLogic, but, on the other
hand, this solution is no different from simply adding -DmyProperty=myValue to the startup script
(I think that the ultimate goal is the ability to deploy(and redeploy!) components,
without any mods to the particular vendor's startup scripts of anything of that nature).
Kumar Allamraju <[email protected]> wrote:
Thanks to robert for a quick workaround..
I tried to start the WLS with the following piece of code and actually i need to set
some additional properties
for successful server startup.
Here it is
import java.util.Properties;
public class startmyWLS
public static void main(String[] args)
Properties props = System.getProperties();
props.put("myProperty", "myValue");
props.put("bea.home", "E:\\bea");
props.put("weblogic.Domain", "mydomain");
props.put("weblogic.Name", "myserver");
props.put("java.security.policy",
"E:\\bea\\wlserver6.0\\lib\\weblogic.policy");
System.setProperties(props);
weblogic.Server.main(args);
Make sure you run this from E:\bea\wlserver6.0., as it tries to read config.xml
config\[your-domain-name] from this
directory.
Kumar
Robert Patrick wrote:
import java.util.Properties;
public class StartMyWebLogicServer
public static void main(String[] args)
Properties props = System.getProperties();
props.put("myProperty", "myValue")
System.setProperties(props);
weblogic.Server.main(args);
gmo wrote:
That won't work since it has to be 'outside' of the code. It's a service, and
services are started when weblogic is started up, not when I call a bean.
And it has to be dynamic, since the properties will vary on evry installation.
Robert Patrick wrote:
You can also use System.setProperty() or a combination of
System.getProperties() followed by a System.setProperties()...
gmo wrote:
They are not normal system properties. I'm using some open source code, and
it requires settings to be system properties, but they are specific to the
application, which means that they are not already in the system
properties. I know how to get them, and after some more research, you can
set them on the command line when starting up weblogic. However, is this
the best way to set system properties?
Robert Patrick wrote:
What "system properties" are you trying to find?
gmo wrote:
I am setting WL6.0 up to have a startup class, but this class needs to
read system properties which have not yet been set. How do I set these
up within weblogic? I was able to get the startup class set up, but it
needs these system properties to continue.
gmo
Dimitri

Similar Messages

  • Is contextInitialized() blocked from setting System properties?

    A certain 3rd party app we're using within a web app requires a specific System
    property be set. Since it's a local path, we'd like to shy away from hardcoding
    a -D into the startup script, and instead do it via a ServletContextListener and
    set the property within contextInitialized(). In WL7.0sp2, it seems to hit the
    line in our listener where it tries to set a System property, and nothing happens.
    It doesn't seem to throw an exception, write anything to the console, nothing.
    Is there a security setting that blocks contextInitialized() methods from setting
    System properties? Is it a WL thing, or maybe a servlet spec thing? It works
    if we use a dummy servlet set to pre-load, where we set the System property in
    the servlet's init() method, but that's a little tackier than doing it in one
    single context init listener.

    Turns out the context-param that I was trying to use as the value of the System
    property was null. When it sets a non-null value, it works. But apparently when
    the value of the System property is null, you get the weird behaviour described
    below: it's as if the tread just stops. I tried setting a breakpoint and stepping
    through, but it immediately went into weblogic security and threading classes
    and never returned. So now I'll have a new question about when context-params
    load during deployment, but I'll post that separately.
    "Mark Griffith" <[email protected]> wrote:
    I don't know of any restriction. Your saying it never sets it? The
    app
    deploys but it is not there in the system properites?
    Have you tried setting a break point and stepping?
    Very strange.
    mbg
    "dave thompson" <[email protected]> wrote in message
    news:3ecac0f8$[email protected]..
    A certain 3rd party app we're using within a web app requires a specificSystem
    property be set. Since it's a local path, we'd like to shy away fromhardcoding
    a -D into the startup script, and instead do it via aServletContextListener and
    set the property within contextInitialized(). In WL7.0sp2, it seemsto
    hit the
    line in our listener where it tries to set a System property, and nothinghappens.
    It doesn't seem to throw an exception, write anything to the console,nothing.
    Is there a security setting that blocks contextInitialized() methodsfrom
    setting
    System properties? Is it a WL thing, or maybe a servlet spec thing?It
    works
    if we use a dummy servlet set to pre-load, where we set the Systemproperty in
    the servlet's init() method, but that's a little tackier than doingit in
    one
    single context init listener.

  • Setting system properties: difference between "-D" and "System.setProperty"

    Hi.
    I have a program that relies on the jogl library to display graphics. Internally, jogl loads a native library from disk, with a System.loadLibrary() call. In turn, loadLibrary searches the paths in the system property "java.library.path" to find the jogl DLL/SO files. So, it is my responsibility to ensure that the "java.library.path" property is correctly set.
    There are two ways that I know of to set system properties: as an argument to the JRE via the "-D" option and from within an application with the System.setProperty method. However, I have noticed that only the former gives the desired behavior. That is, if I do:
    java -Djava.library.path=lib MyProgram{code}
    the code in jogl.jar is able to successfully find and load the native libraries in lib/, but if I do:
    {code:java}System.setProperty("java.library.path", "lib");{code}
    at the beginning of main in my program (before the classes requiring jogl are loaded), I end up with an UnsatisfiedLinkError.
    Why does this happen? Why do the 2 methods produce different results? Is specifying native library paths on the command line the only way to ensure that they are found?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    See the [System Properties Tutorial|http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html] section on "Writing System Properties" which says:
    Warning: Changing system properties is potentially dangerous and should be done with discretion. Many system properties are not reread after start-up and are there for informational purposes. Changing some properties may have unexpected side-effects.
    Also see the [setting java.library.path property in java code|http://forums.sun.com/thread.jspa?threadID=627890] thread in the JNI forum.

  • How do I set individual properties for a column in report layout at runtime

    How do I set individual properties for a column in report layout at runtime? I need to change this based on a user's input. This is for v10g.
    I need to change either the "Read from File" attribute or the "File Format" attribute for one column based on the user's input. IS this possible?
    Thanks in advance!

    Hi,
    define 2 columns and use format triggers to show the one or the other column.
    Regards
    Rainer

  • Setting system properties for IDE JVM

    I need to set system properties in order to turn tracing on for a JDBC driver being called by the IDE. Is there a way to do so?

    Thanks for the reply, but I'm still not getting where I need to get. It appears that either the IDE runs a different copy of my jar file in some obscure location, or it runs with some sort of restricted permissions.
    My driver does not seem to write to its trace file when running in the IDE. It works when I deploy things, but I need to trace the IDE since it does not appear to like something I'm doing.
    I have put a line of code in the driver that writes to a file whenever an instance of the Driver Class is created, but that doesn't seem to get the job done, either. I even put this code in a static initializer. No go.
    Any help greatly appreciated!

  • Setting system properties while startup

    Hi all,
    How do i set a system property while Jdev is starting up? It starts with an executable which in turn calls JVM.
    TIA
    Naveen

    John,
    Thanks for the jdev.conf tip!!
    I add: local testing; in each project, Runner--> Java options add your -Dparam=value
    Production deployment; on the java startup cmd line to start OC4J
    My solaris startup script for /etc/init.d that I sym link to from /etc/rc3.d ...
    #!/sbin/sh
    # As root copy this file to file /etc/init.d/oc4j
    case "$1" in
    'start')
    # clean up the deployment directory automatically
    JBOVARS="-Djbo.logging.trace.threshold=3 -Djbo.logging.show.timing=true -Djbo.debugoutput=console -Djbo.jdbc.trace=true $JBOVARS"
    JBOVARS="-Djbo.ampool.dynamicjdbccredentials=false -Djbo.maxpoolcookieage=1800 -Djbo.dofailover=false $JBOVARS"
    JBOVARS="-Djbo.jbo.doconnectionpooling=false -Djbo.ampool.resetnontransactionalstate=false $JBOVARS"
    JBOVARS="-Djbo.ampool.dynamicjdbccredentials=false $JBOVARS"
    JBOVARS="-Djbo.pers.max.active.nodes=50 -Djbo.pers.max.rows.per.node=200 $JBOVARS"
    JBOVARS="-Djbo.ampool.minavailablesize=100 -Djbo.ampool.maxavailablesize=200 $JBOVARS"
    # hot deploy support
    JBOVARS="-Djbo.server.in-oc4j=true $JBOVARS"
    PROPERTIES="-Dorg.apache.commons.logging.simplelog.showlogname=true -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.defaultlog=all $PROPERTIES"
    PROPERTIES="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog  -Dlog4j.debug=true $PROPERTIES"
    # Set scribeFindOffenderURLEnvVar to non-null string to do Redirect to Scribe
    PROPERTIES="-Djscribe.scribeHostEnvVar=http://10.2.22.127:8080 -Djscribe.scribeFindOffenderURLEnvVar= -Djscribe.scribeHostEnvVar=http://10.2.22.130:8888 $PROPERTIES"
    # Enable setting of default userUIContext values, loser checking etc.
    PROPERTIES="-Djscribe.debug=true $PROPERTIES"
    # Give the VM 1Gb of RAM out of 2Gb total.
    JAVACMDLINE="java -server -Xrs -Xmx1024m -Xms256m $PROPERTIES $JBOVARS  -jar oc4j.jar -verbosity 9"
    echo $JAVACMDLINE > /tmp/oc4j-start-cmd.txt
    su oracle -c "cd /jdev/j2ee/home; pwd ; $JAVACMDLINE  2>&1 | /usr/local/bin/mlog -c -o /jdev/j2ee/home/log/oc4j_console.log -s 10000000 &"
    'stop')
    /usr/bin/pkill -x java
    # The above cmd will kill all instances of java including other instances of oc4j via
    # script
    echo "FYI, this cmd has just killed off all instances of java"
    #echo "including a second or other instance of Orion (oc4j2 script)"
         echo "Usage: $0 { start | stop }"
         exit 1
    esac
    exit 0

  • How do I set file properties (win XP) ?

    Does anyone know how to set/modify a windows file properties inside Labview ? For exemple : change the author, the comment... etc.
    Thank you !
    J.K.

    Hello,
    It is not possible with advanced file I/O LabVIEW VIs.
    There is a possible workaround by using low level Windows functions in a dll.
    Perhaps the easier would be to set your properties at the top of your file.
    You will find some explanations here :
    http://forums.ni.com/ni/board/message?board.id=170&message.id=85101&requireLogin=False
    regards
    Marc L.
    NIF

  • How do i set system preferences to delete file cache that is not being used

    My file cache is using over a GB of memory.  How do i set the system to free up memory that is being held but not used?

    It's normal since Mavericks for almost all memory to be in use, either by applications or by the file cache. That's what you should want, since unused memory is going to waste. The relevant measure of whether memory is in short supply is what Apple calls "memory pressure."
    Apple's explanation of memory pressure is here. If you want a more detailed, technical description, see here, and for the source code, see here.

  • How to dynamically refresh system properties when changed

    Hi All,
    Through weblogic startup class I'm loading the properties from a properties file
    into system properties, Now my requirement is to refresh those system properties
    when ever I make changes to the properties.
    Is there any way to achieve this functionality through MBeans.

    Hello Lucky,
    I believe you cannot refresh properties file dynamically using MBeans. What
    you can do is write an MBean which necessrily mirror your property file and
    register with MBeanServer. You can set values on the MBean dynamically but
    in order to persist your changes you need to write your own persistance
    mechanism.
    Cheers
    Ali
    "Lucky" <[email protected]> wrote in message
    news:3f84d68f$[email protected]..
    >
    Hi All,
    Through weblogic startup class I'm loading the properties from aproperties file
    into system properties, Now my requirement is to refresh those systemproperties
    when ever I make changes to the properties.
    Is there any way to achieve this functionality through MBeans.

  • Setting System properties and classpath at boot

    Hi all,
    I'm pretty new to weblogic and I'd need to set some system properties and classpath definitions for my servers at boot. Can I set them via the Administration console or just adding them to the startWeblogic/startManagedWeblogic using the standard -cp and -D flags ?
    I've found in the Console, there's the Server Boot properties. However adding them there didn't work. Correct me if I'm wrong, this option can be used ONLY when starting the servers from the Node Manager ?
    Thanks
    Frank

    Hi Frank,
    You are right!!!!
    But you can set them with in setDomainEnv file under java_option.
    Please set under
    Unix
    JAVA_OPTION = "${JAVA_OPTION} -DXXXXX"
    In Windows
    set JAVA_OPTION = %JAVA_OPTION% -DXXXXX
    Hope this will help you.
    Regards,
    Kal

  • How can I get system properties?

    Hello,
    How can I get the system properties like %JAVA_HOME% in my java codes, for example, I want to print it like this.
    System.out.println("%JAVA_HOME%");
    but it doesn't work!
    Please give me a hand!

    To pass the Operating system environment variable to the Java "environment variables", you have to explicitely pass them on the command line eg.
    java -Dmyjava.home=%JAVA_HOME% myClass
    then, in your code use
    String JAVA_HOME = System.getProperty ( "myjava.home" );regards,
    Owen

  • How can i extract system properties

    how can i extract OS properties like desktop resolution, type of internet connection, sound capability, browser character settings etc. ??

    type of internet connection,Not possible. You can detect the lack of an active
    internet connection though (figuring out how is left
    as homework for the reader;)),
    sound capability,Nope.
    browser character settings etc. ??Nope.
    Tuomas RintaThanx for replying..
    Are you serious ?? There is no way to check if the system is sound capable or not ? ok for the type of internet connection i thought that you couldn't so...
    as for the existence of an internet connectio....i am not that new...
    Nik

  • Setting system properties of windows using java

    Hi,
    I am doing a project in networking using java in which i need to get and set Operating system(Windows) properties .
    I am able to do the GET part but i face problem in setting the system properties permanently.
    Please help me!.
    --Amy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Is there any way of setting the properties other than employing the useo of JNI.

  • How can I set a breakpoint within a macro in order to debug a prog.?

    Hello all,
    How can I set a session Breakpoint inside a macro (i.e. DEFINE .... END-OF-DEFINITION) in order to debug a prog.?
    I keep on getting the message: "The position of a breakpoint cannot be determined." What does this message mean?
    Thanks for your help.

    Goharjou,
    We cannot see the program control flow inside a Macro, instead we can place a break point on the statement which calls the Macro and we can see the content of variables and internal tables before and after the Macro call.
    Reward if useful..
    Thanks,
    Madhan.

  • How are the java system properties loaded into the Oracle 8.1.7

    I have listed the java system properties both standalone and in the Oracle database. The standard list of system properties is quite extensive and informative. But the list of system properties from the Oracle database is severely truncated.
    I expect these properties are initialized on database startup.
    If that is the case, I expect there to be a file and initialization parameters that define where the information is kept and there values.
    Can anyone give me some guidance?

    System*.properties file should be located in the $ORACLE_HOME/javavm/jahome directory
    I have listed the java system properties both standalone and in the Oracle database. The standard list of system properties is quite extensive and informative. But the list of system properties from the Oracle database is severely truncated.
    I expect these properties are initialized on database startup.
    If that is the case, I expect there to be a file and initialization parameters that define where the information is kept and there values.
    Can anyone give me some guidance?

Maybe you are looking for