Error on initialization of server mk-worker (stormconf.ser is missing)

Error on initialization of server mk-worker (stormconf.ser is missing)
2 名作者发布了 13 个帖子
 
 
Moshe Bixenshpaner
12-8-10
Hi guys,

I have a simple topology that puts values on a Redis server.
When I deploy it, no client gets to connect Redis, although it works perfectly fine when I run it via LocalCluster.
I attached logs and conf for the nimbus and the supervisors.

The cluster is configured as following:
  • 1GB RAM for the nimbus (192.168.1.22)
  • 1GB RAM for the zookeeper1 (192.168.1.31)
  • 2GB RAM for the supervisor1 (192.168.1.16; 4 workers)
  • 2GB RAM for the supervisor2 (192.168.1.19; 2 workers)

All machines are virtual and have JDK 6u33 x64 installed.
nimbus, supervisor1 & supervisor2 have Storm 0.8.0, ZeroMQ 2.1.7 and the latest JZMQ installed.
zookeeper1 has Python 2.6.6 (with default configuration) and Zookeeper 3.3.6 installed.


I'm not sure this is the entire problem, but I'm getting the following exception on some of my supervisors (in our case - supervisor2):
2012-08-10 08:21:27 worker [ERROR] Error on initialization of server mk-worker
java.io.FileNotFoundException: File '/opt/storm/local/supervisor/stormdist/DistributedSystem-1-1344586762/stormconf.ser' does not exist
at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:137)
at org.apache.commons.io.FileUtils.readFileToByteArray(FileUtils.java:1135)
at backtype.storm.config$read_supervisor_storm_conf.invoke(config.clj:138)
at backtype.storm.daemon.worker$worker_data.invoke(worker.clj:146)
at backtype.storm.daemon.worker$fn__4316$exec_fn__1206__auto____4317.invoke(worker.clj:331)
at clojure.lang.AFn.applyToHelper(AFn.java:185)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(c ore.clj:601)
at backtype.storm.daemon.worker$fn__4316$mk_worker__4372.doInvoke(worker.clj:322)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at backtype.storm.daemon.worker$_main.invoke(worker.clj:432)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.AFn.applyTo(AFn.java:151)
at backtype.storm.daemon.worker.main(Unknown Source)
2012-08-10 08:21:27 util [INFO] Halting process: ("Error on initialization")


The topology I'm trying to run requires 4 workers altogether.
So even if supervisor2 dysfunctions, the other supervisor should be able to run the entire topology on its own.
Am I doing something wrong here?


Thanks,
Moshe.
附件 (1)
logs.rar
38 KB   查看   下载
nathanmarz
12-8-13
Are your supervisors sharing a directory over a network mount, by any chance? What happens if you turn off supervisor2 completely? Do topologies launch successfully on the other supervisor?
- 显示引用文字 -
--
Twitter: @nathanmarz
http://nathanmarz.com

