Default access specifiers for void main()
I m having one problem that if i make void main(String a[])
syntax like private static void main(String args[]) and run using jdk1.4 it will run. So my question is that why this is possible still i making main() private. If i run it in jdk1.5.0 then it give error main is not public so what was the problem with the jdk1.4?
Congratulations on your first post after almost 2
years. ?The most impressive thing is that he remembered his
password ...I posted by first message in 2004, I only used this account to read the bugdatabase and vote on bugs prior to that. So I don't see anything strange in having an account, and not using the forums.
Kaj
Ps. But I'm also impressed by the fact that he remembered the password, I had an account which I created in -97, but I forgot the password to that account :(
Similar Messages
-
Hello Experts,
I am configuring the scenario ( AS2 to EDISeparator and EDISeparator to IDOC ).
Can you please help me with the error below which is from the either the EDISeparator Receiver channel or the EDISeparator Sender channle.
09.06.2014 17:52:18.709
Information
Message is encrypted with 1.3.14.3.2.7 algorithm
09.06.2014 17:52:18.778
Information
AS2 Message is signed with SHA1 (1.3.14.3.2.26) algorithm
09.06.2014 17:52:18.779
Information
AS2 Message message signature is validated, signer ID is X509CertSelector: [ Serial Number: 1624063516 Issuer: CN=Mendelson AS2 TEST,OU=Integration,O=Mendelson,L=Berlin,ST=Unknown,C=GE matchAllSubjectAltNames flag: true ]
09.06.2014 17:52:18.784
Information
AS2 document size is 350 Bytes
09.06.2014 17:52:18.784
Information
Payload charset converted from ISO-8859-15 to ISO-8859-15
09.06.2014 17:52:18.785
Information
B2B EdifactConverterModule : EDI format detected as EANCOM
09.06.2014 17:52:18.785
Information
B2B EdifactConverterModule: Message will be read as ISO-8859-1.
09.06.2014 17:52:18.785
Information
MP: processing local module localejbs/EdifactConverterModule
09.06.2014 17:52:18.785
Information
0}: The module-paramteter "eancom.subversion.prefix" is not set. Using default value "false"
09.06.2014 17:52:18.786
Information
0}: The module-paramteter "eancom..audit" is not set. Using default value "false"
09.06.2014 17:52:18.791
Information
MP: processing local module localejbs/CallSapAdapter
09.06.2014 17:52:18.791
Information
Application attempting to send an XI message asynchronously using connection AS2_http://sap.com/xi/XI/AS2
09.06.2014 17:52:18.792
Information
Trying to put the message into the send queue
09.06.2014 17:52:18.831
Information
Message successfully put into the queue
09.06.2014 17:52:18.831
Information
The application sent the message asynchronously using connection AS2_http://sap.com/xi/XI/AS2. Returning to application
09.06.2014 17:52:18.836
Information
MIC (DeJYUIusqQj6aaYRASdHhAo+4J0=) is calculated using SHA1 algorithm.
09.06.2014 17:52:18.838
Information
The message was successfully retrieved from the send queue
09.06.2014 17:52:18.843
Information
Message status set to DLNG
09.06.2014 17:52:18.845
Information
MDN is succcessfully signed with SHA1 (1.3.14.3.2.26) algorithm
09.06.2014 17:52:18.859
Information
Trying to put the message into the send queue
09.06.2014 17:52:18.912
Information
Message successfully put into the queue
09.06.2014 17:52:18.913
Information
The message was successfully retrieved from the send queue
09.06.2014 17:52:18.918
Information
Message status set to DLNG
09.06.2014 17:52:18.961
Information
Trying to put the message into the send queue
09.06.2014 17:52:19.001
Information
Message successfully put into the queue
09.06.2014 17:52:19.001
Information
The message was successfully retrieved from the send queue
09.06.2014 17:52:19.006
Error
MP: exception caught with message No configuration / default adapter specified for EDISeparator
09.06.2014 17:52:19.006
Information
Delivering to channel: B2BSE00002_O2C_ORDERS_VANS_PO_WRITE_EDISeparator
09.06.2014 17:52:19.006
Information
Message status set to DLNG
09.06.2014 17:52:19.009
Error
Exception caught by adapter framework: No configuration / default adapter specified for EDISeparator
09.06.2014 17:52:19.010
Error
Transmitting the message to endpoint <local> using connection AS2_http://sap.com/xi/XI/AS2 failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: No configuration / default adapter specified for EDISeparator
09.06.2014 17:52:19.015
Information
The asynchronous message was successfully scheduled to be delivered at Mon Jun 09 17:57:19 CEST 2014
09.06.2014 17:52:19.015
Information
Message status set to WAITHello Ruchir Sinha and Dimitri Sannen,
I think I have progressed a bit. Just unsure of the usage of the Module configuration .I now get a new error (see below) and the updated config details are :
Sender Interface :
Receiver Interface :
Sender AS2 config :
Receiver EDISeparator config :
Sender EDISeparator config :
Receiver IDOC config :
IDoc details configured but not added in this document
16.06.2014 11:52:35.414
Information
The message was successfully retrieved from the send queue
16.06.2014 11:52:35.420
Information
Delivering to channel: B2BSE00002_O2C_ORDERS_VANS_PO_WRITE_EDISeparator
16.06.2014 11:52:35.420
Information
MP: processing local module localejbs/ModuleProcessorExitBean
16.06.2014 11:52:35.420
Information
Message entered AF MP exit bean and will now be passed to the JCA adapter
16.06.2014 11:52:35.420
Information
Message status set to DLNG
16.06.2014 11:52:35.433
Information
UNA segment UNA found
16.06.2014 11:52:35.444
Information
Parsed UNB segment 333333333/014 to 111111111/014
16.06.2014 11:52:35.445
Information
Parsed UNH segment ORDERS D96A
16.06.2014 11:52:35.514
Information
Searching sender channel for Eancom message part message with Message type ORDERS, Message version number D, Message release number 96A, Interchange sender identification 333333333, Interchange sender identification code qualifier 014, Interchange recipient identification 111111111, Interchange recipient identification code qualifier 014, Message Subversion EAN008, Message Agency UN
16.06.2014 11:52:35.579
Information
Sender channel (Channel) keys: ObjectId=7abf551ddbb638268f91af80ec1c04c8 values: ToPartySchema= Attributes=(Attributes:Channel:EDISeparator:INBOUND) values: edisep.advanced=false snd.interchangeSenderId=.* snd.tradacommessagetype=.* snd.xpath= snd.xpath.value= snd.filterCondition=equal snd.edifactMessageReleaseNumTxt= snd.tradacomMessageTypeUsingFreeText=false snd.eancomMessageReleaseUsingFreeText=false snd.eancomMessageVersionFreeText= snd.odetteMessageType=.* snd.edifactMessageVersion=.* snd.xml.splitPath=null snd.eancomMessageVersion=.* snd.odetteMessageVersion=.* snd.edifactMessageRelNumUsingFreeText=false snd.otherVersionReleaseIndustryIdentifierCodeEnabled=false adapterStatus=active snd.vdaMessageType=.* snd.eancomCONTRLMessageRelease=3 snd.odetteMessageTypeTxt= snd.tradacommessageversion=.* snd.edifactMessageVerNumUsingFreeText=false snd.edifactMessageTypeUsingFreeText=false snd.xpathUsingFreeText=false snd.interchangeSenderIdCode=.* snd.otherVersionReleaseIndustryIdentifierCode=.* snd.odetteMessageTypeUsingFreeText=false snd.tradacomreccode=.* snd.edifactMessageVersionFreeText= snd.edifactInterchangeRecipientIdentification=.* eoio.sequenceId= snd.edifactMessageTypeTxt= snd.odetteMessageVerNumUsingFreeText=false snd.eancomMessageVerNumUsingFreeText=false snd.interchangeReceiverId=.* snd.eancomMessageRelease=.* snd.tradacomsendername=.* snd.tradacomMessageTypeTxt= snd.vdaLieferantenNummer=.* snd.interchangeReceiverIdCode=.* snd.edifactInterchangeSenderIdentificationCode=.* snd.odetteMessageVersionFreeText= snd.versionReleaseIndustryIdentifierCode=.* snd.edifactInterchangeSenderIdentification=.* snd.edifactMessageType=.* snd.eancomMessageType=.* snd.xpathTxt= snd.vdaMessageTypeTxt= deliverySemantics=eo snd.eancomMessageReleaseTxt= snd.plainmessagetype=.* snd.xml.split=false snd.edifactMessageRelease=.* snd.vdaMessageTypeUsingFreeText=false snd.tradacomrecname=.* edisep.addParameterParams=TableData: edisep.addParameterParams {} snd.encoding=iso885915 snd.vdaKundenNummer=.* snd.tradacomsendercode=.* snd.edifactCONTRLMessageRelease=3 snd.edifactInterchangeRecipientIdentificationCodeQualifier=.* snd.transactionSetIdentifierCode=.* Service=ASJAVA_DX5 Channel=B2BSE00002_O2C_ORDERS_PO_ECC_READ_EDISeparator EngineType=CA Party= TransProt=XI TransProtVers=1.0.0 FromPartySchema= FromPartyAgency= Direction=I MsgProt=EANCOM MsgProtVers=1.0.0 EngineName= AdapterType=EDISeparator AdapterSWCV=06c536e6fafe11e0bb1cea8f0a4290b1 ToPartyAgency= AdapterNamespace=http://sap.com/xi/XI/EDISeparator found. New message ID is f18894a8-f53b-11e3-a748-00001e96c7e2
16.06.2014 11:52:35.586
Error
MP: exception caught with cause javax.resource.ResourceException: com.sap.aii.adapter.ediseparator.ra.integration.DispatchException: Message cannot be dispatched: Message cannot be dispatched: Error during processing local class: localejbs/GenericConverterModule
16.06.2014 11:52:35.586
Error
Message could not be forwarded to the JCA adapter. Reason: com.sap.aii.adapter.ediseparator.ra.integration.DispatchException: Message cannot be dispatched: Message cannot be dispatched: Error during processing local class: localejbs/GenericConverterModule
16.06.2014 11:52:35.590
Error
Exception caught by adapter framework: com.sap.aii.adapter.ediseparator.ra.integration.DispatchException: Message cannot be dispatched: Message cannot be dispatched: Error during processing local class: localejbs/GenericConverterModule
16.06.2014 11:52:35.591
Error
Transmitting the message to endpoint <local> using connection AS2_http://sap.com/xi/XI/AS2 failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: javax.resource.ResourceException: com.sap.aii.adapter.ediseparator.ra.integration.DispatchException: Message cannot be dispatched: Message cannot be dispatched: Error during processing local class: localejbs/GenericConverterModule -
HI
What is the default access specifier in Java?
Is it default or package-private?
What is the heirarchy of access specifiers?
Thankshttp://www.google.com/search?q=java+access+specifiers
-
Access specifiers for interface methods
When we implement the interface ,we have to specify the implementing method access specifier to be "PUBLIC" ,but not "PROTECTED" or "PRIVATE".
Compiler is giving an error -- attempting to assign weaker access privileges ,when we specify protected.
what is the internal reason for this?Why we shouldnt make the access weaker in the implementing class.
Can any one help me on this.Your help is highly appreciated.When we implement the interface ,we have to specify
the implementing method access specifier to be
"PUBLIC" ,but not "PROTECTED" or "PRIVATE".
Compiler is giving an error -- attempting to assign
weaker access privileges ,when we specify protected.
what is the internal reason for this?There is absolutely no point in having a private interface method. The interface represents a visible abstraction and private methods are never visible so it is a contradiction in terms.
An interface is intended to represent an abstraction that a user (software) uses. Protected via child/parent represents a usage that is restricted to a child from a parent. The child can already see the parent so there is no point in having an abstraction for the child. And it would probably be unwise to limit a child by such an abstraction.
Protected via the package and interfaces is more contentious as to why it is not allowed. There are those that argue that this should be allowed so that a package can use interfaces but restrict them to the package. To me this seems like a minor point given that most interfaces will probably represent an abstraction to other packages and not within a single package. This applies specifically to default access as well. -
Why we can't declare private or protected for a class as access specifier.
Can you give me an example on it.This is the third time someone asked something like this today:
http://forum.java.sun.com/thread.jspa?threadID=664848 (where someone references your post on JavaRanch).
http://forum.java.sun.com/thread.jspa?threadID=664790 -
I am trying to control my main wireless network with access control via mac id with no password. I wanted a separate guest network with password access and no access control. However, the only way that the guest network works is if I specify unlimited access as the default. Is what I am trying to do possible.
I am trying to control my main wireless network with access control via mac id with no password.
Definitely not a recommended method for security. MAC addresses are easily cloned by anyone who wants to do so with free tools available on the Internet. An unwanted guest will be on your network in less than a minute if they want to be.
Strongly recommend that you use WPA2 Personal security with a non-dictionary password to protect your network.
I wanted a separate guest network with password access and no access control. However, the only way that the guest network works is if I specify unlimited access as the default. Is what I am trying to do possible.
Unfortunately, Apple does not allow separate Access Control for the "main" and "guest" networks. It's all or nothing, I am afraid.
Likely, the "best" way to set up Access Control is change the default rule to No Access, Then you will need to enter in the details for every device that you want to allow to connect for both the "main" and "guest" networks with the time limits for each device. -
Hi,
Can anybody tell me as to why we use the public access specifier in the main method as a standard.I have tried out the other access specifiers in the main method and it works fine.
[please note i do understand the relevance of each access specifier in other contexts.]
tubbyIt's supposed to be public because the JVM specification says so, but, yeah, you can use more restrictive access modifiers (that is to say, the compiler will permit more restrictive modifiers). Sun doesn't consider the issue an open bug, but you can read the discussion on the issue here: http://developer.java.sun.com/developer/bugParade/bugs/4252539.html
-
About access specifiers (inheritance)
abstract Class A
abstract public add();
Class B extends A
protected add() //this wont work
//some code here
The access specifier for add method in A is public ,and in B is protected.This is not allowed by compiler.
Why cant we make the access weaker in the sub class?What is the drawback in allowing to make the access weaker.Because any class that uses class A has the right to expect to use the add() method, since it is public in A. Since B is an A, it must allow some one to use an instance of B as if it were an A.
-
My java program runs fine even if i don't specify access specifier of class
Hi,
My java program runs fine even if i don't specify access specifier of class as public .
Then why do they say that atleast one class should be specified as public.
please help.public access specifier is the default access
specifier
so if you dont give the access specifier before the
class name it is not wrong.I think that you are wrong. The default specifier is package or "package-private".
See here:
http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html
Message was edited by:
petes1234 -
I have just upgraded to iTunes 10.5.1.42 (from 10.5.0.143).
When iTunes is launched, a message from iTunes came up saying:
iTunes has detected that it is not the default player for audio files. Do you want to make iTunes the default player for audio files?
[ ] Do not show this message again
[ Yes ] [ No ]
Clicking the Yes button, another iTunes message appears:
An error occurred while updating the default player for audio file types. You do not have enough access privileges for this operation.
[ OK ]
I found in Googles as well as from some of my own notes dated a few years back which others (and myself) encountered the same problem before. I don't recall what was the solution to this annoying problem. Maybe I should just check the first box and tell iTunes to "shut up"? It seems that iTunes is already the default program designated to open audio files like MP3, WAV or what not. Why does it need to be set as the default player again?
Come to think about it, I do have a few files with .aup as extension. These were played with "audacity". Perhaps that upsets iTunes player?Hello magestecal,
Thanks for using Apple Support Communities.
To troubleshoot this issue where you're getting a permissions error when trying to sync your iPhone, I'd like you to please follow the steps in the article below.
iTunes: Missing folder or incorrect permissions may prevent authorization - Apple Support
Take care,
Alex H. -
Specifying access rights for page tabs
Hello
I have trouble with specifying access rights for tabs that are inside another tab.
I have a group named "Customers" and a group for each of our customer companies. The company-groups are all members of the Customers group.
Then i created a tab called "Customers" which i specified access rights to the Customers group.
Under the customers tab, i created one tab for each customer and i've specified access rights to each tab.
I want to accomplish that customers who log into the portal only are able to see theyr own tab, but this doesn't seem to work properly.
Have anyone had this problem before?
Regards
Per-Jarle SftherPer-Jarle,
Are you sure that the users are not part of a group that is included in the group you gave access to on the tab?
Rich -
Access Specififer for main Method
Dear all,
In JDK1.2.2 if I give private access modifier to the main method,its working.
But in JDK 1.3,it displays "Main method not public".
what could be the reason?Please don't post the same question multiple times. It's annoying.
Please don't post the same question multiple times. It's annoying.
Please don't post the same question multiple times. It's annoying.
Please don't post the same question multiple times. It's annoying.
http://forum.java.sun.com/thread.jsp?thread=341247&forum=33&message=1404079
http://forum.java.sun.com/thread.jsp?thread=341187&forum=33&message=1403858
http://forum.java.sun.com/thread.jsp?thread=341186&forum=33&message=1403857
Especially within the same Forum. -
Fwd'ing to security newsgroup
-------- Original Message --------
Subject: Client accessing MBeanHome for more than one domain receives
SecurityException
Date: 4 Mar 2004 07:27:33 -0800
From: Dinesh Bhat <[email protected]>
Reply-To: Dinesh Bhat <[email protected]>
Organization: BEA NEWS SITE
Newsgroups: weblogic.developer.interest.management
Hi,
When a client accesses MBeans of more than one domains (Weblogic 8.1)
that have
different passwords, it receives a SecurityException. This occurs when
the MBeanHome
for each domain is looked up at initialization and reused for each
request ( to
access MBeans ). The security exception does not occur if the MBeanHome
for each
domain is looked up for each request. On initial review, this behavoir
seems inconsistent.
Looking up the MBeanHome for each request may introduce a significant
overhead.
I am not sure if concurrent lookups would also cause the same problem.
I have read on another post that we can work around this problem by
establishing
a trust relationship between the servers, but this may not be feasible
when one
is monitoring a lot of servers and the overhead of configuration may be
an issue.
I have attached code that can reproduce the problem.
Please advise on the correct approach.
Thanks
Dinesh Bhat
Panacya Inc.
import java.util.ArrayList;
import java.util.Set;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Hashtable;
import javax.management.MBeanServer;
import javax.naming.Context;
import weblogic.jndi.Environment;
import weblogic.management.MBeanHome;
* This class reproduces the Security Exception that is caused when a client tries to access
* MBeans of more than one domain with different weblogic passwords. Here is the stacktrace of the
* exception
* java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:138)
at weblogic.management.internal.AdminMBeanHomeImpl_811_WLStub.getDomainName(Unknown Source)
at WLSecurityTest.getWeblogicInfo(WLSecurityTest.java:140)
at WLSecurityTest.runTest(WLSecurityTest.java:75)
at WLSecurityTest.<init>(WLSecurityTest.java:66)
at WLSecurityTest.main(WLSecurityTest.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Caused by: java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:682)
at weblogic.rjvm.MsgAbbrevInputStream.getSubject(MsgAbbrevInputStream.java:181)
at weblogic.rmi.internal.BasicServerRef.acceptRequest(BasicServerRef.java:814)
at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:299)
at weblogic.rjvm.RJVMImpl.dispatchRequest(RJVMImpl.java:920)
at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:841)
at weblogic.rjvm.ConnectionManagerServer.handleRJVM(ConnectionManagerServer.java:222)
at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:794)
at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:570)
at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:105)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
* Note: the exception is caused only when the MBeanHome for each domain is cached and used for subsequent
* transactions. The exception does not occur if the MBeanHome for each domain is looked up for each transaction. This
* would significant overhead in practice. Also the transactions across the various domains occurs serially, hence
* the effect of concurrent lookups has to be tested.
* Usage:
* This class has been tested with weblogic 8.1
* The class needs weblogic.jar in its classpath
* One can specify the weblogic details as System properties. The properties need to be specified in
* the following format:
* wls.host.n, wls.userId.n, wls.password.n where n is the weblogix instance number. Also specify
* the boolean system property reconnect.each.iteration to toggle between reconnecting or not reconnecting
* for each iteration. When not reconnecting for each iteration, the MBeanHome is reused and the Security Exception
* occurs.
* Following is the example of system properties
* -Dwls.host.0=localhost:7001 -Dwls.userId.0=weblogic -Dwls.password.0=weblogic
* -Dwls.host.1=localhost:7011 -Dwls.userId.1=weblogic -Dwls.password.1=weblogic1
* -Dwls.host.2=localhost:7021 -Dwls.userId.2=weblogic -Dwls.password.2=weblogic2
* -Dreconnect.each.iteration=false
public class WLSecurityTest
ArrayList wlsDetailsList = new ArrayList();
HashMap connectionMap = new HashMap();
public static void main(String[] args)
try
WLSecurityTest wlSecurityTest = new WLSecurityTest();
catch (Exception e)
e.printStackTrace();
* Constructor
* @throws Exception
public WLSecurityTest() throws Exception
int noOfTries = 10;
getWLSDetails();
for( int i=0; i <= noOfTries; i++)
runTest();
* Runs the test
private void runTest()
for (int i = 0; i < wlsDetailsList.size(); i++)
WLSDetails wlsDetails = (WLSDetails) wlsDetailsList.get(i);
getWeblogicInfo(wlsDetails);
* Get Weblogic details from System properties
* @throws Exception
private void getWLSDetails() throws Exception
wlsDetailsList = new ArrayList();
String hostKeyTmpl = "wls.host";
String userIdKeyTmpl = "wls.userId";
String passwordKeyTmpl = "wls.password";
boolean done = false;
for (int i = 0; !done; i++)
WLSDetails wlsDetails = new WLSDetails();
String hostKey = hostKeyTmpl + "." + Integer.toString(i);
String userIdKey = userIdKeyTmpl + "." + Integer.toString(i);
String passwordKey = passwordKeyTmpl + "." + Integer.toString(i);
wlsDetails.hostName = System.getProperty(hostKey);
done = (wlsDetails.hostName == null) || (wlsDetails.hostName.length() == 0);
if (!done)
wlsDetails.userId = System.getProperty(userIdKey);
wlsDetails.password = System.getProperty(passwordKey);
connect(wlsDetails);
wlsDetailsList.add(wlsDetails);
* Lookup the MBeanHome for the specified weblogic server
* @param wlsDetails
* @throws Exception
public synchronized void connect(WLSecurityTest.WLSDetails wlsDetails) throws Exception
Context ctx = null;
MBeanHome mbHomeLocal = null;
try
Environment env = new Environment();
env.setProviderUrl("t3://" + wlsDetails.hostName);
env.setSecurityPrincipal(wlsDetails.userId);
env.setSecurityCredentials(wlsDetails.password);
Hashtable hashtable = env.getProperties();
System.out.println(hashtable.toString());
ctx = env.getInitialContext();
wlsDetails._mBeanHome = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
catch (Exception e)
e.printStackTrace();
* Gets weblogic information using MBeans
* @param wlsDetails
public synchronized void getWeblogicInfo(WLSDetails wlsDetails)
try
boolean reconnectEachIteration =
Boolean.getBoolean("reconnect.each.iteration");
if( (reconnectEachIteration) || ((wlsDetails._mBeanHome == null) && (!reconnectEachIteration) ))
connect(wlsDetails);
MBeanHome mbHomeLocal = wlsDetails._mBeanHome;
String domainName = mbHomeLocal.getDomainName();
Set allMBeans = mbHomeLocal.getAllMBeans();
System.out.println("Size: " + allMBeans.size());
Set clusterMBeans = mbHomeLocal.getMBeansByType("Cluster", domainName);
System.out.println(clusterMBeans);
MBeanServer mBeanServer = mbHomeLocal.getMBeanServer();
catch (Exception ex)
ex.printStackTrace();
* Class that holds weblogic server details
class WLSDetails
String hostName = "";
String userId = "";
String password = "";
MBeanHome _mBeanHome = null;If Server version is 61.
Make user "system" password of all weblogic servers same.
If Server version above 61(70,81)
In the Security Advanced Settings un check generated credential and specify a common credentail for all the weblogic servers(domains). -
Default page size for printing
Is there a way to configure (i.e., specify non-programatically) the default page size to use when printing in Java? We have several JREs installed on a single Solaris machine. It seems that all but the one that came installed with the OS defaults to a an ISO-A4 page size.
I wrote a test program (see end of post) and compiled using a 1.2.2 JDK. Here are some results:
$ /usr/java/bin/java -cp . PrintPageFormat
Java version: 1.2.2
Page size: 612.0 x 792.0 pts
$ /opt/java-packages/jre-1.4.0_04-solaris-i586/bin/java -cp . PrintPageFormat
Java version: 1.4.0_04
Page size: 595.0 x 842.0 pts
$ /opt/java-packages/jre-1.4.2_08-solaris-i586/bin/java -cp . PrintPageFormat
Java version: 1.4.2_08
Page size: 595.0 x 842.0 pts
$ /opt/jre-1.5.0_04-solaris-i586/bin/java -cp . PrintPageFormat
Java version: 1.5.0_04
Page size: 595.2755813598633 x 841.8897399902344 pts
I've searched the Internet, but cannot find how to go about setting the default page size for a JRE. I've opened a ticket with Sun, and was told you can't do this other than programatically. It seems unreasonable that I would have to recompile my existing applications just to get them to work correctly under newer JREs. Is Sun's response to my ticket correct???
Thanks in advance!
Chris Rorvick
[email protected]
============================================================
import java.awt.print.*;
public class PrintPageFormat
public static void main(String[] args)
PrinterJob pj = PrinterJob.getPrinterJob();
PageFormat pf = pj.defaultPage();
double w = pf.getWidth();
double h = pf.getHeight();
String version = System.getProperty("java.version");
System.out.println(" Java version: " + version);
System.out.println(" Page size: " + w + " x " + h + " pts");
}This problem was fixed by setting the locale variable LC_CTYPE to "C" or "en_US". The JREs 1.4.0 and above deployed on our Linux and Solaris environments all have the system property 'java.awt.printerjob' set to 'sun.print.PSPrinterJob'. This is a subclass of sun.print.RasterPrinterJob which in turn is a subclass of java.awt.print.PrinterJob. So, PSPrinterJob is the actual class of the PrinterJob returned by PrinterJob.getPrinterJob(). Looking at the code of RasterPrinterJob:
/* Default to A4 paper outside North America.
String defaultCountry = Locale.getDefault().getCountry();
if (!Locale.getDefault().equals(Locale.ENGLISH) && // ie "C"
defaultCountry != null &&
!defaultCountry.equals(Locale.US.getCountry()) &&
!defaultCountry.equals(Locale.CANADA.getCountry())) {
double mmPerInch = 25.4;
w = Math.rint((210.0*ptsPerInch)/mmPerInch);
h = Math.rint((297.0*ptsPerInch)/mmPerInch);
newPaper.setSize(w, h);
newPaper.setImageableArea(ptsPerInch, ptsPerInch,
w - 2.0*ptsPerInch,
h - 2.0*ptsPerInch);
}This should have been fairly obvious. Java's locale settings depend on the platform's locale settings (i.e., LC_ variables in this case), and then the default page size is determined (or actually altered) based on that.
I'm kicking myself for not figuring this out much sooner. I would hope Sun is, too! (not me, themselves) -
Problem with access specifier and static???
I've a question. I saw a code written for Sun's Java Tutorial. The program had three class methods and all of them start like this:
static public void methodName1{
static public void methodName2{
and
static public void main(String[] args){
My question is why the keyword static was used first? Why not access specifier? I mean what's the reason behind it? Is there any difference between them?
Thanks in advance.
--DMThe order doesn't matter. The programmer thought it was a good idea for some reason. I might be tempted to do it if I had static and instance methods with the same name or something like that.
public static void myMethod() {
public void myMethod() {
or
static public void myMethod() {
public void myMethod() {
Maybe you are looking for
-
Hyperion planning installation(Problem with application server deployment)
Hi There: I am new to hyperion planning.I am trying to install planning.I got problem with Hyperion Configuration utility while configuring application server deployment.Its show message failed.Please guide me how to fix this.If it is possible can yo
-
Zen Vision:M 60GB firmware: NEEDS 'Disc Number' tag supp
The Creative Zen Vision:M 60GB firmware (.20.02e) does not recognise the 'Disc Number' part of ID3 tags. This is VERY annoying as albums made up of more than one CD do not play in the correct order (they play in order of 'Track Number', e.g. ",,,,2,2
-
Dual Monitor XFCE on a Laptop?
I managed to get it up and running but is there an app or something that makes it easier to disconnect and reconnect my laptop to the secondary monitor without having to restore all the settings everytime i decide that i want to move my laptop away f
-
Strange arrow in icon bar [N72]
I have recently discovered a strange icon in the icon bar (next to bluetooth) It looks like this: The / has an arrow shape. Ik found some other topics were the Outbox and Redirecting calls were mentioned. I cleared all my messages, (except some files
-
Execute SQL Tasks Failing for Duplicate Syntax Between DEV and Production DB
Newbie here...be patient with me! I added tasks to refresh two tables (delete from, insert into, update) to an SSIS project . I have them running from the WinXP scheduler. The issue: In dev the tasks integrate and execute successfully from scheduler