WebLogic + JBuilder 开发的问题

chenweionline 2004-03-16 12:15:29
我最近在学习《J2EE应用开发(WebLogic+JBuilder)》,第四章的WebLogic Server下有个JDBC开发实例,原例题操作的是JBuilder自带的数据库employee.jds,我现在把它改写成了操作Oracle数据库中的表emp。我按书中内容已经在WebLogic中设置好了连接池、数据源;在JBuilder中也配置了要使用的应用服务器信息并添加了Oracle的数据库驱动程序。我在JBuilder外启动WebLogic Server,再将执行类型设成Application,运行,得到结果正常;可是停止WebLogic Server后,我将执行类型设成Server,再运行,就报以下错误,为什么?怎么解决?执行类型设成Application或Server有什么区别?用JBuilder结合WebLogic开发,在JBuilder中也配置了要使用的应用服务器信息并添加了Oracle的数据库驱动程序,是不是就不需要在外面启动WebLogic Server?我初学J2EE,还盼详解,谢谢了。

//-------------------- 程序 ---------------------------

import java.sql.*;
import javax.naming.*;
import javax.sql.*;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;

public class u4_01 {
public u4_01() {
}

public static void main(String [] args){
DataSource ds = null;
Context ctx = null;
Connection myConn = null;

try{
/* 获得 WebLogic Server JNDI 初始上下文信息 */
ctx = getInitialContext();
/* 建立数据源对象 */
ds = (javax.sql.DataSource)ctx.lookup("myOracleDataSource");
}
catch(Exception E){
System.out.println("Init Error");
}

Statement myStatement = null;
ResultSet myResultSet = null;

try{
// 建立连接
myConn = ds.getConnection();
// 建立语句对象
myStatement = myConn.createStatement();
// 建立结果集对象
myResultSet = myStatement.executeQuery("SELECT ENAME FROM emp");

// 遍历结果集对象,访问每一条纪录,输出 ENAME 字段
while(myResultSet.next())
{
System.out.println("the emp ENAME is: " + myResultSet.getString("ENAME"));
}

// 关闭结果集
myResultSet.close();
}
catch(SQLException e){
System.out.println("Error code = " + e.getErrorCode());
System.out.println("Error message = " + e.getMessage());
}
finally{
try{
// 关闭语句对象
if(myStatement != null){
myStatement.close();
}
// 关闭连接
if(myConn != null){
myConn.close();
}
}
catch(SQLException e){
System.out.println("Error code = " + e.getErrorCode());
System.out.println("Error message = " + e.getMessage());
}
}
}

private static Context getInitialContext() throws Exception{
String url = "t3://localhost:7001";
String user = "system";
String password = "security";
Properties properties = null;

try{
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL,url);

if(user != null){
properties.put(Context.SECURITY_PRINCIPAL,user);
properties.put(Context.SECURITY_CREDENTIALS,password ==null ? "" : password);
}
return new InitialContext(properties);
}
catch(Exception e){
throw e;
}
}
}




//-------------------- 运行类型为 Server 时的出错信息 --------------------------

C:\bea\jdk141_05\bin\javaw -classpath "C:\oracle\ora81\jdbc\lib\classes12.zip;C:\bea\weblogic81\server\lib\weblogic_sp.jar;C:\bea\weblogic81\server\lib\weblogic.jar;C:\bea\weblogic81\server\lib\webservices.jar" -ms64m -mx64m -Djava.library.path="/bea/weblogic81/server/bin" -Dbea.home="C:/bea" -Dweblogic.Name=myserver -Djava.security.policy=="/bea/weblogic81/server/lib/weblogic.policy" -Dweblogic.management.discover=false -Dweblogic.ProductionModeEnabled=false -Dweblogic.management.password=secrity -Dweblogic.management.username=system weblogic.Server
<2004-3-15 下午23时32分37秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 1.4.1_05-b01 from Sun Microsystems Inc.>

<2004-3-15 下午23时32分37秒 CST> <Info> <Configuration Management> <BEA-150016> <This server is being started as the administration server.>

<2004-3-15 下午23时32分37秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284
WebLogic XMLX Module 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 >

<2004-3-15 下午23时32分37秒 CST> <Notice> <Management> <BEA-140005> <Loading domain configuration from configuration repository at C:\bea\user_projects\domains\mydomain\.\config.xml.>

<2004-3-15 下午23时32分40秒 CST> <Notice> <Log Management> <BEA-170019> <The server log file C:\bea\user_projects\domains\mydomain\myserver\myserver.log is opened. All server side log events will be written to this file.>

<2004-3-15 下午23时32分42秒 CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>

<2004-3-15 下午23时32分42秒 CST> <Critical> <Security> <BEA-090402> <Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.>

***************************************************************************

The WebLogic Server did not start up properly.

Reason: weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.

***************************************************************************
...全文
38 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ponky 2004-03-16
  • 打赏
  • 举报
回复
你需要把你数据库的驱动程序添加到你的weblogic运行的你执行的那个文件中,其实不用再jb里面启动weblogic也是一样的,如果是你再jb里面启动的话就不能把你的jb关掉,也就是说不能把你服务器关掉,要是再外面的话就是可以的。如果你再jb里面启用服务器的话就不需要再外面再起了,因为这两个服务器是一样的。

50,530

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