Moshe Bixenshpaner
12-8-14
No, supervisors don't share directories.
They are virtual machines created by kvm though (I'm not sure if it has anything to do with the problem).

If I have enough workers on a single supervisor, everything works perfectly fine.
It seems the coordination between the supervisors is the cause of the problem.

Thanks,
Moshe.
- 显示引用文字 -
nathanmarz
12-8-14
The error you're facing indicates that the supervisor failed to download the configuration file from Nimbus. Can you show me the results of doing an ls -R on the supervisor local dir for the node that's getting that error? (do it while the topology is active and causing the error – that is, don't shut it down and then do the ls -R). 
- 显示引用文字 -
此帖已被删除。
Moshe Bixenshpaner
12-8-14
Hi,

I attached the local directory and log files for nimbus and each of the supervisors.
sv2 is the supervisor that fails to load.

Thanks,
Moshe.
- 显示引用文字 -
附件 (6)
nb-local.tar
366 KB   查看   下载
nb-logs.tar
4 KB   查看   下载
sv1-local.tar
187 KB   查看   下载
sv1-logs.tar
27 KB   查看   下载
sv2-local.tar
187 KB   查看   下载
sv2-logs.tar
22 KB   查看   下载
nathanmarz
12-8-15
I would need you to do the ls -R while the error is happening and the topology is still active.
- 显示引用文字 -
Moshe Bixenshpaner
12-8-15
This is exactly what I did (only I attached a tar file or the entire local directory, instead of just attaching the output from an ls -R).
- 显示引用文字 -
nathanmarz
12-8-17
I don't quite understand – you said you did the ls -R a few days after the exception happened.
- 显示引用文字 -
Moshe Bixenshpaner
12-8-17
I deleted that post, the one I posted eventually was after I reset everything, reproduced the whole thing and attached logs and contents of local directories.
- 显示引用文字 -
nathanmarz
12-8-17
The sv2 logs don't show any exceptions.
- 显示引用文字 -
Moshe Bixenshpaner
12-8-26
Hi Nathan,

Log files of both SV2 workers show the logs show java.io.FileNotFoundException: File '/opt/storm/local/supervisor/stormdist/DistributedSystem-1-1344956702/stormconf.ser' does not exist followed by Halting process: ("Error on initialization").
On another note, the ZK1 log shows that clients are disconnecting every few seconds.
- 显示引用文字 -
Moshe Bixenshpaner
12-8-26
Hey guys,

Problem is solved.
There were actually two of them:
1. The documentation specify to use a specific version of ZeroMQ, JZMQ, Python and JDK but doesn't specify anything about the Zookeeper, I assumed I can use the newest version (3.3.6) but it turned out to be a bad move. After a week with poor performance, I checked the jars attached to Storm 0.8.0 and I saw that it is aimed for Zookeeper 3.3.3.

2. I'm not sure how it is with real clusters, but on virtual cluster you need to have each node specified in the /etc/hosts file of all other nodes - pay attention to the following form:
ip_address host_name.defaultdomain

Notice the .defaultdomain at the end of each host name - this was what actually solved the problem of having a cluster of supervisors working together simultaneously.
- 显示引用文字 -
展开阅读全文

ERROR - Context initialization failed

01-06

以下是我配置applicationContext.xml文件,启动服务时出现以下错误,请高手指教:rnERROR - Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSources' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:rnPropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver]; nested exception is java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriverrnCaused by: rnorg.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:rnPropertyAccessException 1:rnorg.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver]; nested exception is java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriverrnCaused by: rnorg.springframework.jdbc.CannotGetJdbcConnectionException: Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver]; nested exception is java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriverrnCaused by: rnjava.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriverrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Class.java:247)rn at org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(DriverManagerDataSource.java:146)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 org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:821)rn at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)rn at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)rn at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1122)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)rn at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:354)rn at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:295)rn 论坛

syntax error : missing ';' before '<'

09-07

代码如下:rn错误:syntax error : missing ';' before '<'rn原工程是vs2005的,我在vc6.0下编译有误。如题所示。求指点。rn[code=C/C++]#pragma oncernrnrnclass CListCtrl_Column_Picker : public CListCtrlrnrn struct ColumnStatern rn ColumnState()rn :m_Visible(false)rn ,m_OrgWidth(0)rn ,m_OrgPosition(-1)rn rn bool m_Visible;rn int m_OrgWidth; // Width it had before being hiddenrn int m_OrgPosition; // Position it had before being hiddenrn ;rn CSimpleArray m_ColumnStates;//error here,提示这里错误如题rn int GetColumnStateCount();rn void InsertColumnState(int nCol, bool bVisible, int nOrgWidth = 0);rn void DeleteColumnState(int nCol);rn ColumnState& GetColumnState(int nCol);rn rn DECLARE_MESSAGE_MAP()rn rn virtual afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);rn virtual afx_msg LRESULT OnDeleteColumn(WPARAM wParam, LPARAM lParam);rn virtual afx_msg LRESULT OnInsertColumn(WPARAM wParam, LPARAM lParam);rn virtual afx_msg LRESULT OnSetColumnWidth(WPARAM wParam, LPARAM lParam);rn virtual afx_msg BOOL OnHeaderBeginResize(UINT id, NMHDR* pNmhdr, LRESULT* pResult);rn virtual afx_msg BOOL OnHeaderEndDrag(UINT id, NMHDR* pNmhdr, LRESULT* pResult);rn virtual afx_msg void OnContextMenu(CWnd*, CPoint point);rn virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);rn rn virtual void PreSubclassWindow();rn rn public:rn bool IsColumnVisible(int nCol);rn int GetFirstVisibleColumn();rn BOOL ShowColumn(int nCol, bool bShow);rn BOOL SetColumnWidthAuto(int nCol = -1, bool includeHeader = false);rn;[/code] 论坛

error C129: missing ';' before ''

08-25

Build target 'Target 1'rnassembling STARTUP.A51...rncompiling main.c...rncompiling delay.c...rncompiling settingtime.c...rncompiling VTK_dis_zhuantai.c...rncompiling dht11.c...rncompiling app.c...rnAPP.C(9): error C129: missing ';' before ''rnTarget not createdrnrnrn找不到哪里出了错rnrnrnrn#include"app.h"rninclude"reg52.h"rn//#include"gsm.h"rn//#include"delay.h"rnrnrnrn//static void gpio_init(void);rnvoid timer0_init(void); //问题就在这里rnvoid com_init(void);rnvoid interrupt_init(void);rnvoid timer2_init(void);rn//static void CNMIinit(void); rnrnrnrnvoid hardware_init(void)rnrn //gpio_init();rn timer0_init();rn com_init();rn interrupt_init();rn timer2_init();rn //CNMIinit(); rnrnrnvoid timer0_init(void)rnrn TH0=(unsigned char)((65536-50000)>>8);rn TH0=(unsigned char)(65536-50000);rn TMOD|=0X01;rn TR0=1;rn ET0=1;rn //EA=1;rnrnrnrnvoid com_init(void)rnrn SCON = 0x50;//方式1,允许接收 rn TMOD |= 0x20; //T1作波特率发生器,工作方式2rn //PCON = 0x80;//设定波特率,11.0592MHz,19200bpsrn TH1 = 0xfd;//rn TL1 = 0xfd;//rn TR1 = 1;//启动T1rn // EA = 0; //关中断rn // ES = 0; //关串行接口中断rnrnrnrnvoid timer2_init(void)rnrn EXF2=0; /* reset flag 定时器2外部标志位清除*/rn rn TCLK=0;RCLK=0; /* disable baud rate generator 不用于波特率发生器*/rn rn EXEN2=0; /* ignore events on T2EX 视T2EX(P1.1)端信号无效*/rn rn TH2=0xd8; /* Init msb_value 填入初始化值*/rn rn TL2=0xf0; /* Init lsb_value */rn rn RCAP2H=0xd8; /* reload msb_value重载值 */rn rn RCAP2L=0xf0; /* reload lsb_value */rn rn C_T2=0; /* timer mode 定时模式*/rn rn CP_RL2=0; /* reload mode 重载模式*/rn rn ET2=1; /* enable timer2 interrupt 允许T2中断*/rn rn TR2=1; /* timer2 run 开始计时*/rnrnrnrnvoid interrupt_init(void)rnrn EA=1;rnrn 论坛

ERROR org.springframework.web.context.ContextLoader Context initialization faile

05-16

0 main ERROR org.springframework.web.context.ContextLoader Context initialization failed rnjava.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment; rn at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87) rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) rn at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294) rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215) rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135) rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546) rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) rn at org.apache.catalina.core.StandardService.start(StandardService.java:519) rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) rn at org.apache.catalina.startup.Catalina.start(Catalina.java:581) 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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) rn启动tomcat总是提示上面的错误,请知道的前辈指点一下!万分感谢!!也不知道是缺啥还是没配置好! 论坛

ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed

