配置MyEclipse的WebLogic服务器的配置及错误解决
1、MyEclipse默认的应用服务器为JBoss3,这里我们使用WebLogic8.1。启动Eclipse,选择“窗口/首选项”菜单,打开首选项对话框。展开MyEclipse下的Application Servers结点,点击JBoss 3,选中右面的Disable单选按钮,停用JBoss 3。然后点击WebLogic 8,选中右边的Enable单选按钮,启用WebLogic服务器。同时下面的配置如下:
(1)BEA home directory:E:/BEA
(2)WebLogic installation directory:E:/BEA/weblogic81
(3)Admin username:admin
(4)Admin password:12345678
(5)Execution domain root:E:/bea/user_projects/domains/mydomain
(6)Execution domain name:mydomain
(7)Execution server name:myserver
(8)Hostname:PortNumber:localhost:7001。
(9)Security policy file:E:/bea/weblogic81/server/lib/weblogic.policy
(10)JAAS login configuration file:省略。
2、接着展开WebLogic 8结点,点击JDK,在右边的WLS JDK name处选择WebLogic 8的默认JDK。
这里组合框中缺省为j2re1.4.2_03,即之前单独安装的jre。单击Add按钮,
弹出WebLogic > Add JVM对话框,在JRE名称处随便输入一个名字,如jre1.4.1_02。
然后在JRE主目录处选择WebLogic安装文件夹中的JDK文件夹,如E:/BEA/jdk141_02,
程序会自动填充Javadoc URL文本框和JRE系统库列表框。单击确定按钮关闭对话框。
这时候就可以在WLS JDK name组合框中选择jre1.4.1_02了。
之后还要在下面的Optional Java VM arguments,
如-ms64m -mx64m -Djava.library.path="E:/BEA/weblogic81/server/bin" -Dweblogic.management.discover=false -Dweblogic.ProductionModeEnabled=false
3、最后点击Paths,在右边的Prepend to classpath列表框中,通过Add JAR/ZIP按钮,
加入D:/BEA/weblogic81/server/lib/weblogic.jar、D:/BEA/weblogic81/server/lib/webservices.jar。
如果用到数据库,还需把数据库的驱动类库加进来,
这里我们用WebLogic自带的SQL Server数据库驱动库D:/BEA/weblogic81/server/lib/mssqlserver4v65.jar。
至此,MyEclipse中WebLogic8的配置工作就算完成了。
下面可以看看在Eclipse中能否启动WebLogic了?自从安装了MyEclipse之后,
Eclipse工具栏中就会有一个Run/Stop Servers下拉按钮。点击该按钮的下拉部分,选择“WebLogic 8/Start”菜单,即开始启动WebLogic了。通过查看下面的控制台消息,就可以知道启动是否成功,或有什么异常发生。停止WebLogic可选择“WebLogic/Stop”菜单。
错误解决:
1、Weblogic出现的com/sun/mirror/declaration/ClassDeclaration错误:
NoClassDefFoundError: com/sun/mirror/declaration/ClassDeclaration
关于MyEclipse浏览器不能显示jsp程序的错误
早几天做J2ee作业的时候,发现MyEclipse居然不能用自带的浏览器显示jsp文件。用了两天时间,查找了很多网站很多论坛,却很难发现一个与我的情况完全匹配的,最终还是自己结合论坛上高人指点,胡乱摸索,突然眼前一亮,“This is my JSP page!”,成功!
我用Weblogic 10作为JAVA EE的服务器,采用MyEclipse 6.0.0 GA为开发工具。创建一个project,部署,运行,出现以下错误:NoClassDefFoundError: com/sun/mirror/declaration/ClassDeclaration
在网上搜索解决方法,未果,本人认为关键的错误是这个:
Compiler class: 'com.sun.tools.javac.Main', not found
不能在浏览器上显示的原因应该是部署的时候没有把tool.jar加到classpath里。
解决方法:
在configure servers里,打开weblogic10的path,在Prepend to classpath里加上tools.jar(这个包在jdk的lib目录下),成功!
2、若出现以下错误:
原因是你的 客户端的jdbc驱动程序和服务器端的jdbc驱动程序不一样。
利用WEBLOGIC的JDBC驱动(weblogic81/server/lib)的jdbc驱动就行了.
ctx=javax.naming.InitialContext@1ccce3c
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:805)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:790)
at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
at weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObjectReplacer.java:222)
at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1006)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1722)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:114)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:111)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:139)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_811_WLStub.createStatement(Unknown Source)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.java:124)
at test.Test81.main(Test81.java:23)
Caused by: java.lang.NoClassDefFoundError: [Loracle/jdbc/dbaccess/DBColumn;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
at java.lang.Class.privateGetPublicMethods(Class.java:2488)
at java.lang.Class.privateGetPublicMethods(Class.java:2498)
at java.lang.Class.getMethods(Class.java:1406)
at weblogic.rmi.utils.Utilities.getRemoteMethods(Utilities.java:278)
at weblogic.rmi.utils.Utilities.getRemoteRMIMethods(Utilities.java:258)
at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub.ensureInitialized(Unknown Source)
at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub.<init>(Unknown Source)
... 29 more
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Failed to generate class for weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub ] - with nested exception:
[java.lang.reflect.InvocationTargetException - with target exception:
[java.lang.NoClassDefFoundError: [Loracle/jdbc/dbaccess/DBColumn;]]
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:807)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:790)
at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
at weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObjectReplacer.java:222)
at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1006)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1722)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:114)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:111)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:139)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_811_WLStub.createStatement(Unknown Source)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.java:124)
at test.Test81.main(Test81.java:23)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:805)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:790)
at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
at weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObjectReplacer.java:222)
at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1006)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1722)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:114)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:111)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:139)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_811_WLStub.createStatement(Unknown Source)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.java:124)
at test.Test81.main(Test81.java:23)
Caused by: java.lang.NoClassDefFoundError: [Loracle/jdbc/dbaccess/DBColumn;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
at java.lang.Class.privateGetPublicMethods(Class.java:2488)
at java.lang.Class.privateGetPublicMethods(Class.java:2498)
at java.lang.Class.getMethods(Class.java:1406)
at weblogic.rmi.utils.Utilities.getRemoteMethods(Utilities.java:278)
at weblogic.rmi.utils.Utilities.getRemoteRMIMethods(Utilities.java:258)
at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub.ensureInitialized(Unknown Source)
at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub.<init>(Unknown Source)
... 29 more
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Failed to generate class for weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub ] - with nested exception:
[java.lang.reflect.InvocationTargetException - with target exception:
[java.lang.NoClassDefFoundError: [Loracle/jdbc/dbaccess/DBColumn;]]
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:807)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:790)
at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
at weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObjectReplacer.java:222)
at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1006)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1722)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:114)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:111)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:139)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_811_WLStub.createStatement(Unknown Source)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.java:124)
at test.Test81.main(Test81.java:23)