大家用过j2sdkee1.4 beta吗?有问题请教。

徐蕴 2003-04-25 11:35:51
这两天开始学习j2ee,以后肯定还有很多问题请教。
为什么我用Deployment tool生成的war的web.xml总是空的呢?
我是在实践The J2EETM Tutorial Addendum时碰到这个问题的。在tmp_deploytool下的也发现了一些Exception。
...全文
139 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
徐蕴 2003-04-26
  • 打赏
  • 举报
回复
hk2000c(高能装甲):可能使我没有理解清楚把,我的机子上有三个se的版本,两个ee的版本,所以我对版本比较敏感,没有咬文嚼字的意思,而且我没有奚落你啊?
我的意思是问有没有解决deploytool这个bug的办法,其实我用命令行方式还是能够发布应用的。不过还是谢谢你,我要去试试jbuilder的集成。
如果真是没有办法的话,等到明天就结贴。散分了!!
hk2000c 2003-04-26
  • 打赏
  • 举报
回复
可能我没说清楚吧,我是指JDK1.4,因为我都是使用1.4 版本,无论SE还是EE.不必这么和我咬文嚼字吧。我都是使用Jbuilder8自动生成的XML文件,修改起来很快,也不会遇到你的问题。我倒是好心叫你试一下Jbuilder 集成。没想到还被你奚落。算我多嘴。ok?

徐蕴 2003-04-26
  • 打赏
  • 举报
回复
我们讨论的是J2SDKEE1.4
不是J2SDKSE
没有人知道怎样解决吗?我开始怀疑SUN的工作质量了,即便是BETA版,也不应该出现这种很基本的问题.
hk2000c 2003-04-26
  • 打赏
  • 举报
回复
你用Jbuilder8把,很好的。JDK1.4 没有出现问题。
medusagjf 2003-04-26
  • 打赏
  • 举报
回复
的确有问题的,还是用1.3.1的吧,正好问问deploytool配置sql2000 jdbc的问题,下面是英文资料,望大家帮忙参考!!
Re: J2EE and SQL2000 Database Connection.......Very urgent.....
Author: riodejaneiro
In Reply To: Re: J2EE and SQL2000 Database Connection.......Very urgent..... Mar 3, 2003 7:39 AM

Reply 11 of 11


Sorry for the delayed response, I have been busy with a company project lately, that I was not able to keep track of this forum anymore. The email address I posted was intended for joining forums such as these, newsgroups, and other memberships in web resources. I was not able check on its contents for quite some time as well.

I would like to thank everyone who replied to my posting, and gave their inputs. I was able to solve my problem through collected info out of the java forums.

I noticed that this problem has been a reccurring trail in the java forums, so I would like to summarize the solutions that have come up so far. This covers using the driver using the Driver Manager and configuring it to work with the J2EE RI.

When I first posted a similar trail on http://forum.java.sun.com/thread.jsp?forum=48&thread=346471 , I was using the Beta Version of the MS SQL Server 2000 Driver for JDBC. That was version 2.3.94.0. It still had limited support for JNDI, since the J2EE configuration for creating data sources uses JNDI, there was no way that the Beta Version could have worked. That was when I was encountering the annoying "No suitable driver found error."

Then I learned that Microsoft has released a Service Pack 1 for their JDBC Driver. It is still freely available to all developers who have a licensed SQL Server 2000. The current version is 7.4.262.0. You may download it from : http://msdn.microsoft.com/downloads/sample.asp

I retried all my settings with this new version, using the following SDKs:

1. J2EE Reference Implementation - j2sdkee1.3.1
2. J2SE Software Development Kit - j2sdk1.4.0

To use the driver in a standalone java application , add the paths of the three jar files that come with the <SQLDRIVER_HOME>\lib directory of the driver package in your CLASSPATH environment variable. In my case, I copied the three jar files in the <J2EE_HOME>\lib\system directory, so that all policy requirements should automatically be granted to the jar files. My CLASSPATH variable looks like this:

CLASSPATH=.;D:\j2sdkee1.3.1\lib\system\msbase.jar;D:\j2sdkee1.3.1\lib\system\mssqlserver.jar;D:\j2sdkee1.3.1\lib\system\msutil.jar

To load the driver class, use the following line:

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");


To get a connection , use the following URL pattern:

Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://<hostname>:<port>;databasename=<dbname>;user=<username>;password=<password> ");