05-27

异常:rnERROR [org.springframework.web.context.ContextLoader] - Context initialization failedrnjava.lang.SecurityException: class "org.springframework.context.support.AbstractRefreshableApplicationContext"'s signer information does not match signer information of other classes in the same packagern at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)rn at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:614)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:620)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:620)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)rn ...................rn at org.apache.catalina.startup.Catalina.start(Catalina.java:566)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:585)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rn2008-5-27 12:53:19 org.apache.catalina.core.StandardContext listenerStartrn严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnjava.lang.SecurityException: class "org.springframework.context.support.AbstractRefreshableApplicationContext"'s signer information does not match signer information of other classes in the same packagern at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)rn at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:614)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:620)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:620)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rn at java.lang.ClassLoader.defineClass1(Native Method)rn ...........rn at java.lang.reflect.Method.invoke(Method.java:585)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rn2008-5-27 12:53:19 org.apache.catalina.core.StandardContext startrn严重: Error listenerStartrn是在webwork 与spring整合的时候发生的异常。 论坛

ERROR org.springframework.web.context.ContextLoader:224 - Context initialization

06-09

java.lang.NoClassDefFoundError: org/hibernate/MappingExceptionrnrnCaused by: java.lang.ClassNotFoundException: org.hibernate.MappingExceptionrnrnStruts2.1+Spring3.0+hibernate3.3 。配完spring+ hibernate 后一切正常。但是加入STRUTS 后,一起动TOMCAT 就报以上异常,rn但是单独用junit测试 方法仍能允许。rnapplicationContext.xmlrnrn rn rn rn rn rn com.hit.modelrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rnrnweb.xmlrnrnrn rn login.jsprn rn rn contextConfigLocationrn classpath:applicationContext.xml rn rn rn rn org.springframework.web.context.ContextLoaderListener rn rn rn struts2rn rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rn rn rn struts2rn *.actionrn rnstruts.xmlrnrnrnrnrn rn rn rn /index.jsprn rn rn rnpackage com.hit.adcion;rnrnimport javax.annotation.Resource;rnrnimport org.springframework.stereotype.Component;rnrnimport com.hit.service.AdminService;rnimport com.opensymphony.xwork2.ActionSupport;rnrn@Componentrnpublic class AdminAction extends ActionSupportrnrn private AdminService adminService;rn private String name;rn private String password;rn public String login()rn rn return SUCCESS;rn rn public AdminService getAdminService() rn return adminService;rn rn public String getName() rn return name;rn rn public String getPassword() rn return password;rn rn @Resource(name ="adminService")rn public void setAdminService(AdminService adminService) rn this.adminService = adminService;rn rn public void setName(String name) rn this.name = name;rn rnrn public void setPassword(String password) rn this.password = password;rn rn 论坛

ERROR [org.springframework.web.context.ContextLoader] Context initialization fai

05-16

信息: validateJarFile(E:\apache-tomcat-6.0.29\webapps\zbxt\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.classrnlog4j:WARN No such property [conversionPattern] in org.apache.log4j.HTMLLayout.rn2011-5-16 17:01:07 org.apache.catalina.core.ApplicationContext logrn信息: Initializing Spring root WebApplicationContextrn2011-05-16 17:01:08 ERROR [org.springframework.web.context.ContextLoader] Context initialization failedrnjava.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;rn at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)rn at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)rn at org.apache.catalina.core.StandardService.start(StandardService.java:519)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:581)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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rn2011-5-16 17:01:08 org.apache.catalina.core.StandardContext listenerStartrn严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnjava.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;rn at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)rn at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)rn at org.apache.catalina.core.StandardService.start(StandardService.java:519)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:581)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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rn2011-5-16 17:01:08 org.apache.catalina.core.StandardContext startrn严重: Error listenerStartrn2011-5-16 17:01:08 org.apache.catalina.core.StandardContext startrn严重: Context [/zbxt] startup failed due to previous errorsrn2011-5-16 17:01:08 org.apache.catalina.core.ApplicationContext logrn信息: Closing Spring root WebApplicationContextrn2011-5-16 17:01:08 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbcrn严重: The web application [/zbxt] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.rn各位前辈们,刚配好的项目,启动的时候提示这个错误,也不知道是那块的问题,折腾好久了!先谢谢各位前辈了啊! 论坛

ERROR org.apache.struts2.dispatcher.Dispatcher - Dispatcher initialization faile

05-03

