JMeter压测结果报错-Error in NonGUIDriver java.lang.RuntimeException: Could not find the TestPlan class!

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/laofashi2015/article/details/90639413

问题描述:    

在进行压力测试时,为了降低网络带宽对响应时间的影响,通常高并发时会采用在Windows上使用JMeter编写好测试脚本-xxx.jmx;将脚本上传到相同局域网的Linux服务器,使用JMeter对应命令进行压力测试的方法。测试有时会遇到如下报错:

问题原因:

保存测试脚本时只保存了Testplan下的部分节点,导致生成的测试脚本只是“testplan”下面的某些元素,,不包括需要运行测试所需的“TestPlan”元素。

解决方案:

在保存测试脚本时,保存整个测试计划,以下两种方式保存测试脚本,可以避免上述报错产生。

1.在文件菜单中单击“保存测试计划”或“保存测试计划为”选项;

2.鼠标选中测试计划节点,直接点击工具栏上的“保存测试计划”按钮

展开阅读全文

Error: Could not find or load main class HBase_c2java

08-27

HBase linux下java操作。rn安装的是JDK1.7.0_65 安装目录rn[code=c]rn[root@wangxin jdk1.7.0_65]# pwdrn/usr/java/jdk1.7.0_65rn[/code]rn环境配置rn[code=c]rn[root@wangxin jdk1.7.0_65]# cat /etc/profilernexport JAVA_HOME=/usr/java/jdk1.7.0_65rnexport JAR_HOME=/usr/java/jdk1.7.0_65/jrernexport CLASSPATH=.:$JAVA_HOME/lib:$JAR_HOME/lib:$CLASSPATHrnexport PATH=$JAVA_HOME/bin:$JAR_HOME/bin:$PATHrnrn[root@wangxin jdk1.7.0_65]# java -versionrnjava version "1.7.0_65"rnJava(TM) SE Runtime Environment (build 1.7.0_65-b17)rnJava HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)rn[/code]rnrnrnHBase 安装的是 hbase-0.98.5-hadoop2-bin.tar.gz 版本rn安装目录是rn[code=c]rn[root@wangxin hbase]# pwdrn/usr/local/hbasern[root@wangxin hbase]# lsrnbin CHANGES.txt conf docs hbase-webapps lib LICENSE.txt logs NOTICE.txt README.txtrn[/code]rn仅修改 conf/hbase-site.xmlrn[code=text]rnrn rn hbase.rootdirrn file:///hbase_log/tmp/hbasern rn rn hbase.zookeeper.property.dataDirrn /hbase_log/tmp/zookeeperrn rn[/code]rn通关脚本启动rn[code=c]rn[root@wangxin /]# start-hbase.sh rnstarting master, logging to /usr/local/hbase/logs/hbase-root-master-wangxin.outrn[root@wangxin /]# hbase shell rn2014-08-27 06:54:52,498 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.availablernHBase Shell; enter 'help' for list of supported commands.rnType "exit" to leave the HBase ShellrnVersion 0.98.5-hadoop2, rUnknown, Mon Aug 4 23:58:06 PDT 2014rnrnhbase(main):001:0> rn[/code]rn在这里可以进行一系列操作,说明HBase安装是没有问题的。也可以通过60010端口在浏览器打开。rnrn现在写一段java代码,通过java api去操作HBasern[code=java]rnimport java.io.IOException;rnrnimport org.apache.hadoop.conf.Configuration;rnimport org.apache.hadoop.hbase.HBaseConfiguration;rnimport org.apache.hadoop.hbase.HColumnDescriptor;rnimport org.apache.hadoop.hbase.HTableDescriptor;rnimport org.apache.hadoop.hbase.KeyValue;rnimport org.apache.hadoop.hbase.client.Delete;rnimport org.apache.hadoop.hbase.client.Get;rnimport org.apache.hadoop.hbase.client.HBaseAdmin;rnimport org.apache.hadoop.hbase.client.HTable;rnimport org.apache.hadoop.hbase.client.HTablePool;rnimport org.apache.hadoop.hbase.client.Put;rnimport org.apache.hadoop.hbase.client.Result;rnimport org.apache.hadoop.hbase.client.ResultScanner;rnimport org.apache.hadoop.hbase.client.Scan;rnimport org.apache.hadoop.hbase.util.Bytes;rn rnrnpublic class HBase_c2javarn rn static HBaseConfiguration cfg = null;rn static rn Configuration configuration = new Configuration();rn cfg = new HBaseConfiguration(configuration); rn rnrn rn public static void createTable(String tableName, String columnFaily)throws Exceptionrn HBaseAdmin admin = new HBaseAdmin(cfg);rn if(admin.tableExists(tableName))rn System.out.println(tableName + "It's not existed!");rn System.exit(0);rn rn elsern HTableDescriptor tableDesc = new HTableDescriptor(tableName);rn tableDesc.addFamily(new HColumnDescriptor(columnFaily+":"));rn System.out.println("create table success!");rn rn rn public static void main(String[] args)rn tryrn String tableName = "student";rn HBase_c2java.createTable(tableName, "c1");rn catch(Exception e)rn e.printStackTrace();rn rn rnrn[/code]rn在安装的hbse路径的lib下有很多.jar包rn[code=text]rn[root@wangxin lib]# lsrnactivation-1.1.jar hadoop-mapreduce-client-core-2.2.0.jar javax.servlet-api-3.0.1.jarrnaopalliance-1.0.jar hadoop-mapreduce-client-jobclient-2.2.0.jar jaxb-api-2.2.2.jarrnasm-3.1.jar hadoop-mapreduce-client-shuffle-2.2.0.jar jaxb-impl-2.2.3-1.jarrnavro-1.7.4.jar hadoop-yarn-api-2.2.0.jar jersey-client-1.9.jarrncommons-beanutils-1.7.0.jar hadoop-yarn-client-2.2.0.jar jersey-core-1.8.jarrncommons-beanutils-core-1.8.0.jar hadoop-yarn-common-2.2.0.jar jersey-grizzly2-1.9.jarrncommons-cli-1.2.jar hadoop-yarn-server-common-2.2.0.jar jersey-guice-1.9.jarrncommons-codec-1.7.jar hadoop-yarn-server-nodemanager-2.2.0.jar jersey-json-1.8.jarrncommons-collections-3.2.1.jar hamcrest-core-1.3.jar jersey-server-1.8.jarrncommons-compress-1.4.1.jar hbase-client-0.98.5-hadoop2.jar jersey-test-framework-core-1.9.jarrncommons-configuration-1.6.jar hbase-common-0.98.5-hadoop2.jar jersey-test-framework-grizzly2-1.9.jarrncommons-daemon-1.0.13.jar hbase-common-0.98.5-hadoop2-tests.jar jets3t-0.6.1.jarrncommons-digester-1.8.jar hbase-examples-0.98.5-hadoop2.jar jettison-1.3.1.jarrncommons-el-1.0.jar hbase-hadoop2-compat-0.98.5-hadoop2.jar jetty-6.1.26.jarrncommons-httpclient-3.1.jar hbase-hadoop-compat-0.98.5-hadoop2.jar jetty-sslengine-6.1.26.jarrncommons-io-2.4.jar hbase-it-0.98.5-hadoop2.jar jetty-util-6.1.26.jarrncommons-lang-2.6.jar hbase-it-0.98.5-hadoop2-tests.jar jruby-complete-1.6.8.jarrncommons-logging-1.1.1.jar hbase-prefix-tree-0.98.5-hadoop2.jar jsch-0.1.42.jarrncommons-math-2.1.jar hbase-protocol-0.98.5-hadoop2.jar jsp-2.1-6.1.14.jarrncommons-net-3.1.jar hbase-server-0.98.5-hadoop2.jar jsp-api-2.1-6.1.14.jarrnfindbugs-annotations-1.3.9-1.jar hbase-server-0.98.5-hadoop2-tests.jar jsr305-1.3.9.jarrngmbal-api-only-3.0.0-b023.jar hbase-shell-0.98.5-hadoop2.jar junit-4.11.jarrngrizzly-framework-2.1.2.jar hbase-testing-util-0.98.5-hadoop2.jar libthrift-0.9.0.jarrngrizzly-http-2.1.2.jar hbase-thrift-0.98.5-hadoop2.jar log4j-1.2.17.jarrngrizzly-http-server-2.1.2.jar high-scale-lib-1.1.1.jar management-api-3.0.0-b012.jarrngrizzly-http-servlet-2.1.2.jar htrace-core-2.04.jar metrics-core-2.2.0.jarrngrizzly-rcm-2.1.2.jar httpclient-4.1.3.jar netty-3.6.6.Final.jarrnguava-12.0.1.jar httpcore-4.1.3.jar paranamer-2.3.jarrnguice-3.0.jar jackson-core-asl-1.8.8.jar protobuf-java-2.5.0.jarrnguice-servlet-3.0.jar jackson-jaxrs-1.8.8.jar rubyrnhadoop-annotations-2.2.0.jar jackson-mapper-asl-1.8.8.jar servlet-api-2.5-6.1.14.jarrnhadoop-auth-2.2.0.jar jackson-xc-1.8.8.jar slf4j-api-1.6.4.jarrnhadoop-client-2.2.0.jar jamon-runtime-2.3.1.jar slf4j-log4j12-1.6.4.jarrnhadoop-common-2.2.0.jar jasper-compiler-5.5.23.jar snappy-java-1.0.4.1.jarrnhadoop-hdfs-2.2.0.jar jasper-runtime-5.5.23.jar xmlenc-0.52.jarrnhadoop-mapreduce-client-app-2.2.0.jar javax.inject-1.jar xz-1.0.jarrnhadoop-mapreduce-client-common-2.2.0.jar javax.servlet-3.1.jar zookeeper-3.4.6.jarrn[/code]rnrn使用javac编译rn[code=c]rn[root@wangxin test]# javac -cp /usr/local/hbase/lib/hadoop-common-2.2.0.jar:/usr/local/hbase/lib/hbase-common-0.98.5-hadoop2.jar:/usr/local/hbase/lib/hbase-client-0.98.5-hadoop2.jar HBase_c2java.javarnNote: HBase_c2java.java uses or overrides a deprecated API.rnNote: Recompile with -Xlint:deprecation for details.rn[/code]rn有两个警告。。这个怎么可以处理掉?rn运行rn[code=c]rn[root@wangxin test]# java -cp /usr/local/hbase/lib/hadoop-common-2.2.0.jar:/usr/local/hbase/lib/hbase-common-0.98.5-hadoop2.jar:/usr/local/hbase/lib/hbase-client-0.98.5-hadoop2.jar HBase_c2java rnError: Could not find or load main class HBase_c2javarn[/code]rn这里为什么找不到主类?rn.java 和.class在同一目录下,这个目录下没有其他文件。 论坛

