How do I get the weblogic port # programmatically?
I'm writing a class that uses JND to lookup a data source. I don't want to harcode the port number for the provider URL. The code will run in many different environments where the port numbers are different. A configuration file is not pratical. Since the provider URL is always the URL of the weblogic host I'd like to programmatically retrieve the port number that weblogic is listening and use that. Any ideas?
Hi,
Yes you can get the port number from your applications web.xml file. Define a new env-entry like one similiar below
<env-entry>
<env-entry-name>T3SERVER</env-entry-name>
<env-entry-value>t3://<<Servername>>:7501</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
and in your source code you can access the above property by obtaining initial context and doing a look up for the property name. A sample code would look like
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
strServerUrl = (String) envCtx.lookup("T3SERVER");
Hope this helps
-Jagan
-Jagan
Similar Messages
-
How do I get the Tomcat port using Servlet.
I am running Apache + Tomcat. All request are going though Apache. How do I get the Tomcat port using Servlet.
See:
ServletRequest.getServerPort()This will give the port upon which the request was recieved . . .which I blelieve is what you are looking for. -
How do I get the Weblogic system name in WLS 6.1 sp2 without creating T3Client
Hi Folks,
In Weblogic Server 5.1, I get the weblogic.system.name using the following code:
T3ServicesDef t3services = T3Services.getT3Services();
String systemName t3services.config().getProperty("weblogic.system.name");
What is the counterpart for Weblogic Server 6.1?
Thanks in advance for your help.
BillThe class doesn't seem to be documented in the normal documentation, but
you can get an overview of the methods by executing
javap weblogic.management.Admin
with weblogic.jar in your classpath.
Hope that helps,
Nils
Bill Lam wrote:
>
Jim,
Can you tell me where I can find documentation for
weblogic.management.Admin?
Thank you.
Bill
"Bill Lam" <[email protected]> wrote:
Jim,
Thanks. I appreciate your help.
Bill
Jim Brown <[email protected]> wrote:
Bill:
The weblogic.server.name property in WLS 5.1 has been replaced by the
property weblogic.Name in WLS 6.X. Although it is possible to retrieve
this value by calling System.getProperty(), I would encourage you to
use
the new JMX services which have replaced our proprietary management
interfaces (T3ServicesDef, et. al.). For example, you could write aJMX
client to read the various properties of ServerMBean. To get started,
here is the link to our WebLogic JMX documentation:
Programming WebLogic JMX Services
<http://e-docs.bea.com/wls/docs61/jmx/index.html>
Please post any follow-up questions about JMX to the
weblogic.developer.interest.management.general_and_jmx newsgroup.
Besides writing a JMX client, you can also take advantage of the
following short-cut for retrieving the server name. The remaining code
for this example can be found in your WebLogic Server samples directory
under: ./wlserver6.1/samples/examples/cluster/rmi/HelloClusterImpl.java
private String getLocation(){
String toReturn = null;
try{
toReturn = weblogic.management.Admin.getServerName();
}catch(Exception e){
System.out.println("HelloClusterImpl failed getLocation");
e.printStackTrace();
if(toReturn==null){
return "";
}else{
return toReturn;
Regards,
Jim Brown
Bill Lam wrote:
Hi Folks,
In Weblogic Server 5.1, I get the weblogic.system.name using the followingcode:
T3ServicesDef t3services = T3Services.getT3Services();
String systemName t3services.config().getProperty("weblogic.system.name");
What is the counterpart for Weblogic Server 6.1?
Thanks in advance for your help.
Bill--
Jim Brown
Developer Relations Engineer
BEA Support
============================
[email protected] -
How do I get the charging port cover open on my I-pad, so that I can insert the charger?
I'm trying to connect an Ipad to a USB charger (30 pin, I believe) there is a little black plastic cover over what appears to be the charging port. How do I get this to open ?
There is no charging port cover on the iPad. Do you have a case on your iPad? It may have a cover. If so, you'll need to consult any documentation that came with the case.
-
How do I get the WebLogic server to use the XMLRegistry?
I'm using WebLogic 7.0.2, and I want to use the Apache TransformerFactory and DocumentBuilderFactory
instead of the default weblogic.* classes. I've found the documentation, where
I define an XML Registry as follows (snippet from my config.xml)...
<Server ListenAddress="####" ListenPort="####" Name="myserver"
NativeIOEnabled="true" ServerVersion="7.0.2.0"
StdoutEnabled="true" StdoutSeverityLevel="8"
StuckThreadMaxTime="14400"
XMLEntityCache="XMLCacheMBean_myserver" XMLRegistry="CT XML Registry">
<COM Name="myserver"/>
<ExecuteQueue Name="default" ThreadCount="15"/>
<IIOP Name="myserver"/>
<JTAMigratableTarget Cluster="" Name="myserver" UserPreferredServer="myserver"/>
<JTARecoveryService Name="myserver"/>
<KernelDebug Name="myserver"/>
<Log FileName="myserver/myserver.log" Name="myserver"/>
<SSL Enabled="true" HostnameVerificationIgnored="true"
ListenPort="###" Name="myserver"
ServerCertificateFileName="democert.pem"
ServerPrivateKeyAlias="demokey" ServerPrivateKeyPassPhrase="{3DES}gAuVwsR68oAlLdIfO1PAtw=="/>
<ServerDebug Name="myserver"/>
<ServerStart Name="myserver"/>
<WebServer DefaultWebApp="DefaultWebApp"
LogFileName="myserver/access.log" LoggingEnabled="true" Name="myserver"/>
</Server>
<XMLEntityCache Name="XMLCacheMBean_myserver"/>
<XMLRegistry
DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
Name="CT XML Registry"
SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"
TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl"
WhenToCache="cache-on-reference"/>
I've played aorund with xercesImpl being in and out of classpaths, etc. But no
matter what I do, calls to TransformerFactory.newInstance creates an instance
of weblogic.xml.jaxp.RegistrySAXTransformerFactory and DocumentBuilderFactory.newInstance()
creates an instance of weblogic.xml.jaxp.RegistryDocumentBuilderFactory.
I don't want to use these classes, and supposedly I can control which classes
I will use, but it's not working for me. Has anyone been able to get this working?
Is there anything else that I'm missing?
Thanks,
EdI was unable to use the XMLRegistry touse the Xerces2 libraries with WebLogic 7.
I did find in WebLogic 7 doco that the latest release of Xerces that it would
internally support was 1.4.4 (http://e-docs.bea.com/wls/docs70/xml/xml_admin.html#1066271).
If I wanted to use this version of Xerces, I would need to use WebLogic 8. This
is not an option for me at this stage.
So, I used this approach. When starting the WebLogic server, you can assign ClassPath
entries to an environment variable called PRE_CLASSPATH. This will prepend the
class path used by the App Container's JVM with the values in the variable. I
added the xercesImpl and xalan jars to this entry.
Because the WebLogic class loaders will always defer to the parent class loader,
it will check this class path first. So now I can directly instantiate the apach
implementation classes (typecasting them back to their API interface definitions)
and use them within the container.
"Ed Hillmann" <[email protected]> wrote:
>
I'm using WebLogic 7.0.2, and I want to use the Apache TransformerFactory
and DocumentBuilderFactory
instead of the default weblogic.* classes. I've found the documentation,
where
I define an XML Registry as follows (snippet from my config.xml)...
<Server ListenAddress="####" ListenPort="####" Name="myserver"
NativeIOEnabled="true" ServerVersion="7.0.2.0"
StdoutEnabled="true" StdoutSeverityLevel="8"
StuckThreadMaxTime="14400"
XMLEntityCache="XMLCacheMBean_myserver" XMLRegistry="CT XML Registry">
<COM Name="myserver"/>
<ExecuteQueue Name="default" ThreadCount="15"/>
<IIOP Name="myserver"/>
<JTAMigratableTarget Cluster="" Name="myserver" UserPreferredServer="myserver"/>
<JTARecoveryService Name="myserver"/>
<KernelDebug Name="myserver"/>
<Log FileName="myserver/myserver.log" Name="myserver"/>
<SSL Enabled="true" HostnameVerificationIgnored="true"
ListenPort="###" Name="myserver"
ServerCertificateFileName="democert.pem"
ServerPrivateKeyAlias="demokey" ServerPrivateKeyPassPhrase="{3DES}gAuVwsR68oAlLdIfO1PAtw=="/>
<ServerDebug Name="myserver"/>
<ServerStart Name="myserver"/>
<WebServer DefaultWebApp="DefaultWebApp"
LogFileName="myserver/access.log" LoggingEnabled="true" Name="myserver"/>
</Server>
<XMLEntityCache Name="XMLCacheMBean_myserver"/>
<XMLRegistry
DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
Name="CT XML Registry"
SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"
TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl"
WhenToCache="cache-on-reference"/>
I've played aorund with xercesImpl being in and out of classpaths, etc.
But no
matter what I do, calls to TransformerFactory.newInstance creates an
instance
of weblogic.xml.jaxp.RegistrySAXTransformerFactory and DocumentBuilderFactory.newInstance()
creates an instance of weblogic.xml.jaxp.RegistryDocumentBuilderFactory.
I don't want to use these classes, and supposedly I can control which
classes
I will use, but it's not working for me. Has anyone been able to get
this working?
Is there anything else that I'm missing?
Thanks,
Ed -
How do i get the hdmi port to work with the tv?
I bought an HDMI cable, plugged it into the computer & TV, set the TV to HDMI & the only thing that happene is my display on the laptop got large like it was in the safe mode. As soon as I unplugged the cable from the Laptop, the display on the laptop returned to normal.
I have a HP Pavilion DV9235nr running Vista Premium 32 bit. I can't find anything that tells me how to use my HDMI port properly. Anyone got any ideas????
coot99Hi,
Before go further, please try this Fn+F4 (2 keys together). HDMI should pick up automatically but try Fn+F4 o see how we go.
Regards,
BH
**Click the KUDOS thumb up on the left to say 'Thanks'**
Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. -
How do I get the audio port to work?
I understand that it is a common problem that MacBook Air audio ports behave erratically. I need to make a presentation tomorrow and have both a Soundmatters and a Bose speaker, but the only one that works is my headphone set - Not much use for a group of 20! I've tried rebooting, deleting the bezier file in the preferences Library but to no avail. Simple effective fixes welcome!
Regards,
MartinHey Martin,
Thanks for the question. I understand you are having issues connecting external speakers to your MacBook Air. The following articles may help to resolve your issue:
OS X Lion: If you can’t hear sound from your speakers
http://support.apple.com/kb/PH3837
Mac Basics: Connecting a home stereo, iPod, iPad, musical instruments, or speakers
http://support.apple.com/kb/HT2508
Thanks,
Matt M. -
How to get the WD port number of the actual system?
Hello everybody,
In my application I'm calling a Sap Gui transaction through an ITS WebGUI link that is generated dynamically by an action method. Works find so far.
However, as the code has to run on various systems (development, test, production) I also have to generate the system and port name dynamically. System name is no problem, but how can I get the WD port of the actual system? Is there any method or variable for that? Couldn' find anything so far...
Thanks in advance for any help!Hello,
As Thomas mentioned, you have to use the utility class to construct the URL for any application.
you have two options here
Option 1 -> Prefix your generated WebGUI link with '/' and pass it to the method CL_URL->HOST in the URL parameter. this method will prefix the corresponding http:<host>:port to the passed in URL.
Option 2 -> you can directly use the method CL_URL->ITS to generate your entire web GUI link.
BR, Saravanan -
How to get the page layouts programmatically and create a page for that pagelayout
how get the page layouts programmatically and create a page for that pagelayout and add webpart
please help me with da code.Thanks
adityadugyalaHi if your page layouts alreday created then create new page programaticaaly and apply your page ayouts to that page by coding you can do something like following
PublishingWeb publishingWeb =
PublishingWeb.GetPublishingWeb(web);
PageLayout[] layouts = publishingWeb.GetAvailablePageLayouts();
PageLayout layout = layouts[0];
string pageName =
"MyPublishingPage5.aspx";
PublishingPage newPage = publishingWeb.GetPublishingPages().Add(newFolder.Folder.ServerRelativeUrl +
"/"+ pageName, layout);
newPageUrl = web.Url +"/" + newPage.Url;
newPage.Description = "This my sample publishing page";
newPage.Title = "My Publishing Page";
newPage.Update();
Please follow link
http://blogs.msdn.com/b/sowmyancs/archive/2008/03/15/create-publishing-pages-in-portal-sites-programmatically.aspx
Please mark answer , if you think answer is helpful or correct. -
How can I get the name of weblogic.Server
Hi all,
in my EJBs I want to know, on which server instance I´m running. I need this for
logging info. How can I get the servers name?
When I load the JNDI tree and select java:comp, an error occurs and a lot of information
is printed. One is weblogic.Server and that is what I´m searching for.
I use WLS 6.1 SP1
Any ideas? Thanks,
NicoleUse JMX. See http://dima.dhs.org.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"Nicole" <[email protected]> wrote in message
news:3c4d6daa$[email protected]..
>
Hi all,
in my EJBs I want to know, on which server instance I´m running. I needthis for
logging info. How can I get the servers name?
When I load the JNDI tree and select java:comp, an error occurs and a lotof information
is printed. One is weblogic.Server and that is what I´m searching for.
I use WLS 6.1 SP1
Any ideas? Thanks,
Nicole -
How can I get the height of an UIComponent programmatically?
How can I get the height of an UIComponent programmatically? In my case the component is a Panel Box which has bindings to a backing bean. But it seems the RichPanelBox does not have have method like getHeight()
Use setInlineStyle(java.lang.String inlineStyle) method.
RichPanelBox panelBox;
panelBox.setInlineStyle("height:400px");
Thanks,
Navaneeth -
How to get the server port and id from the Initialcontext
hi
i know that i can get the server port and id where the jndi service is listening from the InitialContext ( when i create InitialContext ic = new InitialContext(); from within a EJB. ). Does this work on any application server and where (at what position is for example the port) in the Enumeration at the ic are the different things put?I would usually just get the PROVIDER_URL property from the InitialContext and use that to determine the location of the naming service:
String providerURL = (String)ic.getEnvironment().get(Context.PROVIDER_URL);You'll then need to parse that string to obtain the port and the server name. For example:
// Assume that the provider URL is of form "protocol://server:port"
int serverStartIndex = providerURL.indexOf("://" + 3);
int serverEndIndex = providerURL.indexOf(:, serverStartIndex);
String server = providerURL.substring(serverStartIndex, serverEndIndex);
String port = providerURL.substring(serverEndIndex + 1);It's a fairly universal approach but there'll doubtlessly be some special cases (for example, the provider URL could be null and the InitialContextFactory class defaults it).
You might have to adjust the server/port parsing stuff a bit as I just made that up and your URL might not conform to the pattern I described.
Hope this helps. -
How can i get the System Time from the other host
I want to get the System Time from the other host in the LAN,How can I get the Time using Java.
Such as I am in WIN 2000 and I have a Unix host in LAN, I want to get unix host System time, How can I do it.Open a socket to port 13 and read a string with the time.
-or-
Open a socket to port 27 and read 4 bytes that are a network order timestamp
Assuming that your UNIX machine has those services running, most do -
How can i get the SMTP IP address for gmail
Hello,
sapian,
I want to schedule a webi document through BI Launch Pad to users email address gmail.So while configuring the AdaptiveJobServer in CMC i need to give SMTP details such as
Domain name:
Host:
Port:
So for scheduling a webi document to a gmail user i need the above details for gmail SMTP server.Can any one suggest me how can i get the above details for gmail SMTP server.
Thanks in advance.
Regards,
Kishor Kumar SHi Hrishikesh,
i have configured the 'stunnel.conf' file with the following details
accept =static ip address of the machine colon port number where the stunnel is installed
connect = smtp.gmail.com:465
and i saved the file.
when i go to
Start->Stunnel->service install
it is giving error as follows
Error binding ssmtp to (ip address and port number which i have given in stunnel.conf file 'accept')
bind: No error (0)
Can you suggest me the solution for the above error.
Thanks in advance,
Regards,
Kishor -
How do I get the os on a new hard drive?
optical drive doesn't work, hard drive crashed. how do I get the os on a new hard drive?
You can connect an external optical drive.
You can use another Mac with a good optical drive together with a Firewire cable if both computers have Firewire ports.
You can have someone clone the installer DVD to an 8 GB USB flash drive.
You can take it to an Apple retailer and see if they will install for you.
Maybe you are looking for
-
If you buy something for money and you delete it, will you get your money back?
Can someone please answer?
-
How to install e business suite on linux 32 bit?
Hi All, Can any body direct me how to install e business suite on linux 32 bit env. Thanks.
-
Best Solution for Archiving Table data
Hi All, I have a table with huge data. It is not partitioned table. On an average per day 10000 records will be inserted into this table. Now I want to archive(backup) every one years data manually and keep in safe location and hence delete those arc
-
Bridge/PS Cannot Read RW2 Converted to dng.
I have Windows XP (it's a work PC and company policy to stick with XP). Bridge v2.1.1.9, DNG Converter v5.7.0.213, PS CS3 Extended v10.0.1. Neither PS or Bridge can read my Panasonic RW2 files. I downloaded the latest version of DNG Converter and co
-
10.4.9 and FireWire instability
After updating (DiskPermissions, ComboUpdater, DiskPermissions), I have notized both FireWire and Finder instability. FireWire loses mounted volumes/printers and after that the Finder doesnt response forcing me to use the PowerButton powe-off. Has an