启动web项目控制台出现下面的错误rn22:58:39.941 [main] ERROR org.apache.struts2.dispatcher.Dispatcher - Dispatcher initialization failedrncom.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) ~[xwork-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:978) ~[struts2-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) ~[struts2-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) [struts2-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) [struts2-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) [struts2-core-2.3.34.jar:2.3.34]rn at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:283) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4481) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5121) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415) [catalina.jar:9.0.0.M22]rn at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_161]rn at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.0.M22]rn at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [?:1.8.0_161]rn at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1425) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1415) [catalina.jar:9.0.0.M22]rn at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_161]rn at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.0.M22]rn at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [?:1.8.0_161]rn at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.0.M22]rn at org.apache.catalina.startup.Catalina.start(Catalina.java:657) [catalina.jar:9.0.0.M22]rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]rn at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) [bootstrap.jar:9.0.0.M22]rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) [bootstrap.jar:9.0.0.M22]rnCaused by: com.opensymphony.xwork2.config.ConfigurationException: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactoryrn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247) ~[xwork-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) ~[struts2-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240) ~[xwork-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.34.jar:2.3.34]rn ... 38 morernCaused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAwarern at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_161]rn at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_161]rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_161]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2257) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:799) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1238) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ~[catalina.jar:9.0.0.M22]rn at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_161]rn at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_161]rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_161]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2257) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:799) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1238) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ~[catalina.jar:9.0.0.M22]rn at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144) ~[xwork-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:218) ~[xwork-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) ~[struts2-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240) ~[xwork-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.34.jar:2.3.34]rn ... 38 morernCaused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextAwarern at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1269) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ~[catalina.jar:9.0.0.M22]rn at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_161]rn at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_161]rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_161]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2257) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:799) ~[catalina.jar:9.0.0.M22]rn at org.apache.catali五月 03, 2018 10:58:39 下午 org.apache.coyote.AbstractProtocol startrn信息: Starting ProtocolHandler ["http-nio-8080"]rnna.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1238) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ~[catalina.jar:9.0.0.M22]rn at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_161]rn at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_161]rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_161]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2257) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:799) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1238) ~[catalina.jar:9.0.0.M22]rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ~[catalina.jar:9.0.0.M22]rn at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144) ~[xwork-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:218) ~[xwork-core-2.3.34.jar:2.3.34]rn at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) ~[struts2-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240) ~[xwork-core-2.3.34.jar:2.3.34]rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.34.jar:2.3.34]rn ... 38 more 论坛

error C2143: syntax error : missing ';' before '&'

03-04

  最近自己写了String类,包含三个文件:String.h、String.cpp和main.cpp。rn  在String.h中标为红色的那行出现了error C2143: syntax error : missing ';' before '&'。如何解决?rnrn// String.hrn#include rn#include rn#include rnrnclass Stringrn char* s;rn int size;rnrnpublic:rn String();rn String(char*);rn ~String();rnrn //copy constructor, copy assignmentrn String(const String&);rn String& operator=(const String&);rnrn int computeSize() const;rnrn friend bool operator==(const String&, const char*);rn friend bool operator==(const String&, const String&);rn friend bool operator!=(const String&, const char*);rn friend bool operator!=(const String&, const String&);rnrn //conversion to C-style string;rn char* convert2CStyle(const String&);rnrn //concatenationrn String& operator+=(const String&);rn String& operator+=(const char*);rnrn //I/O streamsrn [color=#FF0000]friend ostream& operator<<(ostream&, const String&);[/color]rn friend istream& operator>>(istream&, String&);rn;rnrnString operator+(const String&, const String&);rnString operator+(const String&, const char*);rnrn// String.cpprn#include "String.h"rnrnString::String() ;rnrnString::String(char* cp)rnrn size = strlen(cp);rn s = new char[size+1];rn strcpy(s, cp);rnrnrnString::~String()rnrn delete[] s;rnrnrn//copy constructor, copy assignmentrnString::String(const String& str)rnrn s = str.s;rn size = str.size;rnrnrnString& String::operator=(const String& str)rnrn if(size != str.size)rn size = str.size;rn delete[] s; // 有无必要?rn s = new char[size+1];rn rn strcpy(s, str.s);rnrnrnint String::computeSize() constrnrn return size;rnrnrnbool String::operator==(const String& str1, const char* str2)rnrn return strcmp(str1.s, str2)==0;rnrnrnbool String::operator==(const String& str1, const String& str2)rnrn return strcmp(str1.s, str2.s)==0;rnrnrnbool String::operator!=(const String& str1, const char* str2)rnrn return strcmp(str1.s, str2)!=0;rnrnrnbool String::operator!=(const String& str1, const String& str2)rnrn return strcmp(str1.s, str2.s)!=0;rnrnrn//conversion to C-style string;rnchar* String::convert2CStyle(const String& str)rn/********************************************rn A problem in the implementation:rn If the object whose member s is returnedrn is destructed, the value of s is meaningrn -less and may cause disaster.rn *******************************************/rnrn return str.s;rnrnrn//concatenationrnString& String::operator+=(const String& str)rnrn size += str.size;rn char* sp = 0;rn strcpy(sp, str.s);rn delete[] s;rn s = new char[size+1];rn s = strcat(sp, str.s);rn return *this;rnrnrnString& String::operator+=(const char* cStr)rnrn size += strlen(cStr);rn char* sp = 0;rn strcpy(sp, cStr);rn delete[] s;rn s = new char[size+1];rn s = strcat(sp, cStr);rn return *this;rnrnrn//I/O streamsrnostream& String::operator<<(ostream&, const String&)rnrn // to be implementedrnrnrnistream& String::operator>>(istream&, String&)rnrn // to be implementedrnrnrnString operator+(const String& str1, const String& str2)rnrn char* sp = 0;rn strcpy(sp, str1.s);rn strcat(sp, str2.s);rn return String(sp);rnrnrnString operator+(const String& str1, const char* str2)rnrn char* sp = 0;rn strcpy(sp, str1.s);rn strcat(sp, str2);rn return String(sp);rnrnrn// main.cpprn#include "String.h"rnrnusing std::cout;rnusing std::cerr;rnusing std::bad_alloc;rnrnint main()rnrn String str1 = String("msdn");rn bool flag = str1=="csdn";rn if (flag)rn // cout << str1 << "==csdn\n";rn cout << "msdn==csdn\n" << "An error happened.\n";rn elsern cout << "msdn!=csdn\n";rn rn String str2 = String("csdn");rn flag = str1!=str2;rn if (flag)rn cout << "msdn!=csdn\n";rn elsern cout << "An error happened.\n" << "msdn==csdn\n";rn rn 论坛