Could not find class 'com.google.ads.AdView'

03-31

我在这个网站注册的一个广告联盟http://zhcn.admob.com/.rn然后根据步骤https://developers.google.com/mobile-ads-sdk/docs/android/fundamentals?hl=zh-cn这个网站的步骤,rn一步一步的,可是都完事了之后,到运行模拟器的时候,就报错了,说找不到Could not find class 'com.google.ads.AdView'rn这个类..我把GoogleAdMobAdsSdkAndroid-4.3.1这个Jra包都引导项目里了,可是还不行,rn大家谁能帮帮我.谢谢了..rn下面是我的Java代码.rn[code=Java]rnpackage com.feng.main;rnrnimport android.app.Activity;rnimport android.os.Bundle;rnimport android.widget.LinearLayout;rnrnimport com.google.ads.*;rnrnpublic class TestActivity extends Activity rn private AdView adView;rnrn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn // Create the adViewrn adView = new AdView(this, AdSize.BANNER, "a14f756f69907d7");rnrn // Lookup your LinearLayout assuming it’s been givenrn // the attribute android:id="@+id/mainLayout"rn LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);rnrn // Add the adView to itrn layout.addView(adView);rnrn // Initiate a generic request to load it with an adrn adView.loadAd(new AdRequest());rn rnrn @Overridern public void onDestroy() rn if (adView != null) rn adView.destroy();rn rn super.onDestroy();rn rn[/code]rn下面是我的XML代码rn[code=XML]rnrnrnrn rnrn rn rn rn rnrn rn rn rn rn rnrn rn rnrnrn[/code] 论坛