I am running my SQL Server2K on my local machine (Windows 2000 Server), and intended to use it with a database named test , a user account named guest, and password guest123, so my connection URL looks like the following: (Default port number for SQL Server is 1433)

Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databasename=test;user=guest;password=guest123");

Note that if your SQL Server is running on a different machine , you may encounter an error like "Unable to establish socket connection". In this case, you might need to install the driver on the remote host, and make the same CLASSPATH settings. (I heard that if your SQL Server has SP1 or higher, it should be ready for the JDBC Driver already, but I have not verified this).

Now to use the Driver with the J2EE Server, do the following:

1. Go to <J2EE_HOME>\bin directory. Edit userconfig.bat, as follows:

echo "setting J2EE_CLASSPATH..."
set J2EE_CLASSPATH=D:\j2sdkee1.3.1\lib\system\msutil.jar;D:\j2sdkee1.3.1\lib\system\msbase.jar;D:\j2sdkee1.3.1\lib\system\mssqlserver.jar;
set J2EE_CLASSPATH

rem JAVA_HOME refers to the directory where the Java(tm) 2 SDK
rem Standard Edition software is installed.

echo "setting JAVA_HOME..."
set JAVA_HOME=D:\j2sdk1.4.0
set JAVA_HOME


2. In deploytool, go to Tools -> Server Configuration. In the JTree, under Data Sources, choose Standard. On the JDBC Driver Panel, click on Add , and type com.microsoft.jdbc.sqlserver.SQLServerDriver.

On the Data Sources Panel, add a JNDI name for your data source. I made mine jdbc/SQLServerTest , containing the URL jdbc:microsoft:sqlserver://localhost:1433;databasename=test

Note: For the URL, you must stop in the databasename property, because the username and password will be specified later in the deployment setting of your application. This will make it easier for you to change your setting when needed.

3. Before the next step, you must check your source code of your server component for the Coded Name you used for the JNDI resource you referenced. Here's an example:

String dbName = "java:comp/env/jdbc/TestDB";
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName);
con = ds.getConnection();

4. For the component that you wish to deploy, open the Resource Refs tab. Under Resource Factories Referenced In Code Panel, click add. Type jdbc/TestDB for the Coded Name, javax.sql.DataSource for the type. Specify whether you want to use Container or Application managed authentication, and whether this resource can be sharable among components.

5. In the Deployment Setting panel , type the JNDI name you specified earlier for the Server DataSource , jdbc/SQLServerTest. You may now specify the user name and password that this component will use.

6. This should have been all there is to the configuration and deployment of your application. However, I still encountered the following error:

"[Microsoft][SQLServer 2000 Driver for JDBC]Error opening/loading com.microsoft.util.transliteration.properties"

If you will unjar the msutil.jar of the driver package, you will find a file called transliteration.properties. I'm not sure about the reason but it looks like the J2EE Server does not have enough privilege to read this file. I would have to thank Scottw512 of the Java Forums because his post has been the most useful so far (http://forum.java.sun.com/thread.jsp?thread=316020&forum=136&message=1274179) . Here's what you must do:

7. Go to <J2EE_HOME>\lib\security folder. Edit server.policy and add the following code:

//permission for MS SQL Server 2000 Driver for JDBC
grant {
// DataSource access
permission java.util.PropertyPermission "java.naming.*", "read,write";
// Adjust the server host specification for your environment
permission java.net.SocketPermission "*.microsoft.com:0-65535", "connect";
permission java.io.FilePermission "${com.sun.enterprise.home}${/}lib${/}system${/}msutil.jar", "read";
};

8. Restart the J2EE Server, and you should be ready to test your Data Source Connection.


For the server.policy entry , I share Scott's concern on whether this additional permission should pose some security issue with your applications.

I have verified the first two permissions , and they are indeed safe to add. The SQL Server 2000 Driver for JDBC Documentation actually instructs that you add this permission if you intend to use it under the Java 2 Platform. What I'm not sure about, is the third permission to allow read access to the msutil.jar. What's included in the documentation is permission for specifying access to temp files or folders, not any of the jar files.

Since this is the first solution that works so far, I'm quite satisfied to use this for my purposes. But I'll still be searching the forums every now and then for any similar trails concerning this.

This is a call to all Java Developers: Maybe some Java Security experts out there could advise us on this ? Please keep this trail active. C'' ,)

Again , I thank Scott for his posts , and everyone who helped.


wdman 2003-04-25
  • 打赏
  • 举报