error C2143: syntax error : missing ';' before '*'

05-26

我在一个类中添加一个成员变量rnclass CMySocket : public CAsyncSocket rnrnrnpublic:rn CMySocket();rn virtual ~CMySocket();rnprivate:rn CTalkDlg* m_pDlg; //*******这里出错rn;rnrn什么都还不做,就是放在这里rn结果编译报错:rnrn--------------------Configuration: Talk - Win32 Debug--------------------rnCompiling...rnTalk.cpprnd:\works\msworks\talk\mysocket.h(23) : error C2143: syntax error : missing ';' before '*'rnd:\works\msworks\talk\mysocket.h(23) : error C2501: 'CTalkDlg' : missing storage-class or type specifiersrnd:\works\msworks\talk\mysocket.h(23) : error C2501: 'm_pDlg' : missing storage-class or type specifiersrnGenerating Code...rnCompiling...rnTalkDlg.cpprnd:\works\msworks\talk\mysocket.h(23) : error C2143: syntax error : missing ';' before '*'rnd:\works\msworks\talk\mysocket.h(23) : error C2501: 'CTalkDlg' : missing storage-class or type specifiersrnd:\works\msworks\talk\mysocket.h(23) : error C2501: 'm_pDlg' : missing storage-class or type specifiersrnGenerating Code...rnCompiling...rnMySocket.cpprnd:\works\msworks\talk\mysocket.h(23) : error C2143: syntax error : missing ';' before '*'rnd:\works\msworks\talk\mysocket.h(23) : error C2501: 'CTalkDlg' : missing storage-class or type specifiersrnd:\works\msworks\talk\mysocket.h(23) : error C2501: 'm_pDlg' : missing storage-class or type specifiersrnGenerating Code...rnError executing cl.exe.rnrnTalk.exe - 9 error(s), 0 warning(s)rnrn这是什么原因?!rn我已经把#include "TalkDlg.h"加入到CMySocket.h里面了rn//去掉private:rn CTalkDlg* m_pDlg; //这个rn就什么问题都没有 论坛

请教:error C2143: syntax error : missing ';' before '&'

06-20

c++primer中的3.15类类型中的例子,用vc++2003编译rnrn//String.hrn#include rn#include rn#include rnrnrnrnclass Stringrnrnpublic:rn //a set of overload constructorrn //provide initializern //string str1; //string()rn //string str2("literal") //string (const char*);rn //string str3(str2);//string (const string&);rnrn String();rn String(const char*);rn String (const String&);rn //deconstructor:autorn ~String();rn //rn String& operator=(const String&);rn String&operator=(const char*);rn //rn bool operator==(const String&);rn bool operator==(const char*);rn //rn char& operator[](int);rn //rn int size()return _size;rn char *c_str()return _string; rnrnprivate:rn int _size;rn char *_string;rn;rninline String::String()rnrn _size=0;rn _string=0;rnrninline String::String(const char*str)rnrn if (!str)rn rn _size=0;rn _string=0;rn rn else rn rn _size=strlen(str);rn _string=new char[_size+1];rn strcpy(_string,str);rn rnrnrninline String::String(const String&rhs)rnrn _size=rhs._size;rn if (!rhs._string)rn _string=0;rn elsern rn _string=new char[_size+1];rn strcpy(_string,rhs._string);rn rnrninline String::~String()rnrn delete [] _string;rnrninline bool String::operator==(const String &rhs)rnrn if(_size!=rhs._size)rn return false;rn return strcmp(_string,rhs._string)?false:true;rnrninline bool String::operator==(const char*str)rnrn if(_size!=strlen(str))rn return false;rn return strcmp(_string,str)?false:true;rnrninline String &String::operator=(const String&rhs)rnrn if(this!=&rhs)rn rn delete [] _string;rn _size=rhs._size;rn if (!rhs._string)rn _string=0;rn elsern rn _string=new char[_size+1];rn strcpy(_string,rhs._string);rn rn rn return *this;rnrninline String &String::operator=(const char*s)rnrn if (!s)rn rn _size=0;rn delete [] _string;rn _string=0;rn rn elsern rn rn _size=strlen(s);rn delete [] _string;rn _string=new char[_size+1];rn strcpy(_string,s);rn return *this;rn rnrnrninline char&String::operator[](int elem)rnrn assert(elem<0&&elem>_size);rn return _string[elem];rnrninline istream&rnoperator>>( istream &io, String &s )rnrn // 人工限制最多4096 个字符rn const int limit_string_size = 4096;rn char inBuf[ limit_string_size ];rn // setw()是iostream 库的一部分rn // 限制被读取的字符个数为limit_string_size-1rn io >> setw( limit_string_size ) >> inBuf;rn s = inBuf; // String::operator=( const char* );rn return io;rnrninline ostream&rnoperator<<( ostream& os, String &s )rnrn return os << s.c_str();rnrn//rnrn//String.crn#include rn#include "String.h"rnrnusing std::endl;rnusing std::cin;rnusing std::cout;rnrnrnrnint main()rnrn int aCnt=0,eCnt=0,iCnt=0,oCnt=0,uCnt=0,theCnt=0,itCnt=0,wdCnt=0,notVowel=0;rn String buf,the("the"),it("it");rn while (cin>>buf)rn ++wdCnt;rn cout<>'' : missing storage-class or type specifiersrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(126) : error C2078: too many initializersrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(127) : error C2143: syntax error : missing ';' before ''rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(127) : error C2447: '' : missing function header (old-style formal list?)rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(137) : error C2143: syntax error : missing ';' before '&'rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(137) : error C2433: 'ostream' : 'inline' not permitted on data declarationsrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(137) : error C2501: 'ostream' : missing storage-class or type specifiersrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(138) : error C2065: 'os' : undeclared identifierrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(138) : error C2275: 'String' : illegal use of this type as an expressionrn e:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(9) : see declaration of 'String'rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(138) : error C3861: 's': identifier not found, even with argument-dependent lookuprne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(138) : error C2501: 'operator`<<'' : missing storage-class or type specifiersrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(138) : error C2078: too many initializersrne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(139) : error C2143: syntax error : missing ';' before ''rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.h(139) : error C2447: '' : missing function header (old-style formal list?)rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.cpp(14) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'String' (or there is no acceptable conversion)rne:\StuPractic\vc2003\C++primer\ch3\class\string\String.cpp(14) : fatal error C1903: unable to recover from previous error(s); stopping compilationrnrnBuild log was saved at "file://e:\StuPractic\vc2003\C++primer\ch3\class\string\Debug\BuildLog.htm"rnstring - 22 error(s), 2 warning(s)rnrnrn---------------------- Done ----------------------rnrn Build: 0 succeeded, 1 failed, 0 skippedrn 论坛