Android Studio could not find class

08-18

![图片说明](https://img-ask.csdn.net/upload/201608/18/1471505027_514933.png)rn一个CheckBox 多选按钮实现程序,layout预览没有问题,启动APK不能运行。rnrnbuild.gradlern![图片说明](https://img-ask.csdn.net/upload/201608/18/1471511535_934926.png)rnrnlogcat:rnrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.widget.Toolbar', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.app.ActivityManager$TaskDescription', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.820 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.840 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.840 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.app.assist.AssistContent', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.840 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.view.SearchEvent', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.840 3020-3020/com.example.administrator.myapplication12 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.administrator.myapplication12.MainActivity.access$superrn08-18 05:15:38.900 3020-3020/com.example.administrator.myapplication12 E/AndroidRuntime: FATAL EXCEPTION: mainrn Process: com.example.administrator.myapplication12, PID: 3020rn java.lang.RuntimeException: Unable to start activity ComponentInfocom.example.administrator.myapplication12/com.example.administrator.myapplication12.MainActivity: java.lang.NullPointerExceptionrn at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)rn at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)rn at android.app.ActivityThread.access$800(ActivityThread.java:135)rn at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)rn at android.os.Handler.dispatchMessage(Handler.java:102)rn at android.os.Looper.loop(Looper.java:136)rn at android.app.ActivityThread.main(ActivityThread.java:5017)rn at java.lang.reflect.Method.invokeNative(Native Method)rn at java.lang.reflect.Method.invoke(Method.java:515)rn at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)rn at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)rn at dalvik.system.NativeStart.main(Native Method)rn Caused by: java.lang.NullPointerExceptionrn at com.example.administrator.myapplication12.MainActivity.onCreate(MainActivity.java:39)rn at android.app.Activity.performCreate(Activity.java:5231)rn at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)rn at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)rn at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) rn at android.app.ActivityThread.access$800(ActivityThread.java:135) rn at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) rn at android.os.Handler.dispatchMessage(Handler.java:102) rn at android.os.Looper.loop(Looper.java:136) rn at android.app.ActivityThread.main(ActivityThread.java:5017) rn at java.lang.reflect.Method.invokeNative(Native Method) rn at java.lang.reflect.Method.invoke(Method.java:515) rn at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) rn at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) rn at dalvik.system.NativeStart.main(Native Method) rn 问答

Could not find action or result报错

06-21

15:59:54,971 WARN org.apache.struts2.dispatcher.Dispatcher:49 - Could not find action or resultrnThere is no Action mapped for action name undefined. - [unknown location]rn一下为struts配置文件:rnrnrnrnrnrn rn rn rn rn rn rn rn /homePage/user/User_list.jsprn /homePage/homePage.jsprn /homePage/Login.jsprn /homePage/user/User_list.jsprn /homePage/user/User_view.jsprn /homePage/user/User_index.jsprn /homePage/user/User_index.jsprn /homePage/user/User_beforeUpdate.jsprn rn rn rn /homePage/assistance/Assistance_listByAddress.jsprn /homePage/assistance/Assistance_index.jsprn /homePage/assistance/Assistance_beforeUpdate.jsprn /homePage/assistance/Assistance_index.jsprn /homePage/assistance/Assistance_index.jsprn /homePage/assistance/Assistance_listByUser.jsprn /homePage/assistance/Assistance_statistic.jsprn rn rn rn /homePage/allowances/Allowances_listByAddress.jsprn /homePage/allowances/Allowances_index.jsprn /homePage/allowances/Allowances_beforeUpdate.jsprn /homePage/allowances/Allowances_index.jsprn /homePage/allowances/Allowances_index.jsprn /homePage/allowances/Allowances_listByUser.jsprn /homePage/allowances/Allowances_statistic.jsprn rn rn rn /homePage/old/Old_listByAddress.jsprn /homePage/old/Old_index.jsprn /homePage/old/Old_beforeUpdate.jsprn /homePage/old/Old_index.jsprn /homePage/old/Old_index.jsprn /homePage/old/Old_listByUser.jsprn /homePage/old/Old_statistic.jsprn rn rnrnrn以下为web配置文件:rnrnrnrnrn contextConfigLocationrn classpath:beans.xmlrn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rn openSessionInViewrn org.springframework.orm.hibernate3.support.OpenSessionInViewFilterrn rn sessionFactoryBeanNamern sfrn rn rn rn rn openSessionInViewrn /*rn rn rn rn CharacterEncoding rn com.huxtech.action.SetCharacterEncodingFilter rn rn encoding rn utf-8 rn rn rn rn CharacterEncoding rn /* rn rnrn rn rn encodingFilterrn org.springframework.web.filter.CharacterEncodingFilterrn rn encodingrn UTF-8rn rn rn forceEncoding rn true rn rn rn rn rn encodingFilterrn /*rn rn rn rn rn struts2rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rnrn rn struts2rn /*rn rn rn DWR Servletrn dwr-invokerrn org.directwebremoting.servlet.DwrServletrn rn debugrn truern rn rn rn dwr-invokerrn /dwr/*rn rn rn index.jsprn rnrn我登录成功返回jsp也对 但是就直接报上面的错误啦 论坛

Could not find a getter for id in class 的错误!

05-16

本人用 eclipse3.2+myeclipse5.1GA+hibernate3.0连接oracle写clob字段:rn数据库中的表(content)中有两个字段:id(int),content(clob),rn生成bean文件时:有两个文件产生了:content.java和contentid.javarn和Content.hbm.xmlrncontent.javarnpackage cn.fusion.beans;rnrn/**rn * Content generated by MyEclipse - Hibernate Toolsrn */rnrnpublic class Content implements java.io.Serializable rn // Fields rnrn private ContentId id;rn // Constructorsrn /** default constructor */rn public Content() rn rn /** full constructor */rn public Content(ContentId id) rn this.id = id;rn rn // Property accessorsrn public ContentId getId() rn return this.id;rn rn public void setId(ContentId id) rn this.id = id;rn rnrnrn-----------------rncontentid.javarnrnpackage cn.fusion.beans;rnrn/**rn * ContentId generated by MyEclipse - Hibernate Toolsrn */rnpublic class ContentId implements java.io.Serializable rn // Fields rn private Long id;rn private String content;rn // Constructorsrnrn /** default constructor */rn public ContentId() rn rn/** minimal constructor */rn public ContentId(Long id) rn this.id = id;rn rn /** full constructor */rn public ContentId(Long id, String content) rn this.id = id;rn this.content = content;rn rn // Property accessorsrnrn public Long getId() rn return this.id;rn rn rn public void setId(Long id) rn this.id = id;rn rnrn public String getContent() rn return this.content;rn public void setContent(String content) rn this.content = content;rn rnrn public boolean equals(Object other) rn if ( (this == other ) ) return true;rn if ( (other == null ) ) return false;rn if ( !(other instanceof ContentId) ) return false;rn ContentId castOther = ( ContentId ) other; rn rn return ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) )rn && ( (this.getContent()==castOther.getContent()) || ( this.getContent()!=null && castOther.getContent()!=null && this.getContent().equals(castOther.getContent()) ) );rn rn rn public int hashCode() rn int result = 17;rn rn result = 37 * result + ( getId() == null ? 0 : this.getId().hashCode() );rn result = 37 * result + ( getContent() == null ? 0 : this.getContent().hashCode() );rn return result;rn rnrn--------------------------------rnContent.hbm.xmlrnContent.hbm.xmlrnrnrnrnrn rn rn rn rn rn rn rn rn rn rnrn rn我前几次成表bean文件时都是只有一个java文件的,这次一下生成两个了,觉得有点奇怪,那两个高底怎么使用,用平时的方法到提示Could not find a getter for id in class....请高手帮忙啊::: 论坛

Hibernate框架中的,could not find the main class 的问题

04-13

实体类如下:rncom.mys.modelrn[code=java]package com.mys.model;rn// default packagernrnimport java.util.Date;rnrnrn/**rn * User entity. @author MyEclipse Persistence Toolsrn */rnrnpublic class User implements java.io.Serializable rnrnrn // Fields rnrn private String id;rn private String userName;rn private String userPwd;rn private String sex;rn private Integer age;rn private String jiguan;rn private Date userRegisterTime;rnrnrn // Constructorsrnrn /** default constructor */rn public User() rn rnrn /** minimal constructor */rn public User(String id, String userName, String userPwd, Date userRegisterTime) rn this.id = id;rn this.userName = userName;rn this.userPwd = userPwd;rn this.userRegisterTime = userRegisterTime;rn rn rn /** full constructor */rn public User(String id, String userName, String userPwd, String sex, Integer age, String jiguan, Date userRegisterTime) rn this.id = id;rn this.userName = userName;rn this.userPwd = userPwd;rn this.sex = sex;rn this.age = age;rn this.jiguan = jiguan;rn this.userRegisterTime = userRegisterTime;rn rnrn rn // Property accessorsrnrn public String getId() rn return this.id;rn rn rn public void setId(String id) rn this.id = id;rn rnrn public String getUserName() rn return this.userName;rn rn rn public void setUserName(String userName) rn this.userName = userName;rn rnrn public String getUserPwd() rn return this.userPwd;rn rn rn public void setUserPwd(String userPwd) rn this.userPwd = userPwd;rn rnrn public String getSex() rn return this.sex;rn rn rn public void setSex(String sex) rn this.sex = sex;rn rnrn public Integer getAge() rn return this.age;rn rn rn public void setAge(Integer age) rn this.age = age;rn rnrn public String getJiguan() rn return this.jiguan;rn rn rn public void setJiguan(String jiguan) rn this.jiguan = jiguan;rn rnrn public Date getUserRegisterTime() rn return this.userRegisterTime;rn rn rn public void setUserRegisterTime(Date userRegisterTime) rn this.userRegisterTime = userRegisterTime;rn rnrn[/code]rnrn业务类如下:rncom.mys.utilrn[code=java]package com.mys.util;rn /**rn * 我们必须启动Hibernate,此过程包括创建一个全局的SessoinFactory,并把它储存在应用程序代码容易访问的地方。rn */rnrnimport java.util.List;rnrnimport com.mys.model.*;rnrnimport org.hibernate.Query;rnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.Transaction;rnimport org.hibernate.cfg.Configuration;rnpublic class HibernateUtilrnrn private static final SessionFactory sessionFactory;rnrn static rn try rn // Create the SessionFactory from hibernate.cfg.xmlrn //以前hibernate文档里的: sessionFactory = new Configuration().configure().buildSessionFactory();rn rn Configuration config=new Configuration();rn config.configure();rn config.addClass(User.class);//完整类名?rn sessionFactory=config.buildSessionFactory();rn rn catch (Throwable ex) rn // Make sure you log the exception, as it might be swallowedrn System.err.println("Initial SessionFactory creation failed." + ex);rn throw new ExceptionInInitializerError(ex);rn rn rnrn rn// 查询用户信息rn public void showUsers()rn rn Session session = sessionFactory.openSession();rn Transaction tx=null;rn tryrn tx=session.beginTransaction();rn Query query=session.createQuery("from tb_User as u");rn List list=query.list();//List是util.*类库里的接口rn System.out.println("id"+"用户名"+"用户密码"+"性别"+"年龄"+"籍贯"+"注册时间");rn for(int i=0;irnrnrnrnrn rn rn org.hibernate.dialect.MySQLDialectrn rn rn jdbc:mysql://localhost:3306/db_testrn rn rootrn 425175rn rn com.mysql.jdbc.Driverrn rn rn com.mysql.jdbc.Driverrn rn rnrn rnrn[/code]rnrn映射文件在src目录下User.hbm.xml:rn[code=html]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrn我想用Hibernate实现一个查询数据库里所有数据的功能,映射文件和实体类都是自动生成的,业务类是自己参照着数编写的。rn错误如下:rnlog4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).rnlog4j:WARN Please initialize the log4j system properly.rnInitial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource ./User.hbm.xmlrnjava.lang.ExceptionInInitializerErrorrn at com.mys.util.HibernateUtil.(HibernateUtil.java:32)rnCaused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource ./User.hbm.xmlrn at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)rn at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)rn at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)rn at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)rn at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)rn at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)rn at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)rn at com.mys.util.HibernateUtil.(HibernateUtil.java:25)rnCaused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input streamrn at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)rn at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)rn ... 7 morernCaused by: org.dom4j.DocumentException: http://hibernate.org/dtd/hibernate-mapping-3.0.dtd%20 Nested exception: http://hibernate.org/dtd/hibernate-mapping-3.0.dtd%20rn at org.dom4j.io.SAXReader.read(SAXReader.java:484)rn at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)rn ... 8 morernException in thread "main" 论坛

Could not find a getter for tblJd in class org.zero.space.entity.TblFwxx

02-25

[color=#FF0000]一个项目的登陆功能,以前还可以来着,自打使用Hibernate的hbm.xml之后,就登陆上不去了,就抱这种错误[/color][code=Java]rnrnorg.hibernate.PropertyNotFoundException: Could not find a getter for tblJd in class org.zero.space.entity.TblFwxxrn at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)rn at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)rn at org.hibernate.mapping.Property.getGetter(Property.java:260)rn at org.hibernate.tuple.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:255)rn at org.hibernate.tuple.AbstractEntityTuplizer.(AbstractEntityTuplizer.java:121)rn at org.hibernate.tuple.PojoEntityTuplizer.(PojoEntityTuplizer.java:55)rn at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)rn at org.hibernate.tuple.EntityMetamodel.(EntityMetamodel.java:257)rn at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:412)rn at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:108)rn at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)rn at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:216)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)rn at org.zero.space.util.HibernateSessionFactory.(HibernateSessionFactory.java:31)rn at org.zero.space.dao.BaseHibernateDAO.getSession(BaseHibernateDAO.java:128)rn at org.zero.space.dao.BaseHibernateDAO.search(BaseHibernateDAO.java:110)rn at org.zero.space.dao.impl.UsersHibernateDAOImpl.validateLogin(UsersHibernateDAOImpl.java:29)rn at org.zero.space.biz.impl.UserBizImpl.login(UserBizImpl.java:25)rn at org.zero.space.action.LoginAction.execute(LoginAction.java:48)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.zero.space.common.EncodingFilter.doFilter(EncodingFilter.java:28)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn%%%% Error Creating SessionFactory %%%%rnorg.hibernate.MappingException: Could not read mappings from resource: org/zero/space/entity/TblUser.hbm.xmlrn at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)rn at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)rn at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)rn at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)rn at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)rn at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)rn at org.zero.space.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69)rn at org.zero.space.util.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)rn at org.zero.space.dao.BaseHibernateDAO.getSession(BaseHibernateDAO.java:128)rn at org.zero.space.dao.BaseHibernateDAO.search(BaseHibernateDAO.java:110)rn at org.zero.space.dao.impl.UsersHibernateDAOImpl.validateLogin(UsersHibernateDAOImpl.java:29)rn at org.zero.space.biz.impl.UserBizImpl.login(UserBizImpl.java:25)rn at org.zero.space.action.LoginAction.execute(LoginAction.java:48)[/code]rnrnrnCould not find a getter for tblJd in class org.zero.space.entity.TblFwxxrn 这里TblFwxx类 和 TblJd 是 "多对一"的关系, 他说在TblFwxx 没有tblJd类的get() ,但是在我的TblFwxx类中的确存在tblJd 的get()rnrn[code=Java]public TblJd getJdid() rn return this.jdid;rn rnrn public void setJdid(TblJd jdid) rn this.jdid = jdid;rn [/code]rnrn 论坛

Could not find or load main class TestPanels.java

08-27

ubuntu下编译的java代码,能编译,但不能执行,java TestPanels之后,出现Could not find or load main class TestPanels.javarnrnrn//代码如下rn/////////////////////////////////////////////////////////////////////////////////////////////////////rn1 import java.awt.*;rn 2 import javax.swing.*;rn 3 rn 4 public class TestPanels extends JFrame rn 5 public TestPanels() rn 6 // Create panel p1 for the buttons and set GridLayourn 7 JPanel p1 = new JPanel();rn 8 p1.setLayout(new GridLayout(4, 3));rn 9 rn 10 // Add buttons to the panel rn 11 for (int i = 1; i <=9; i++) rn 12 p1.add(new JButton("" + i));rn 13 rn 14 rn 15 p1.add(new JButton("" + 0));rn 16 p1.add(new JButton("" + "START"));rn 17 p1.add(new JButton("" + "STOP"));rn 18 rn 19 // Create panel p2 tp hold a text field and p1rn 20 JPanel p2 = new JPanel(new BorderLayout());rn 21 p2.add(new JTextField("Time to be displayed here"),rn 22 BorderLayout.NORTH);rn 23 p2.add(p1, BorderLayout.CENTER);rn 24 rn 25 // Add contents into the framern 26 add(p2, BorderLayout.EAST);rn 27 add(new JButton("Food to be placed here"),rn 28 BorderLayout.CENTER);rn 29 rn 30 rn 31 /** Main method */rn 32 public static void main(String[] args) rn 33 TestPanels frame = new TestPanels();rn 34 frame.setTitle("The Front View of a Linuc System");rn 35 frame.setSize(400, 250);rn 36 frame.setLocationRelativeTo(null); // Center the framern 37 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn 38 frame.setVisible(true);rn 39 rn 40 rn"TestPanels.java" 40L, 1171C 1,1 Allrn 论坛

Could not find the main class Program will exit 解决方案

12-14

起初你或许会认为是一个莫名其妙的错误,因为代码根本一点问题的都没有,可运行期间总是报这个错,比较郁闷。rn出现Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 错误的原因,是因为我们使用高版本的JDK编译的Java class文件试图在较低版本的JVM上运行,所报的错误。rnrn“Could not find the main class. Program will exit.”rnI just installed the latest available Eclipse version (3.2 milestone 5) and couldn’t run my ANT builds anymore. The error I got in the alert box was “Could not find the main class. Program will exit”rnrn根源分析:可能是在打开方式中的javaw版本过低。比如jdk1.5编译的class文件用1.4的javaw打开就会出现这个问题。rnrn[b]解决方法1[/b]:控制面板->文件夹选项->文件类型->JAR下面的按纽rn下面选open , 点右边的,修改javaw路径,如:"C:\Program Files\Java\jdk1.5.0_10\bin\javaw.exe" -jar "%1" "%*"rnrn[b]解决方法2[/b]:还有一种情况是:rnrn变量配的....(多了点...) rnrn就两个就够用了(或者一个...) rnrnJAVA_HOME=D:\jdk1.6 rnPATH=%JAVA_HOME%\bin; rnrn应该ok了 rn还有 你的 bin目录 一定要在 D:\jdk1.6 这个下面 rn如果还有别的目录 那么 把它加上... e.g. D:\jdk1.6\XXXXrnrn[b]解决方法3[/b]:在Eclipse窗口-->首选项-->Java-->编译器-->JDK一致性-->编辑器一致性级别,从5.0改到1.4就可以了。rnrn[b]=======我最终是重装了MyEclipse,OK了========[/b][color=#008000][/color]rnrnsun公司的观点rnrnCAUSE rnrnWJView.exe or Javaw.exe cannot find the program it is trying to run. rnrnrnSOLUTION rnrnIf this error occurs during startup, it is mostly likely caused by a spyware or adware program which is missing, corrupt, or partially deleted. rnrnrnRemove Spyware/Adware rnrnUsing your favorite search engine, search for "spyware removal utility" as your search phrase. This search will help you locate many free spyware removal utilities. rnrnNote: The Spyware Removal Utility can help you get rid of this error message partially. Any new spyware can get itself downloaded to your system later. To get rid of this problem completely, try the second option given below. rnrnrnRemove WJView entries from Startup rnrnWjview lets you view Windows based Java applications. You might receive an error message if Wjview attempts to start an application on your system that no longer exists. rnrnYou may need to modify the system configuration settings to completely get rid of the error. To do so, follow these steps: rnClick Start > Run. rnThe Run dialog box appears. rnType msconfig.exe. rnClick OK. rnThe System Configuration Utility dialog box appears. rnSelect the Startup tab. rnDeselect the WJView.exe and/or javaw.exe check boxes that are associated with this problem. rnClick OK. rnYou will be prompted to restart the computer. Restart the system to apply changes. 论坛

出现了Could not find the main class的错误

12-13

我写了一个关于线程的java程序,出现了Could not find the main class的提示,错误如下java.lang.SecurityException: Prohibited package name: java.jionrn at java.lang.ClassLoader.preDefineClass(Unknown Source)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.access$100(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClassInternal(Unknown Source)rnException in thread "main" ;rnrn我的源代码:package java.jion;rnrnrnpublic class Cooking rn public static void main(String argv[])rn Thread mother=new Thread(new MotherThread());rn mother.start();rn rnrnrnrnpackage java.jion;rnrnpublic class MotherThread implements Runnable rn public void run()rn System.out.println("妈妈准备煮饭");rn System.out.println("妈妈发现米酒用完了");rn System.out.println("妈妈叫儿子去买米酒");rn Thread son=new Thread(new SonThread());rn son.start();rn System.out.println("妈妈等待儿子把米酒买回来");rn try rn son.join();rn catch (InterruptedException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn System.out.println("妈妈开始煮饭");rn System.out.println("妈妈煮好饭了");rn rn/* public static void main(String args[])rn MotherThread mother=new MotherThread();rn mother.run();rn rn */rnpackage java.jion;rnrnpublic class SonThread implements Runnable rnrn public void run()rn System.out.println("儿子出去买米酒");rn System.out.println("儿子买东西回来需要五分钟");rn try rn for(int i=0;i<=5;i++)rn rn Thread.sleep(1000);rn System.out.print(i+"分钟");rn rn catch (InterruptedException e) rn // TODO Auto-generated catch blockrn System.err.println("儿子发生意外");rn rn System.out.println("\n儿子买米酒回来了");rn rnrn谁能帮我看看 是什么地方的问题 论坛

Could not find setter for CJXJHH on class com.pyjhkcxxZhcxObj

07-24

程序报了如下错误:检查了以下pyjhkcxxZhcxObj这个类,眼拙,实在没发现什么问题,贴出来,麻烦谁能解决以下额。rnrn[code=text]org.hibernate.PropertyNotFoundException: [u]Could not find setter for CJXJHH on class com.pyjhkcxxZhcxObj[/u][u][/u]rn at org.hibernate.property.ChainedPropertyAccessor.getSetter(ChainedPropertyAccessor.java:68)rn at org.hibernate.transform.AliasToBeanResultTransformer.transformTuple(AliasToBeanResultTransformer.java:87)rn at org.hibernate.hql.HolderInstantiator.instantiate(HolderInstantiator.java:92)rn at org.hibernate.loader.custom.CustomLoader.getResultList(CustomLoader.java:353)rn at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)rn at org.hibernate.loader.Loader.list(Loader.java:2124)rn at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)rn at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)rn at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)rn at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)rn at com.baseDao.BaseHibernateDAO.pyjhkcxxZhcx(BaseHibernateDAO.java:246)rn at com.service.impl.JyPyjhkcxxServiceImpl.pyjhkcxxZhcx(JyPyjhkcxxServiceImpl.java:531)rn at com.controls.JyPyjhkcxxController.pyjhkcxxZhcx(JyPyjhkcxxController.java:402)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:418)rn at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)rn at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)rn at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)rn at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)rn at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)rn at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)rn at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)rn at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)rn at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)rn at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:353)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)rn at java.lang.Thread.run(Thread.java:619)rn[/code]rnrn类rn[code=java]rnrnpublic class pyjhkcxxZhcxObj rn rn private String cjxjhh="";rnrn ………………rnpublic String getCjxjhh() rn return cjxjhh;rn rn public void setCjxjhh(String cjxjhh) rn this.cjxjhh = cjxjhh;rn rn………………rnrn[/code] 论坛

没有更多推荐了,返回首页