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
Similar Messages
-
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.
gmoCorrect 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 -
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. -
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 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
FrankHi 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 -
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!.
--AmyIs there any way of setting the properties other than employing the useo of JNI.
-
Setting system properties accessible from BPEL independent of ENV
I am implementing a BPEL Process in which I am referring to a folder in my local server.Is there any way where I can set some sytem properties such way that the folder path could be dynamically accessed independent of the server/environment.
Ex:-in dev environment I am referring to this location - 'aia/tmp/DCTM/Input'
in devtest environment I want it to refer to this location- 'tmp/DCTM/Input'
Can we have any generic settings for this requirement?
Regards,
NivaYou can try using bpel preferences. You can change the values of these preferences @ runtime using the em console and the value changes dynamically without server restart.
Ex:
In composite.xml :
<component name="sample">
<implementation.bpel src="sample.bpel"/>
<property name="bpel.preference.folderLoc">aia/tmp/DCTM/Input</property>
<property name="bpel.preference.customProp">xyz</property>
</component>
and use ora:getPreference(folderLoc) to get it from within a BPEL process
and to change the value from em :
EM>Farm_soa_domain>weblogic domain>your_domain>soa_server1>right click menu>system Mbean browser>oracle.soa.config>server:soa_server1>SCAComposite>your project>SCAComposite.SCAComponent>processName>
Click the properties attribute : you should see the folderLoc and customProp and be able to change those.
Hope this helps. -
hi,
i want to change my JVM properties("user.dir", "os.name" etc...) using JNI.
So the setProperty() method have 2 parameters that's why i have tried to do this :
sys = (*env)->FindClass (env, "java/lang/System");
meth = (*env)->GetStaticMethodID (env, sys, "setProperty", "(Ljava/lang/String;)Ljava/lang/String;","(Ljava/lang/String;)Ljava/lang/String;");
(*env)->CallStaticObjectMethod(env, sys, meth, (*env)->NewStringUTF (env, &key),(*env)->NewStringUTF (env, &newVal));
I don't understand why it doesn't work.
Can anyone help me?
Thanks by advance>
I don't understand why it doesn't work.
Can anyone help me?And what do you think that this is going to achieve?
If you use it in your code it will have an impact. If it is used by the Java API it is likely to not have any impact. Many values in the properties are cached and will not be refreshed in the value in Properties changes. -
In J2ME wireless toolkit, we can add system properties on the "User Defined" tab under settings. These properties can then be accessed by the Midlet. I am using JDeveloper with JWE. From within JDeveloper, I don't see any such option to set system properties. How can I achieve this?
Thanks for your help.You can manage midlet attributes from the property page of the midlet suite. This is in step 4 with ".MIDletInfo" settings.
Kalle -
Sun Application Server 8.1 (System Properties)
When trying to access the System Properties, I get the following exception:
<i>org.apache.jasper.JasperException: access denied (java.util.PropertyPermission * read,write)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :251)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil .java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUt il.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(Secu rityUtil.java:165)
root cause
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
java.security.AccessControlContext.checkPermission(AccessCon trolContext.java:264)
java.security.AccessController.checkPermission(AccessControl ler.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.ja va:532)
java.lang.SecurityManager.checkPropertiesAccess(SecurityMana ger.java:1252)
java.lang.System.getProperties(System.java:560)
org.apache.jsp.TestXlatServices_jsp._jspService(TestXlatServ ices_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja va:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:336)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :251)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil .java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUt il.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(Secu rityUtil.java:165) </i>
I don't know how to allow my java code to access/set System properties. Is this possible, and how do i do it?
Thanks,
DanSee the following documentation concerning use of the server.policy file:
http://docs.sun.com/app/docs/doc/819-2556/6n4rap8po?a=view
You should find additional help on the Application Server-specific forums:
http://forum.sun.com/jive/category.jspa?categoryID=7
Chris -
Creating buttons on the fly and setting button properties
If I have a view and want to add buttons to it "on the fly" from values in an array, is that something straightforward to do?
I have an array of UIImageVIew objects and would like to create buttons from them (showing the image on the buttons) and associate those buttons with a method in my implementation file. That would be a lot more general and flexible than creating the buttons in the Interface Builder I would imagine.
And one more question - can I freely set button properties while doing that? Or in Objective-C can I only set properties that are already pre-defined for that class?
Thanks!
dougThanks for your reply.
That.... works! Thanks!
And I can generate the button and click on it and it calls my other method and that works too. Cool!
The syntax is still very mysterious to me, but I suppose eventually I'll understand what it all means.
Breaking it down to see what it means:
[button1 addTarget:self action:@selector(selectedHandler1:) forControlEvents:UIControlEventTouchUpInside];
* button1 is the object I created (I'm going to try to do this in a loop next.)
* addTarget is a message I am sending to button1 and the content of the message is "self", which refers to - this button? I'm not sure why such a message would be necessary.
* action is another message sent to button1 and the contents of that message are a little harder to parse. I see the result, and can mimic the syntax now that I've seen it, but I don't really understand what the @ is for, or the : after the method name or why this wouldn't just be "action: selectedHandler". I'm sure the language designers have a logical reason for all that, but I don't quite "grok" those extra symbols yet.
* forControlEvents is another message sent to button1 and the event message itself is clear in its meaning.
Anyway, that is working and I can refer more to the UIButton class reference now and try to set more stuff, like position it better, etc.
Thanks very much!
doug -
How to set JVM system properties in Oracle Portal ??
Hello Guys,
I want to set javax.net.ssl.trustStore="path to keystore" ,JVM system properties on oracle portal,
Like i want to configure my keystore with oracle portal so that my application can make a success full connection with back end using https.
i read the following note from one of the Oracle tech note,which says that
It is important that this system property is passed as a command line option to Oracle Application Server Containers for J2EE (OC4J). Setting the property in oc4j.properties will not help because the system property is read first before OC4J reads this file. Therefore, it is best to modify the <java-option> line in the OC4J_portal section of ORACLE_HOME/opmn/conf/opmn.xml.
So, i made the required changes to OC4J_portal section of opmn.xml file as below
added value is shown in bold
<data id="java-options" value="-server -Xrs -Djava.security.policy=C:\oracle\OraPortal\j2ee\OC4J_Portal\config\java2.policy -Djava.awt.headless=true -Xmx256m -Djavax.net.ssl.trustStrore=C:\keystore1 -Djavax.net.ssl.trustStrorePassword=password1"/>
Even after making these changes, my application not able to make connection using https.
Could u guys explain me, what things are going wrong or somethings else i need to do to make it work.
Any thoughts would be highly appreciated.
Thanks
<Neeraj Sidhaye/>
http://ExtremePortal.blog.co.ukHello Guys,
I want to set javax.net.ssl.trustStore="path to
keystore" ,JVM system properties on oracle
portal,
-Xmx256m -Djavax.net.ssl.trustStrore=C:\keystore1
-Djavax.net.ssl.trustStrorePassword=password1"/>Hi,
if the above is an exact copy of the values you inserted then it looks like you have two typos in the command line parameters.
-Djavax.net.ssl.trustStrore -> trustStore
-Djavax.net.ssl.trustStrorePassword -> trustStorePassword -
Reading locale system properties like set-variables of a windows Client
Hello,
is there a possibility to read locale system properties like set-variables of a windows Client?
We want to read path-Info and user-info. Can I perhaps user javascript?
Best regards
Oliver ProdingerHi Oliver,
This code will work (assuming the client approves running of ActiveX)
<html>
<script>
var shell = new ActiveXObject("WScript.Shell");
var env = shell.Environment("process");
alert(env("COMPUTERNAME"));
alert(env("USERNAME"));
</script>
</html>
You can't really run it from WD, but what you can do is run this code from a portal component (DynPage/JspDynPage) that is running in the same page as your WD application and pass data by using portal eventing.
The portal component iview can have size of 1 pixel so it won't be seen...
Regards,
Omri -
In weblogic 10.3, is it possible to set java arguments by using the console only?
I tried to put:
-DmyArg=XXX
inside the Arguments section of my weblogic server under the tab "Server start".
However, when I start the server and look at the logs, the Java system properties are printed there, but I can't see my new property..
Thanks.Well, if you use script to start server, then you need to add required settings to the script.
Arguments field in startup properties are processed by the NodeManager while executing command to start server. See here for more details: http://e-docs.bea.com/wls/docs92/server_start/nodemgr.html#wp1081792
Maybe you are looking for
-
How can I rotate more than one photo at a time?
In iphoto you used to be able to rotate several photos at a time, now that function seems to be gone. Am I mising something?
-
What advantages there are, if any, to using Apple's MAIL program over, e.g., Yahoo! Mail? I began using email on the Internet long before I got a Mac and so have been a longtime user of webmail (i.e., Yahoo! Mail). Webmail has one obvious advantage -
-
ITunes update bad for my ipod ?!?!
My ipod has been working great for the past 2 years, well, I power up with the wall plug and haven't updated any of my itunes or ipod software for probably 8 months. I updated my itunes to the recent version and then reset and updated my ipod. Now I
-
Invoice-wie Due Date List for Vendors
Hi, Please inform me, if there is an report for vendor informing exact the Due Date for each Invoice Drawn for that Vendor Regards Ashwin
-
C6180 - USB and Wireless on the same computer
I have a C6180 and have no problem installing it as a USB printer OR via a wireless connection. Is there a way to have both, USB and wireless, on the same computer at the same time using 2 different printer setups? Windows XP Pro SP3 and Mac OsX 10.5