error C2143: syntax error : missing ';' before 'constant'

01-18

新建了个工程,创建了个Dilog,直接编译却报错:rnerror C2143: syntax error : missing ';' before 'constant'rn fatal error C1004: unexpected end of file foundrnrn把代码贴出来,请大家帮看看,哦对VC不熟rn----------------------------------------------------------------------rn// myDialog.cpp : implementation filern//rn#include "stdafx.h"rn#include "test.h"rn#include "myDialog.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#undef THIS_FILErnstatic char THIS_FILE[] = __FILE__;rn#endifrnrn/////////////////////////////////////////////////////////////////////////////rn// myDialog dialogrnrnrnmyDialog::myDialog(CWnd* pParent /*=NULL*/)rn : CDialog(myDialog::IDD, pParent)rnrn //AFX_DATA_INIT(myDialog)rn // NOTE: the ClassWizard will add member initialization herern //AFX_DATA_INITrnrnrnrnvoid myDialog::DoDataExchange(CDataExchange* pDX)rnrn CDialog::DoDataExchange(pDX);rn //AFX_DATA_MAP(myDialog)rn // NOTE: the ClassWizard will add DDX and DDV calls herern //AFX_DATA_MAPrnrnrnrnBEGIN_MESSAGE_MAP(myDialog, CDialog)rn //AFX_MSG_MAP(myDialog)rn // NOTE: the ClassWizard will add message map macros herern //AFX_MSG_MAPrnEND_MESSAGE_MAP()rnrnrn--------------------------------------------------------------------------------------rn#if !defined(AFX_MYDIALOG_H__552BDBFB_BF7A_4D7B_B2EE_55BF85414DBC__INCLUDED_)rn#define AFX_MYDIALOG_H__552BDBFB_BF7A_4D7B_B2EE_55BF85414DBC__INCLUDED_rnrn#if _MSC_VER > 1000rn#pragma oncern#endif // _MSC_VER > 1000rn// myDialog.h : header filern//rnrn/////////////////////////////////////////////////////////////////////////////rn// myDialog dialogrnrnclass myDialog : public CDialogrnrn// Constructionrnpublic:rn myDialog(CWnd* pParent = NULL); // standard constructorrnrn// Dialog Datarn //AFX_DATA(myDialog)rn enum IDD = myDialog ;rn // NOTE: the ClassWizard will add data members herern //AFX_DATArnrnrnrnrn// Overridesrn // ClassWizard generated virtual function overridesrn //AFX_VIRTUAL(myDialog)rn protected:rn virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV supportrn //AFX_VIRTUALrnrn// Implementationrnprotected:rnrn // Generated message map functionsrn //AFX_MSG(myDialog)rn // NOTE: the ClassWizard will add member functions herern //AFX_MSGrn DECLARE_MESSAGE_MAP()rn;rnrn//AFX_INSERT_LOCATIONrn// Microsoft Visual C++ will insert additional declarations immediately before the previous line.rnrn#endif // !defined(AFX_MYDIALOG_H__552BDBFB_BF7A_4D7B_B2EE_55BF85414DBC__INCLUDED_)rn 论坛

error C2146: syntax error : missing ';' before identifier