回复
需要你设置一些选项,web.xml中才会有内容啊
徐蕴 2003-04-25
  • 打赏
  • 举报
回复
都升了级就不想降下来了,现在只好用deploytool命令行来工作。用ant,也觉得挺方便的。
vcvj 2003-04-25
  • 打赏
  • 举报
回复
没错,我同意在deploy时发现这问题(j2ee1.4)
我都改用j2ee1.3
徐蕴 2003-04-25
  • 打赏
  • 举报
回复
我设置了:
servlet alias
event listener
error mapping
resource refs
...
但是都不反映到web.xml中,怎么回事呢?
还有我无法通过deployment tool 停止我通过ant 发布的程序,得到一些异常:
----------------------------------------------------------------------
stop: hello1
Running...
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: hello1 not found; nested exception is:
javax.management.InstanceNotFoundException: hello1 not found

at com.sun.corba.se.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:61)

at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)

at org.omg.stub.com.sun.enterprise.tools.deployment.backend._JarInstaller_Stub.stop(Unknown Source)

at com.sun.enterprise.deployapi.actions.ModuleStateAction.run(ModuleStateAction.java:61)

at java.lang.Thread.run(Thread.java:534)

Caused by: java.rmi.RemoteException: hello1 not found; nested exception is:
javax.management.InstanceNotFoundException: hello1 not found

at com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.stop(JarInstallerImpl.java:1286)

at org.omg.stub.com.sun.enterprise.tools.deployment.backend._JarInstallerImpl_Tie._invoke(Unknown Source)

at com.sun.corba.se.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:353)

at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:252)

at com.sun.corba.se.internal.iiop.RequestProcessor.process(RequestProcessor.java:81)

at com.sun.corba.se.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:106)

Caused by: javax.management.InstanceNotFoundException: hello1 not found

at com.sun.enterprise.management.util.J2EEManagementObjectManager.getManagedObjectModule(J2EEManagementObjectManager.java:672)

at com.sun.enterprise.management.util.J2EEManagementObjectManager.stopModule(J2EEManagementObjectManager.java:639)

at com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.stop(JarInstallerImpl.java:1276)

... 5 more



!!! Operation Failed !!!

**********************************************************************
[Completed (time=1.2sec, status=13)]
**********************************************************************


