• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

start weblogic server within java code

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From edoc.bea.com, I got:

====
...
The following sections describe alternate ways to start an Administration Server:

Starting an Administration Server from the Windows Start Menu
Starting an Administration Server When the Host Computer Boots
Starting an Administration Server With the java weblogic.Server Command
...
====

Could we start weblogic server with java code?
Something like ServerLoader provided by JBoss?

Thanks in advance.

-Kevin
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kevin Huang:

Could we start weblogic server with java code?



You could make use of Runtime.exec() and call the script. But be sure you read this before: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Alternatively, you could write a code which does the same thing as the startup script.
 
Annie Smith
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course, I have some doubts about how this would be of some use.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The weblogic.Server command is a Java class. Another option is to build the arguments manually, and call the main() method of the weblogic.Server class. Just don't forget to add the correct weblogic jar into your classpath.

Henry
 
Kevin Huang
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.

-Kevin
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the weblogic.Server command can you give interactively username,password,portnumber .
when you provide these the weblogicserver should be started
if so tellme how to do this
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by pvsr rao:
In the weblogic.Server command can you give interactively username,password,portnumber .
when you provide these the weblogicserver should be started
if so tellme how to do this



Calling the weblogic.server class directly is an alternate way to start weblogic. Kevin is doing it this way because he wants to start it programmatically from Java.

In your case, why are you considering it, instead of using the standard scripts?

Henry
 
pvsr rao
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have the situation like this.
i have gui which contains textfields,label and button
in different textfields you should enter domainname,servername,username,password
and when you click a button named create it should automatically starts a server with specified domainname,servername,config.xml name ,password and username.please tell me how can we do it
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by pvsr rao:
i have the situation like this.
i have gui which contains textfields,label and button
in different textfields you should enter domainname,servername,username,password
and when you click a button named create it should automatically starts a server with specified domainname,servername,config.xml name ,password and username.please tell me how can we do it



You can use the Ant task from your java program to start the WLS.

This is the workaround not the solution.

As far as I know When WLS will starts up it also start the DEBUGGER, PointBase, Portal Search Engine. apart from this it will initilize the classpath varibale with the requried jars files.

you can call classes of Ant task into your java program.

http://forum.java.sun.com/thread.jspa?threadID=650552&messageID=3826282
 
pvsr rao
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
we should not use any ant task.from the java program when i give the domainname,servername,username,password etc,weblogicserver should be started with specified parameters.please tell me how to do it
 
pvsr rao
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we do like this to start weblogicserver from java program

public class serv
{
public void main(String args[])
{
try
{
Class.forName("weblogic.Server");
Runtime r=Runtime.getRuntime();
Process p=null;


//p=r.exec(s.main(new String[]{}));
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
if not please send me how to do this
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMO, directly calling the main method of the weblogic.Server class should only be done, if you are doing simple setup, and then handing off control to the class.

Otherwise, I suggest that you exec "startWeblogic.???" script that was generated for your domain. Just figure out how you would do it from the command line, and exec() the same command from java.

BTW, I don't mean to seem dodgy, but the location of the script is dependent on how the domain is configured. And how the script works is dependent on the version of Weblogic that you are using.

Henry
 
reply
    Bookmark Topic Watch Topic
  • New Topic