09-23

//编写DLL实现导出变量、函数、类。rn//interface.hrn#ifndef _EXPORTrn#define VARABLE_EXPORT extern "C" __declspec(dllimport)rn#define FUNCTION_EXPORT extern "C" __declspec(dllimport)rn#define CLASS_DECLARE __declspec(dllimport)rn#elsern#define VARABLE_EXPORT extern "C" __declspec(dllexport)rn#define FUNCTION_EXPORT extern "C" __declspec(dllexport)rn#define CLASS_DECLARE __declspec(dllexport)rn#endifrnrntypedef struct __POSTTIONrnrn int x;rn int y;rnPOSTTION, *PPOSTTION;rnrnVARABLE_EXPORT POSTTION pos;rnVARABLE_EXPORT int value;rnrnFUNCTION_EXPORT int WINAPI FUN_Add(int a, int b);rnFUNCTION_EXPORT int WINAPI FUN_Mul( int a, int b);rnrnrnclass CLASS_DECLARE CPerson()rnrnprivate:rn char szName[128];rn int age;rnpublic:rn CPerson();rn ~CPerson();rn CPerson(char* lpName, int iAge);rnpublic:rn char* GetName();rn int GetAge();rn;rnrn//DllMain.cpp具体实现rn#include "interface.h"rn#define _EXPORT rnBOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)rnrn switch(fdwReason)rn rn case DLL_PROCESS_ATTACH:rn value =5;rn pos.x = 6;rn pos.y = 7;rn break;rn rn return true;rnrnint WINAPI FUN_Add(int a, int b)rnrn return a+b;rnrnint WINAPI FUN_Mul(int a, int b)rnrn return a-b;rnrnrnCPerson::CPerson()rnCPerson::~CPerson()rnCPerson::CPerson(char * lpName, int iAge)rnrn this->Age = iAge;rn if(lpName)rn rn int len = strlen(lpName);rn if(len >= 127)rn rn len = 127;rn rn memcpy(this->szName, lpName, len);rn this->szName[len] = 0;rn rnrnchar* CPerson::GetName()rnrn return this->szName;rnrnint CPerson::GetAge()rnrn return this->Age;rnrnrn编译:rnd:\dll\dllsample\interface.h(20) : error C2146: syntax error : missing ';' before identifier 'FUN_Add'rnd:\dll\dllsample\interface.h(20) : fatal error C1004: unexpected end of file found 论坛

error C2143: syntax error : missing ')' before ';'

09-25

// BaseShape.h: interface for the CBaseShape class.rn//rn//////////////////////////////////////////////////////////////////////rn#include rn#if !defined(AFX_BASESHAPE_H__5560A1CB_33C2_40B1_A088_B09708FBB741__INCLUDED_)rn#define AFX_BASESHAPE_H__5560A1CB_33C2_40B1_A088_B09708FBB741__INCLUDED_rnrn#if _MSC_VER > 1000rn#pragma oncern#endif // _MSC_VER > 1000rnrnclass CBaseShape rnrnprotected:rn COLORREF m_penColor;rn INT m_penWidth;rn INT m_shapeType;rnrnpublic:rn CBaseShape();rn virtual ~CBaseShape();rnrnrnpublic :rn virtual void draw(CDC *pdc);rn virtual void setStartPoint(POINT startPoint);rn virtual void setEndPoint(POINT endPoint);rn virtual void addPoint(POINT morePoint);rnrn;rnrnclass CLine: public CBaseShapernrnpublic:rn CLine(COLORREF color=RED);rn virtual ~CLine();rn void draw(CDC *pdc);rn void setStartPoint(POINT startPoint);rn void setEndPoint(POINT endPoint);rnprivate:rn CPoint m_leftPoint;rn CPoint m_rightPoint;rn;rnrnclass CCircle:public CBaseShapernrnpublic :rn CCircle(COLORREF color=RED);rn virtual ~CCircle();rn void draw(CDC *pdc);rn void setStartPoint(POINT startPoint);rn void setEndPoint(POINT endPoint);rnprivate:rn CPoint m_leftPoint;rn CPoint m_rightPoint;rn;rnrnclass CCircuit : public CBaseShapernrnpublic:rn CCircuit(COLORREF color=RED);rn virtual ~CCircuit();rn void draw(CDC *pdc);rn void addPoint(POINT morePoint);rn rnprivate:rn CArray m_points;rn;rnrnclass CEllipse : public CBaseShapernrnpublic :rn CEllipse(COLORREF color=RED);rn virtual ~CEllipse();rn void draw(CDC *pdc);rn void setStartPoint(POINT startPoint);rn void setEndPoint(POINT endPoint);rnprivate:rn CPoint m_leftPoint;rn CPoint m_rightPoint;rn;rnrnclass CRectang : public CBaseShapernrnpublic :rn CRectang(COLORREF color=RED);rn virtual ~CRectang();rn void draw(CDC *pdc);rn void setStartPoint(POINT startPoint);rn void setEndPoint(POINT endPoint);rnprivate:rn CPoint m_leftPoint;rn CPoint m_rightPoint;rn;rnrnclass CShuan : public CBaseShapernrnpublic :rn CShuan(COLORREF color=RED);rn virtual ~CShuan();rn void draw(CDC *pdc);rn void addPoint(POINT morePoint);rnrnprivate:rn CArraym_points;rn;rnrn#endif // !defined(AFX_BASESHAPE_H__5560A1CB_33C2_40B1_A088_B09708FBB741__INCLUDED_)rnrnrn大家帮忙看看啊! 论坛