请大家帮忙,分我多的是
JSP是一种如日中天的新型Internet/Intranet开发语言,可以在多种操作系统平台和多种Web服务器下使用。本书从最基础的JSP开发开始,循序渐进地介绍了JSP 开发技术,并涵盖了许多高级主题,如需要在企业级Web应用中使用的特性—Enterprise JavaBeans、JDBC 2.0、数据库连接池和自定义标签库。本书既适合初学者阅读,也适合具有一定JSP基础的开发人员深入研究使用。 前 言 JSP是SUN公司推出的一种新型的Internet/Intranet开发语言,和前一代Internet/Intranet开发语言(ASP、PHP)相比,JSP在以下几个方面有了重大的突破: 1) 通过JSP的扩展标签库和JavaBeans功能,网站逻辑和网站界面可以完美地分离。 2) 使用Enterprise JavaBeans,可以轻松地在JSP开发的Web中实现事务、安全、会话等等企业级应用所需要的功能。 3) JDBC2.0提供了不同的数据库产品无关的数据库连接方式,更重要的是,数据库连接池提供了一种比普通的数据库连接方式效率高得多的连接方式。 JSP的语法基本上和Java是相同的,有Java基础的读者可以很快学会如何使用JSP,而没有Java语言基础的读者,只要循序渐进地阅读本书,一样可以成为JSP编程的高手。本书主要分为两个部分:第一部分为JSP基础部分。通过这一部分的学习,读者可以掌握JSP的基本使用方法,学会如何使虽JSP来开发一般的中、小型Web应用。这一部分使用常见的Apache Group的Tomcat作为JSP引擎的例子。第二部分为JSP高级应用部分。这一部分主要讲述如何使用JSP进行大型Web应用的开发,为了方便读者学习,本书还专门讲述了SUN公司的J2SDKEE和B趴公司的Webloglc应用服务器的基本使用方法。 JSP可以在各种操作系统和各种Web服务器下使用,其代码基本上不需要任何改动就可以使用。本书为了适应大多数读者的情况,使用了Windows操作系统作为例子,具体的试验平台如下: Windows 2000Advanced Server Apachel.3.14 Intemetln允rmation Server 5.0 Tomcat 3.1 J2SDKEE l.2 BEA Wiblogic 5.1 除了上述平台,书中的代码还在如下平台进行了测试: RedhatUnux 6.1 Apache l.3.12 TOmcat 3.1 BEA Weblogic 4.51 数据库系统主要使用了Microsoft SQL Server 7.0,部分代码使用了MySQL。作者 2000.11 前言 第一部分 JSP入门 第1章 概述 1.1 Java技术 1.1.1 Java技术的发展 1.1.2 JavaBeans 1.1.3 JDBC 1.1.4 J2EE 1.1.5 EJB 1.1.6 Java Servlet 1.2 JSP技术 1.2.1 JSP技术概述 1.2.2 JSP的优势及与其他Web开发工具的比较 1.3 JSP开发Web的几种主要方式 1.3.1 直接使用JSP 1.3.2 JSP+JavaBeans 1.3.3 JSP+JavaBeans+Servlet 1.3.4 J2EE开发模型 1.4 本书用到的软件及获取 第2章 预备知识 2.1 Java程序设计基础 2.1.1 Java语言规则 2.1.2 Java变量和函数 2.1.3 子类 2.1.4 this和super 2.1.5 类的类型 2.1.6 抽象类 2.1.7 接口 2.1.8 包 2.2 JavaBeans 2.2.1 JavaBeans的属性 2.2.2 JavaBeans的事件 2.2.3 持久化 2.2.4 用户化 2.3 Java Servlet 2.3.1 HTTP Servlet API 2.3.2 系统信息 2.3.3 传送HTML信息 2.4 SQL语言 2.4.1 SQL子类型 2.4.2 SQL语言的具体命令和使用 2.5 JDBC 2.5.1 什么是 JDBC 2.5.2 JDBC 产品 2.5.3 连接概述 2.5.5 一个简单的例子 第3章 JSP开发平台的建立:Tomcat 3.1 Tomcat的安装和直接使用 3.2 Tomcat和Apache的配合 3.3 Tomcat和IIS的配合 3.4 Tomcat的配置和常见问题 3.4.1 Tomcat的主配置文件:server.xml 3.4.2 Windows下代码保护的问题 3.4.3 Apache、IIS和Tomcat协作时工作 目录的添加 3.4.4 设定Tomcat作为Windows的服务而启动 3.4.5 在Tomcat中建立新的Web应用程序 第4章 JSP的语法和语义 4.1 通用的语法规则 4.1.1 元素的语法规则 4.1.2 JSP中的相对路径 4.2 注释 4.3 指令 4.3.1 page指令 4.3.2 include指令 4.3.3 taglib指令 4.4 内置对象 4.5 脚本元素 4.5.1 声明 4.5.2 表达式 4.5.3 脚本代码 4.6 动作 4.6.1 id和scope属性 4.6.2 标准动作 第5章 作为XML的JSP 5.1 为什么要使用XML相容的语法形式 5.2 关于文本类型的语法 5.2.1 jsp:root元素 5.2.2 公共标识符 5.3 指令 5.3.1 page指令 5.3.2 include指令 5.3.1 taglib指令 5.4 脚本元素 5.4.1 声明 5.4.2 脚本代码 5.4.3 表达式 5.5 如何将一个普通的JSP文件转换为一个XML 文档 5.6 JSP1.1的DTD文件 第6章 JSP基础实例 6.1 第一个JSP程序—HelloWorld! 6.2 注释的使用 6.3 脚本元素 6.3.1 声明 6.3.2 表达式 6.3.3 脚本代码 6.4 page指令 6.4.1 import 6.4.2 session 6.4.3 错误处理 6.5 包含其他文件 6.6 使用JavaBean 6.7 内置对象 6.7.1 用request对象获取客户端的数据 6.7.2 用response对象向客户端发送信息 6.7.3 其他内置对象 6.8 6.9 使用插件 6.10 使用session对象 6.10.1 会话的概念 6.10.2 session对象可用的方法和属性 6.10.3 session对象的基本例子 6.10.4 利用session制作一个购物车 6.10.5 JavaBeans的作用域 6.10.6 利用JavaBeans制作的购物车 6.11 使用application对象 6.11.1 应用的概念 6.11.2 application对象可用的方法和属性 6.11.3 application对象内包含的系统信息 6.11.4 利用application建立一个简单的聊天室 第7章 用JSP实现常见的Web应用 7.1 常见的Web应用及分析 7.1.1 留言板、论坛和社区 7.1.2 聊天室 7.1.3 搜索引擎 7.1.4 电子商务 7.1.6 后台管理系统 7.2 留言板 7.2.1 功能分析 7.2.2 功能实现和技术要点 7.2.3 代码和分析 7.3 进一步完善的留言板 7.3.1 功能分析 7.3.2 功能实现和技术要点 7.3.3 代码和分析 7.4 聊天室 7.4.1 功能实现和技术要点 7.4.2 代码和分析 7.5 下一步 第二部分 高级JSP技术 第8章 JSP开发平台的搭建:J2EE 8.1 J2SDKEE的安装和使用 8.1.1 软硬件的支持 8.1.2 安装 8.2 J2SDKEE的配置 8.2.1 JDBC的配置 8.2.2 事务处理 8.2.3 服务的端口号 8.2.4 日志文件 8.2.5 安全 8.2.6 钝化发生的内存极限 8.2.7 JNDI服务器主机 8.2.8 HTTP服务的发布目录 8.3 WebLogic的安装和使用 8.3.1 软硬件要求 8.3.2 安装和启动 8.4 WebLogic的配置 8.4.1 系统级参数的设置 8.4.2 将WebLogic作为HTTP服务器使用 8.4.3 使用ISAPI桥连接WebLogic和IIS 8.4.4 WebLogic配置示例 第9章 扩展JSP标签 9.1 概述 9.1.1 扩展标签的作用 9.1.2 如何开发扩展标签 9.1.3 简单的扩展标签 9.1.4 包含内容处理的扩展标签 9.1.5 能够协作的扩展标签 9.1.6 定义了脚本变量的扩展标签 9.2 标签处理类的开发 9.2.1 接口和基类 9.2.2 开发 9.3 标签库文件 9.3.1 taglib 9.3.2 tag 9.4 定位一个tld文件 9.4.1 在Web.xml中定位一个tld文件 9.4.2 直接在JSP文件中定位tld文件 9.5 扩展标签实例 9.5.1 得到父标签的数据 9.5.2 TestTag类 9.5.3 Title类 9.5.4 Data类 9.5.5 TLD文件 9.5.6 在JSP中使用扩展标签 第10章 Enterprise JavaBeans 10.1 Java服务器端组件标准—EJB 10.1.1 EJB和JavaBeans 10.1.2 EJB的开发与使用中的角色 10.2 Session Bean 10.2.1 Session Bean的状态管理模式 10.2.2 Session Bean的生命周期 10.3 Entity Bean 10.3.1 Entity Bean的特性 10.3.2 Entity Bean的生命周期 10.4 EJB的开发 10.4.1 Enterprise JavaBeans的实际处理文件 10.4.2 实现EJBObject文件 10.4.3 实现EJBHome文件 10.4.4 生成ejb-jar.xml文件 10.4.5 打包生成JAR文件 10.5 EJB的部署—J2SDKEE 10.5.1 使用deploytool打包EJB 10.5.2 使用deploytol部署EJB 10.6 EJB的部署—BEA WebLogic 10.6.1 生成可部署的ejb-jar包 10.6.2 部署WbLogic的ejb-jar包 10.7 使用EJB 10.7.1 本地访问EJB 10.7.2 远程访问EJB 10.8 JSP和EJB 10.9 EJB开发实例—电子商务应用 10.9.1 EJB的实现文件—TestCartEJB 10.9.2 实现Home接口TestCartHome 10.9.3 实现远程Object接口TestCart 10.9.4 EJB的Web组件TestCartWebImp 10.9.5 JSP文件 10.9.6 实例的内部运行逻辑 第11章 其他高级功能 11.1 JDBC2.0和JDBC数据库连接池 11.1.1 JDBC2.0新功能概述 11.1.2 结果集增强功能 11.1.3 批处理更新 11.1.4 对Java对象的持久性 11.1.5 数据库连接池使用实例 11.2 文件上载 11.2.1 实现机理 11.2.2 文件上载实例 第12章 JSP高级应用实例:网上书店 12.1 概述 12.2 扩展标签的使用 12.2.1 数据集作用的BookList标签 12.2.2 让数据循环输出的Books标签 12.2.3 输出数据的标签 12.2.4 控制页面前进、后退的标签 12.2.5 测试标签 12.3 EJB及其Web组件 12.3.1 ShoppingCart 12.3.2 Books 附录A JSP应用实例:网上教育代码 附录B JavaServer Pages白皮书 附录C 常用JSP相关网址

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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