Java Properties empty if LDAP
Hi,
we used to have a systemcall on /usr/bin/env and a Reader to get system-information like Home directory and Username. I switched this over to System.getProperty("user.home") and System.getProperty("user.name").
Unfortunatly these are empty! It seems that those Properties are read from /etc/passwd which does not contain the User-Information as we login on this box via LDAP.
Is that the reason or am I missing something here? How can we use the System.getProperty-methods?
http://download.oracle.com/javase/1.4.2 … ng.String)
Hmm I am not entirely sure about the inner workings of the System.getProperty() call.
But if you want you can always create a Map of all the properties and then use that in place of a properties file.
EDIT : The more I think about it, I am sure the getProperty also uses a hashtable behind the scenes. It would be wasteful to use a list for properties file which is nothing but a key-value pair
Last edited by Inxsible (2010-08-19 16:18:23)
Similar Messages
-
I am currently using OpenLDAP with a Tomcat JNDI Realm to do authentication and to store Java User objects mapped to an InetOrgPerson objectClass and have been doing so for some time in production.
What I would like to do and have been searching for, is to take the Plethora of *.properties files I have in multiple webapps and extend my properties loader to look in OpenLDAP and build the Properties object from values stored in LDAP instead of from the filesystem. The obvious advantage is that for some properties files, each webapp has the same properties file, like the connect info to the content server. If I change the connect info to the content server I want to change it in ONE place, i.e. LDAP, not each and every separate properties file.
In my search I see examples of using serialization to bind a java object to an entry
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,"cn=Directory Manager"); // specify the username
env.put(Context.SECURITY_CREDENTIALS,"password"); // specify the password
DirContext ctx = new InitialDirContext(env);
Properties properties = new Properties();
�
ctx.bind("cn=coolProps,ou=JavaObjects,o=myserver.com ", properties);
This throws an InvalidAttributeIdentifierException on javaSerializedData on OpenLDAP 2.2.29-db-4.3.29 win32 distribution, running on XP Pro.
Even this will be ok as far as it goes but the problem with this is that I would rather have an objectClass schema entry that gave me LDAP modification of the individual properties, so I can use JXplorer (or any LDAP Browser) to manage the properties, just the same as I can modify the properties in the more concrete classes I have mapped. But I do NOT want to create a new schema for every properties file and map each one individually.
Does someone have a Java Properties objectClass schema and java helper example they can/will share? Or is it something I just didn�t manage to find because I didn�t search for the right words?
NOTE* The OpenLDAP Software forum's moderator said this was "off topic" and the latest Open LDAP does NOT include the JavaObject schema.
OllieThis throws an InvalidAttributeIdentifierException on
javaSerializedData on OpenLDAP 2.2.29-db-4.3.29 win32
distribution, running on XP Pro. My bad, I realized I didn't have the java.schema configured.
>
Does someone have a Java Properties objectClass
schema and java helper example they can/will share?
Or is it something I just didn�t manage to find
d because I didn�t search for the right words?
However I still would like to get a JavaProperties schema if someone has one and some Java helpers to work with it. -
URGENT : Add & Retrieve properties from Embedded LDAP in Weblogic 9.2
I am using Embedded LDAP WebLogic 9.2 and i followed the steps mentioned in the URL below.I have nt changed anything except Server URL which points to localhost:7001.
http://e-docs.bea.com/wlp/docs92/users/appendixa.html#wp1055363
Questions:
1)How to add additional attributes to embedded LDAP? (eg email, phone etc).
2)How to read those properties from embedded LDAP using WebLogic Portal API? Any code samples?
Any help is appreaciated.this problem is due to hard-coded user/pwd in installation scripts. Here are steps
1) open file AIA_HOME/Infrastructure/install/wlscripts/FPWLCommonConfig.xml
2) reach to target CreateStartupClasses
3) there are three java tasks for com.oracle.oems.weblogic.AQJMSPasswordUtility
4) in the task for oraesb, password is hardcoded as 'oraesb' in clear text.
5) this should be password of 'ORAESB' database user.
6) change this password value; and restart the installation.
Regards,
Vaibhav -
How to set proxy authentication using java properties at run time
Hi All,
How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
=> Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
import java.io.*;
import java.net.*;
public class DnldURLWithoutUsingProxy {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://www.yahoo.com.au/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
dis.close();
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
}However, it generated the following message when run behind the firewall:
cd C:\Documents and Settings\abc\DnldURL\build\classes
java -cp . DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
I have also tried the command without much luck either:
java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
There is no problem pinging www.yahoo.com from this system.
I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
Java Control Panel - Use browser settings without success.
Thanks,
GeorgeHi All,
How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
=> Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
import java.io.*;
import java.net.*;
public class DnldURLWithoutUsingProxy {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://www.yahoo.com.au/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
dis.close();
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
}However, it generated the following message when run behind the firewall:
cd C:\Documents and Settings\abc\DnldURL\build\classes
java -cp . DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
I have also tried the command without much luck either:
java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
There is no problem pinging www.yahoo.com from this system.
I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
Java Control Panel - Use browser settings without success.
Thanks,
George -
Static lookup lists:read data from a Java *.properties file
Hi
i need to make static lookup lists i am using read data from a Java *.properties file
i am using the Class "PropertyFileBasedLookupViewObjectImpl" that wrote by Steve Muench in ToyStore.
but i need to use the default language for that i update the loadDataFromPropertiesFile()
method to find the correct properties file
String temp=Locale.getDefault().getLanguage();
String propertyFile =
getViewDef().getFullName().replace('.', '/')+"_"+temp+ ".properties";
the problem:
For English(TEST_en.properties) it is good and working
For Arabic(TEST_ar.properties) read from correct file _ar.properties
but the dispaly character is wrong
When Debug
In the File 1=دمشق
In debug 1=/u32423Depending on your use case you can either use a programmatic VO or directly expose the JV class as a data control.
http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_36/jdtut_11r2_36.html -
How to configure Java Properties File location in WLW
How do we tell Workshop 7.0 where to look for Java properties files (loaded by
PropertyResouceBundle in code) ?
Thanks,
RayRay,
The build number indicates that you have not upgraded to Service Pack 2 of
version 7.0. I will strongly recommend you to do so. That will shield you
from the issues which were fixed in the 2 service packs.
Regards,
Anurag
"Ray Yan" <[email protected]> wrote in message
news:[email protected]...
>
Raj,
We are using WebLogic Workshop Build 7.0.1.0.0829.0 on Windows 2000.
We shut down the WebLogic Server on Solaris 2.6, log off, log back on,startWebLogic
in production nodebug mode, and re-run jwsCompile on the same source code.The
error does not occur anymore. Everything seems to be fine now.
Thanks,
Ray
"Raj Alagumalai" <[email protected]> wrote:
Hello Ray,
Can you let me know if you are using the GA version of WebLogic Workshop
or
if you have the latest Service Pack.
Thank You,
Raj Alagumalai
WebLogic Workshop Support
"Ray Yan" <[email protected]> wrote in message
news:[email protected]...
Anurag:
Thanks for your response!
By moving the property files to WEB-INF/classes from WEB-INF, we arealmost there.
But we have a follow up problem. We use a static initializer to loadthe
log4j
property file like this:
static {
try {
ClassLoader cl= (new Log()).getClass().getClassLoader();
InputStream is = cl.getResourceAsStream(logfile);
Properties props = new Properties();
props.load(is);
PropertyConfigurator.configure(props);
} catch (Exception e) {
e.printStackTrace();
When we run jwsCompile, we keep getting this:
Compiling: com/****/TestWS.jws
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[weblogic.management.Admin
may only be used on the Server ]
at weblogic.management.Admin.getInstance(Admin.java:104)
at
weblogic.security.internal.ServerPrincipalValidatorImpl.getSecret(ServerPrin
cipalValidatorImpl.java:79)
at
weblogic.security.internal.ServerPrincipalValidatorImpl.sign(ServerPrincipal
ValidatorImpl.java:59)
at
weblogic.security.service.PrivilegedActions$SignPrincipalAction.run(Privileg
edActions.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at
weblogic.security.service.SecurityServiceManager.createServerID(SecurityServ
iceManager.java:1826)
at
weblogic.security.service.SecurityServiceManager.getServerID(SecurityService
Manager.java:1839)
at
weblogic.security.service.SecurityServiceManager.sendASToWire(SecurityServic
eManager.java:538)
at
weblogic.security.service.SecurityServiceManager.getCurrentSubjectForWire(Se
curityServiceManager.java:1737)
at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:434)
at
weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:
88)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:255)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:230)
at
weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown
Source)
atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
at weblogic.knex.bean.EJBGenerator$1.run(EJBGenerator.java:101)
at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:780)
atweblogic.knex.bean.EJBGenerator.lookupAdminHome(EJBGenerator.java:84)
atweblogic.knex.bean.EJBGenerator.ensureAdminHome(EJBGenerator.java:122)
at weblogic.knex.bean.EJBGenerator$6.run(EJBGenerator.java:660)
at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
r.java:821)
atweblogic.knex.bean.EJBGenerator.generateJar(EJBGenerator.java:482)
at
weblogic.knex.dispatcher.DispJar.generateJar(DispJar.java:401)
atweblogic.knex.dispatcher.DispCache.ensureDispUnit(DispCache.java:695)
atweblogic.knex.compiler.JwsCompile.compileJws(JwsCompile.java:872)
at
weblogic.knex.compiler.JwsCompile.compile(JwsCompile.java:619)
at weblogic.knex.compiler.JwsCompile.main(JwsCompile.java:109)
ejbc successful.
Generating EAR ...
The EAR was generated and we can even deploy it on Solaris. But whatdoes
the
AssertionError mean?
Thanks,
Ray
"Anurag Pareek" <[email protected]> wrote:
Ray,
ResourceBundle looks for the properties file in the current thread's
classpath.
Since a Workshop webservice's project is nothing but a webapp, the
properties files can be kept in the WEB-INF/classes directory, which
is part
of the webapp classpath.
You can also use
Thread.currentThread().getContextClassLoader().getResourceAsStream("MyProp
s
properties"); to get access to the properties file.
Thanks,
Anurag
"Ray Yan" <[email protected]> wrote in message
news:[email protected]...
How do we tell Workshop 7.0 where to look for Java properties files(loaded by
PropertyResouceBundle in code) ?
Thanks,
Ray -
How to load Java properties file dynamically using weblogic server
Hi,
We are using Java properties file in Java code. Properties in java properties file are frequently modified. If I keep these properties file in project classpath or as part of war, I will have to redeploy application after each change.
We are using Weblogic Server.
Can you please suggest me how can this properties file be loaded at weblogic server startup. Then in that case, how to refer property file in Java code?
What is the best practice for this?
Thanks,
ParshantAnother alternative is, keep the property file in any pre-defined location. Write a class which reads the properties from the file and returns the one which is requested by caller and deploy this class. Whenever you have to change the properties just update the property file on server and next call to fetch the property should return the updated one.
Downside of this approach is file I/O everytime. To overcome that you can actually "cache" the properties in a hashmap. Basically when any property if requested, first check the hashmap, if not found then only read from property file and also update in hash map. Next time same property will be returned from hash map itself. The hash map will be cleared at every server restart since its in the memory. You will also need to build a method to clear the hashmap when you update the values in the property file on server.
This solution would be suitable for small size files and when network overhead of calling a DB needs to be avoided. -
Bad http.agent in Java properties : a bug in the HTTP user-agent string?
Hi all,
Me :
I'm patching AWSTATS (web log analyzer tool) in order to recognize which Java version has
been used to download files.
Context of the problem :
Each time a Java program (or applet) is downloading a file (for example .class, .png, .html)
from a web server, a line will be added in the web server log file. If the web server is well
configured, the user agent used to download the file will be at the end of the line in the log file.
For Sun Java JVM, the user agent string is configured in the Java properties under "http.agent".
Usually, the user-agent string contains the word "Java" and the virtual machine version. In most
cases, this is just a string like "Java/1.4.2", so this is relatively easy to parse.
Problem :
Looking in my web server stats, and then on the web, I found that a JVM's user-agent is
"Mozilla/4.0 (Windows XP 5.1)", which obviously does not contains the word "Java".
Consequently, it is difficult to say that this user-agent string belongs to a JVM.
Further look in my log files and on google shows that this http.agent string appears
on Microsoft Internet Explorer (it seems MSIE 6.0) over Windows XP with the J2RE plugin:
http://board.gulli.com/thread/300321
http://forum.java.sun.com/thread.jsp?thread=531295&forum=30&message=2559523
http://forum.java.sun.com/thread.jsp?forum=63&thread=132769&start=210&range=15&tstart=0&trange=15
http://forum.java.sun.com/thread.jsp?forum=32&thread=480899
http://www.goodidea.ru/setupJava/javaInstall.htm
The J2RE plugin version does not seems to play a role as this user-agent string has
been seen on 1.4.1_02-b06, 1.4.2_01, 1.4.2_03 and 1.4.2_04-b05.
Further information requested :
I would like to know:
1) if you have reported the same problem;
2) if there is some rules for the http.agent property;
3) if this is a bug.
Thank you very much, and feel free to add you opinion.
JulienThe web log files where the "Mozilla/4.0 (Windows XP 5.1)" user-agent appears can be displayed using the following search terms on google :
"Mozilla/4.0 (Windows XP 5.1)" -"(Windows XP 5.1) Java"
http://www.google.ch/search?hl=fr&ie=UTF-8&q=%22Mozilla%2F4.0+%28Windows+XP+5.1%29%22+-%22%28Windows+XP+5.1%29+Java%22&btnG=Rechercher&meta=
Julien -
How can I get properties from my ldap server?
urgent,I don't know
how to use the getproperties to get the properties
from ldap server,anyone help?Hi Kevin,
You could write a portlet that uses the <um:getProfile> and
<um:getProperty> tag (
http://edocs.bea.com/wlp/docs40/p13ndev/jsptags.htm#1058056 )
Or you can do an easier test that requires no coding: If you use the EBCC
to create metadata about your ldap property set, then you can use the JSP
portal admin tool to see your LDAP properties for a user. I think if you go
through the UUP example on dev2dev.bea.com it has instructions for doing
this with a UUP. Basically, create a property set (a.k.a. "user profile")
named "ldap" in the EBCC and create properties that match the ones you want
to retrieve ("telephoneNumber", etc...CASE SENSITIVE). Then access the JSP
portal admin tool. If you are not using the LDAPRealm as your alternate
security realm then create a user that you know exists in LDAP and then hit
the link for the user and search the "ldap" property set and you will see
their property values. If you are using the LDAPRealm for authentication,
then this is not a ManageableRealm so you cannot create users (they are
managed in your LDAP server). So, if you are using the LDAP realm, just
create the "ldap" property set in the EBCC and go to the user mgmt tools in
the JSP admin tools and you will see your user. Then search the "ldap"
property set for your user and you will see the property values.
Ture Hoefner
BEA Systems, Inc.
www.bea.com
"Kevin" <[email protected]> wrote in message
news:[email protected]...
>
Hello,
We're trying to retrieve an arbitrary profile and it's attributes from
a Novell NDS ldap server. I've configured the ldapprofile.jar as
described in the portal doc:
http://edocs.bea.com/wlp/docs40/p13ndev/users.htm#1131824
but the article doesn't go on to describe how to use the configuration
to actually access the properties.
I'm unsure as to how to use the com.bea.p13n.usermgmt.profile.ldap
package to retrieve the information I need.
Is there some step by step instructions to achieve this as well as
some sample code to run in a jsp to test this functionality?
Thanks for any help.
Kevin
Ture Hoefner <[email protected]> wrote:
Hi Eric,
The LdapPropertyManager handles that for you. All you have to do is
deploy it. (I'm talking about Portal 4.0). See the docs at "Accessing
Properties from an LDAP Server" (
http://edocs.bea.com/wlp/docs40/p13ndev/users.htm#1131824 )
You will need to deploy the LDAPPropertyManager EJB, located in
ldapprofile.jar. It is shipped with the product in
<wlportal4.0-install-dir>/lib/p13n/ejb/ldapprofile.jar.
Eric Nie wrote:
urgent,I don't know
how to use the getproperties to get the properties
from ldap server,anyone help?--
Ture Hoefner
BEA Systems, Inc.
2590 Pearl St.
Suite 110
Boulder, CO 80302
www.bea.com -
How to use Java to connect to LDAP server
We have a requirement is to get LDAP service through XI.
Scenario is SAP <-> XI <-> LDAP
It seems there is not a LDAP adapter for XI now, so, is it possible to embed a Java program to access LDAP server? We already have a program like this:
SAP <-> Java (through JCo) <-> LDAPThanks, I checked this document. Does it mean we still need to run a standalone java application?
SAP -> RFC Adapter -> XI -> Java Proxy -> Java Application -> LDAP Server
Is it possible just build the java application to a jar in XI ? The reason is, if we still need to run a Java application, and it can connect to SAP directly (through JCo). I cannot find any benefit to migrate to XI.
Our wish is
SAP -> RFC Adapter -> XI -> Java Proxy -> LDAP Server -
Java Properties closing unexpectedly
Have you ever had a problem with java closing the after opening it through the control panel unexpectedly?
I open the Java Properties in the Control Panel, I goto the Update tab then I uncheck the box for Check for Updates Automatically
Then like usual this prompt opens. When I click never check the properties closes out without the chance for me to click ok, and its still running in the task manager and the only way for me to open it back up is to end the process.This works for me (size = 100,000 entries).
import java.io.*;
import java.util.*;
public class PropertyTest {
private final static int SIZE = 100000;
private final static File FILE = new File("test.properties");
public static void main(String[] args) throws IOException {
PropertyTest app = new PropertyTest();
app.store();
app.load();
void store() throws IOException {
FileWriter out = new FileWriter(FILE);
try {
Properties props = new Properties();
for(int i=0; i<SIZE; ++i) {
String keyAndValue = String.valueOf(i);
props.setProperty(keyAndValue, keyAndValue);
props.store(out, "here we go");
} finally {
out.close();
void load() throws IOException {
Properties props = new Properties();
BufferedReader in = new BufferedReader(new FileReader(FILE));
try {
props.load(in);
} finally {
in.close();
if (props.size() != SIZE) {
throw new RuntimeException ("wrong size, size=" + props.size());
for(int i=0; i<SIZE; ++i) {
String key = String.valueOf(i);
String value = props.getProperty(key);
if (!key.equals(value)) {
throw new RuntimeException ("wrong value, expected=" + key + " found=" + value);
System.out.println("load success");
} -
Hi everybody. I have been looking around, but can't find anywhere where you set Java Properties (the one's you get via System.getProperty() ) in the iAS. Our current application has a lot of these properties, and in order for getting it running on the iAS I must be able to specify Java Properties. Does anybody know where I do this (it's an OC4J mod, not JServ).
Regards, Magnus Edevag
[email protected]It's easy - in each OC4J container there is a "server" link (down at the left side). In following screen there are three lines (again at the bottom) - last one is called Java properties. It is where you specify startup parameters for JVM. BTW, you can find them in opmn/conf/opmn.xml. Sometimes, if you hit the wrong button you have to go there and edit directly.
Myrra -
Access java properties from C++/JNI program
Hello all,
Is it possible to access the Java properties of a JNI VM from a C++ program?
If so, could the code or process be explained to me.
I want to be able to identify a specific VM that is retrieved by the JNI_GetCreatedJavaVMs
call. I set a user property when the VM was created, and would like to verify its value
before calling AttachCurrentThread.
Thanks in advance.
MarkAre you saying that you set a system property (via System.setProperty() or -D)?
If so, just use the JNI invocation API to call System.getProperty().
Without error checking, that looks something like this:bool isMySystem( JNIEnv* env ) {
const string PropertyName = "IsMySystem";
jclass systemClass = env->FindClass( "java/lang/System" );
jmethodID getPropertyMethod = env->GetStaticMethodID( systemClass, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;" );
jstring propertyNameString = env->NewStringUTF( PropertyName.c_str() );
jstring propertyString = env->CallStaticObjectMethod( systemClass, getPropertyMethod, propertyNameString );
if ( propertyString == 0 ) {
return false;
const char* property = env->GetStringUTFChars( propertyString, 0 );
boolean isMine = ! strcmp( property, "Yes" );
env->ReleaseStringUTFChars( propertyString, property );
return isMine;
}Using Jace, http://jace.reyelts.com/jace (a free, open-source toolkit), this would look more like:bool isMySystem() {
String property = System::getProperty( "IsMySystem" );
return property.isNull() ? false : prop == "Yes";
}In the end, Jace ends up making all of the exact same calls, but you can see how much easier it is to use.
God bless,
-Toby Reyelts -
Avoid HTML Escapes in Java properties
In using Java properties, I have the following string in the Java property file:
prop1=Click the <a href=#>Help</a> link.
which unfortunately becomes:
Click the & lt ;a href=#>Help & lt ;/a> link.
when the property is printed out (sorry, I put in spaces to have & and ; render correctly).
How should I AVOID having HTML Escape chars put into the property listCome again? besides your question being hardly readable thanks to that formatting, I don't understand it. What do properties have to do with HTML? Properties aren't HTML and Java doesn't convert them.
I don't know what "printing them out" means either. How do you print them where? -
Need help for how to putting arabic content in java properties file
Hi all,
we have to support arabic in Java application.
For that we are using java propeties file where key and value pair is used.
In the Microsoft excel sheet arabic content is coming properly from right to left direction.
When same thing is copied and paste in java properties file contents direction is reversed that is it is coming from left to right as in english.
Please help how to put the arabic contents in propeties file
Regards
VidyaSo in terms discussion.
First I would suggest that you get a hex editor and validate exactly what is in the properties file. It appears to me that you are using one or more editors that are adjusting the display for you and thus that makes it hard to determine where the problem is. A hex editor should not adjust the display. Although even then you might want to right a simple java app and have it read bytes and print them just to validate that the hex editor isn't doing something.
Only after you are exactly sure how the bytes appear in the file then proceed with other steps.
For the java GUI only test the following.
1. Properties file has it left to right then the java GUI displays it correctly right to left or not?
2. Properties file has it right to left then the java GUI displays it correctly right to left or not?
Myself I would expect that 2 should be the correct way to implement this. However that is dependent upon you correctly invoking the api as well. So if 2 is not working then you might want to look at the api. It might also have something to do with GUI display properties (of which I know even less.)
Maybe you are looking for
-
Error while installing ECC 6.0 on Max DB
Hello Basis Experts. I am having the following error: ERROR 2007-07-23 20:46:46 MDB-07020 The database installer reported an error. Some database applications are probably still running. Check the log file sdbinst.log. ERROR 2007-07-23 20:46:46 MUT-
-
What is the "On My Mac" account?
Why do "On My Mac" boxes appear in Mail, and is there any way to get rid of them for good? In Mail 2.0.7, a triangle, signifying nested folders, has begun appearing periodically (and regularly) next to my Junk and Trash mailboxes. Clicking on the tri
-
I'm working on a snapshot of a Fact. The snapshot's purpose is to record changes of columns x,y, and z. If either x,y, or z change in the Fact, a new row should be added to the Snapshot and flag columns for the three columns should read Y or N (depen
-
Use of a microphone to record in a MAC G4
I have a Power Mac G4-867 mghz. this is the unit that has a double mirrored front. I am using Mac O.S. Panther (version 10.3.9). I have tried plugging a microphone at the back of the unit to just hear my voice or better yet to record a song but i jus
-
Sync Lotus Notes for Mac to iCal?
Hey, I'm a Mac User in a mostly PC-based office. Everyone here uses Lotus Notes for Email & Calendar. For a long time I've been able to get away with using Mac Mail and iCal but all email invitations I receive are usually off by a couple of hours due