error C2143: syntax error : missing ';' before

10-28

[color=#FF0000][/color]Dlg.cpp(266) : error C2059: syntax error : '&&'rnDlg.cpp(266) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(266) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(268) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(268) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(268) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(269) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(269) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(269) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(270) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(270) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(270) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(271) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(271) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(271) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(272) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(272) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(272) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(273) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(273) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(273) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(275) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(275) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(275) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(276) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(276) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(276) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(282) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(282) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(282) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(295) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(295) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(295) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(297) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(297) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(297) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(298) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(298) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(298) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(299) : error C2143: syntax error : missing ';' before ''rnDlg.cpp(299) : error C2447: missing function header (old-style formal list?)rnDlg.cpp(299) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(301) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(301) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(301) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(302) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(302) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(302) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(303) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(303) : error C2447: missing function header (old-style formal list?)rnDlg.cpp.cpp(303) : error C2143: syntax error : missing ';' before ','rnDlg.cpp.cpp(304) : error C2143: syntax error : missing ';' before ''rnDlg.cpp.cpp(304) : error C2447: missing function header (old-style formal list?)rnDlg.cpp(304) : error C2143: syntax error : missing ';' before ''rnrnrnrnrnrnrnBEGIN_MESSAGE_MAP(CDlg, CDialog)rn //AFX_MSG_MAP(CDlg)rn ON_BN_CLICKED(IDB_VIEW_CERT, OnViewCert)rn ON_BN_CLICKED(IDB_CHG_MPIN, OnChgPin)rn ON_BN_CLICKED(IDB_INIT_DEV, OnInitDev)rn ON_BN_CLICKED(IDB_VIEW_DEV, OnViewDev)rn ON_BN_CLICKED(IDB_DOWN_CERT, OnDownCert)rn ON_NOTIFY(NM_DBLCLK, IDC_TREE, &CDlg::OnNMDblclkTreeContainer[color=#FF0000])//266行[/color]rnrn ON_MESSAGE(WM_MY_TRAY_NOTIFICATION, OnTrayNotification[color=#FF0000])//268行[/color]rnrn ON_WM_SYSCOMMAND() [color=#FF0000]//270行[/color]rn ON_WM_PAINT() [color=#FF0000]//271行[/color]rn ON_WM_NCPAINT() [color=#FF0000]//272行[/color]rn ON_WM_QUERYDRAGICON() [color=#FF0000]//273行[/color]rn //AFX_MSG_MAPrn ON_COMMAND(ID_MAXSIZE, &CDlg::OnMaxsize) [color=#FF0000]//275行[/color]rn ON_COMMAND(ID_EXIT, &CDlg::OnExit) [color=#FF0000]//276行[/color]rnrn ..........................rnrn ON_BN_CLICKED(IDB_DELETE_CT, &CDlg::OnBnClickedDeleteCt) //303rnrnrnEND_MESSAGE_MAP() 论坛

帮我看一下如下的问题如何解决,error C2143: syntax error : missing ';' before '<',error C2501: 'CByteList' : missing

02-07

在如下class定义中,定义了一个CByteList类型的变量,m_blKeys,报错,各位帮忙看看rntypedef CList CByteList;rnrnclass CConsoleWnd : public CWndrnrn // Constructionrnpublic:rn BOOL m_fActAsConsole; // a flag representing if the window is console or notrn CRichEditCtrl& GetRichEdit();rn void Clear();rn char GetKeyPress();rn BOOL AreKeysAvailable();rn void WriteText(LPCTSTR strText);rn CConsoleWnd();rnrn // Attributesrnpublic:rn CByteList m_blKeys; //出问题在这里rnrn // Operationsrnpublic:rnrn // Overridesrn // ClassWizard generated virtual function overridesrn //AFX_VIRTUAL(CConsoleWnd)rn public:rn virtual BOOL Create(CWnd* pParentWnd, LPCTSTR szCaption, LPRECT pr = NULL, DWORD dwREStyle = 0, DWORD dwExStyle = 0, DWORD dwStyleChildOrPopup = WS_CHILD);rn virtual BOOL PreTranslateMessage(MSG* pMsg);rn protected:rn virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);rn //AFX_VIRTUALrnrn // Implementationrnpublic:rn virtual ~CConsoleWnd();rnrn // Generated message map functionsrnprotected:rn //AFX_MSG(CConsoleWnd)rn afx_msg void OnSize(UINT nType, int cx, int cy);rn afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);rn afx_msg void OnSetFocus(CWnd* pOldWnd);rn afx_msg void OnClose();rn afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);rn //AFX_MSGrn DECLARE_MESSAGE_MAP()rnprivate:rn DWORD m_dwREStyle;rn CRichEditCtrl m_reText;rn;rnrnrnrnrnf:\studio\rdview_tmp\consolewnd.h(11) : error C2143: syntax error : missing ';' before '<'rnf:\studio\rdview_tmp\consolewnd.h(11) : error C2143: syntax error : missing ';' before '<'rnf:\studio\rdview_tmp\consolewnd.h(27) : error C2146: syntax error : missing ';' before identifier 'm_blKeys'rnf:\studio\rdview_tmp\consolewnd.h(27) : error C2501: 'CByteList' : missing storage-class or type specifiersrnf:\studio\rdview_tmp\consolewnd.h(27) : error C2501: 'm_blKeys' : missing storage-class or type specifiers 论坛

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