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

徐蕴 2003-04-25 11:35:51
这两天开始学习j2ee,以后肯定还有很多问题请教。
为什么我用Deployment tool生成的war的web.xml总是空的呢?
我是在实践The J2EETM Tutorial Addendum时碰到这个问题的。在tmp_deploytool下的也发现了一些Exception。
...全文
203 9 打赏 收藏 转发到动态 举报
写回复
用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)]
**********************************************************************


请大家帮忙,分我多的是
内容概要:本文围绕可变桨叶四旋翼无人机的规范控制与点对点运动模拟展开,重点研究优化推力分配策略在翻转动作中的应用与性能比较。通过Matlab代码实现,构建了四旋翼动力学模型,并设计了多种控制算法以实现精确的姿态调整与轨迹跟踪。研究对比了不同推力分配方案在执行高机动性翻转动作时的稳定性、能耗效率与响应速度,旨在提升无人机在复杂飞行任务中的动态性能与控制精度。该仿真研究为无人机飞控系统的设计与优化提供了理论依据和技术支持。; 适合人群:具备一定自动控制理论基础和Matlab编程能力,从事无人机控制、飞行器动力学或机器人系统研究的科研人员及研究生。; 使用场景及目标:① 实现四旋翼无人机在三维空间中的精确点对点运动控制;② 对比分析不同推力分配策略在执行翻转等高难度动作时的控制效果与能耗表现,优化飞行性能;③ 为无人机自主飞行、特技飞行及复杂环境下的机动控制提供算法验证平台。; 阅读建议:此资源以Matlab仿真为核心,建议读者结合相关控制理论知识,深入理解代码实现细节,重点关注动力学建模、控制律设计与推力分配模块。在学习过程中,应动手调试参数,复现文中翻转动作的仿真结果,并尝试拓展至其他复杂飞行任务,以加深对无人机控制机理的理解。

67,536

社区成员

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

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