Eclipse编译某个Java类的时候,程序体没有错误,但是在package处有错误提示

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

错误提示信息太概如下:

The class file HashMap<K,V>.FrontCache contains a signature..........

网上有给出的解决方法是:

“这个问题产生的原因是在不同的jdk版本下编译,可以用如下办法解决:

在window-preferenecs-java-installed jres下添加jdk 1.7(如果有就不必了);

右键 工程-properties-java build path-libraries-add library-jre system library点next,选alternate JRE,选jdk 1.7就好了”

但是,一般使用Eclipse前,就已经部署了一个jdk环境,即已经是在jdk1.7,1.8,甚至更高版本环境下编码,按理来说不存在时jdk版本编译的问题。这里给出一种很滑稽的解决方法,就是把package那一行删掉,重新写一遍刚才那一行,ctrl+s,然后发现程序就正常了。

当然这种无棱两可的报错,估计不会遇到一两次,这里当作是分享一下不同的解决方法吧。

展开阅读全文

EJB编译时候错误

12-20

以下是我的home,bean,remote类。我在编译的时候出现rn"EJBModule1.jar": Spaces in the temporary directory path may cause WebLogic EJBC utility to produce fatal compile errors.rn"EJBModule1.jar": C:\bea\jdk131_02\bin\javaw -classpath "C:\bea\weblogic700\server\lib\weblogic.jar;C:\bea\weblogic700\server\lib\weblogic_sp.jar;C:\bea\weblogic700\server\lib\webservices.jar;" weblogic.ejbc -keepgenerated -compiler C:/bea/jdk131_02/bin/javac E:/projects/t2/EJBModule1.jar.jar E:/projects/t2/EJBModule1.jarrnrn"EJBModule1.jar": ERROR: Error from ejbc: Unable to load a class specified in your ejb-jar.xml: Class bytes found but defineClass()failed for: 'cn.zami.gcp.ejb.Enterprise1Bean'rn"EJBModule1.jar": ERROR: ejbc found errorsrn"EJBModule1.jar": WebLogic APPC tool invocation errors.错误。我很急,望那位朋友能帮小弟解决。rnpackage cn.zami.ejb.sessionbean.logon;rnrnimport javax.ejb.EJBObject;rnimport java.rmi.RemoteException;rnimport cn.zami.ejb.ejbexception.LogonException;rnrnpublic interface Logonrn extends EJBObject rn public boolean check(String username, String userpassword) throwsrn RemoteException,LogonException;rnrn//////////rnpackage cn.zami.ejb.sessionbean.logon;rnrnimport javax.ejb.SessionBean;rnimport javax.ejb.SessionContext;rnimport javax.ejb.CreateException;rnimport cn.zami.ejb.ejbexception.LogonException;rnimport java.sql.*;rnimport javax.sql.DataSource;rnimport javax.naming.InitialContext;rnimport javax.ejb.EJBException;rnimport javax.naming.NamingException;rnrnpublic class LogonBeanrn implements SessionBean rn SessionContext sessionContext;rn public void ejbCreate() throws CreateException rn rnrn public void ejbRemove() rn rnrn public void ejbActivate() rn rnrn public void ejbPassivate() rn rnrn public void setSessionContext(SessionContext sessionContext) rn this.sessionContext = sessionContext;rn rnrn public boolean check(String username, String userpassword) throws LogonExceptionrn Connection conn = null;rn PreparedStatement ps = null;rn ResultSet rst = null;rn tryrn conn = getConnection();rn ps = conn.prepareStatement("select * from end_users where end_user_name='"+username+"' and end_user_password='"+userpassword+"'");rn rst = ps.executeQuery();rn if(!rst.next())rn throw new EJBException("inviliad username or password");rn return true;rn catch(SQLException e)rn throw new EJBException(e);rn rn rn private Connection getConnection() throws SQLExceptionrn tryrn InitialContext jndiCntx = new InitialContext();rn DataSource ds = (DataSource)jndiCntx.lookup("java:comp/env/jdbc/DataSource");rn return ds.getConnection();rn catch(NamingException ne)rn throw new EJBException(ne);rn rn rnrn/////////////////////////////rnpackage cn.zami.ejb.sessionbean.logon;rnrnimport javax.ejb.EJBHome;rnimport javax.ejb.CreateException;rnimport java.rmi.RemoteException;rnrnpublic interface LogonHomern extends EJBHome rn public Logon create() throws CreateException, RemoteException;rnrn以下是我的ejb-jar.xml文件rnrnrnrn EJBrn rn rn Logonrn cn.zami.ejb.sessionbean.logon.LogonHomern cn.zami.ejb.sessionbean.logon.Logonrn cn.zami.ejb.sessionbean.logon.LogonBeanrn Statelessrn Containerrn rn DataSource for the logon databasern jdbc/DataSourcern javax.sql.DataSourcern Containerrn rn rn rn rn rn rn Logonrn *rn rn Requiredrn rn rnrn 论坛

一个jsp程序编译时候出现的错误!!!!!!

04-29

type Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Unable to compile class for JSPrn at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:477)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)rn at java.lang.Thread.run(Thread.java:536)rnrnrnroot cause rnrnorg.apache.jasper.JasperException: /website/userchange.jsp(33,5) jsp.error.badactionrn at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)rn at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:417)rn at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)rn at org.apache.jasper.compiler.Parser.parseAction(Parser.java:676)rn at org.apache.jasper.compiler.Parser.parseElements(Parser.java:807)rn at org.apache.jasper.compiler.Parser.parse(Parser.java:122)rn at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)rn at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)rn at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:229)rn at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325)rn at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)rn at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)rn at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)rn at java.lang.Thread.run(Thread.java:536)rnrn这样的错误是什么意思呢rn我编写的好几个程序都出现这样的错误rn我都不知道怎么改正了rn大家帮帮rn谢谢!!!!!!rnrn 论坛

编译DirectX程序时候提示winbase.h有错误,如何解决

01-19

1>------ Build started: Project: BasicHLSL, Configuration: Debug Win32 ------rn1>Compiling...rn1>dxstdafx.cpprn1>f:\program files\microsoft visual studio 9.0\vc\include\excpt.h(128) : error C2059: syntax error : ''rn1>f:\program files\microsoft visual studio 9.0\vc\include\excpt.h(128) : error C2143: syntax error : missing ';' before ''rn1>f:\program files\microsoft visual studio 9.0\vc\include\excpt.h(128) : error C2059: syntax error : ''rn1>c:\program files\microsoft sdks\windows\v6.0a\include\windef.h(35) : error C2143: syntax error : missing ';' before ''rn1>c:\program files\microsoft sdks\windows\v6.0a\include\windef.h(35) : error C2447: '' : missing function header (old-style formal list?)rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(825) : warning C4164: '_rotl' : intrinsic function not declaredrnmissing ';' before identifier 'SRWLOCK'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(399) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(399) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(399) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(408) : error C2146: syntax error : missing ')' before identifier 'SRWLock'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(408) : warning C4229: anachronism used : modifiers on data are ignoredrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(408) : error C2182: 'InitializeSRWLock' : illegal use of type 'void'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(408) : error C2491: 'InitializeSRWLock' : definition of dllimport data not allowedrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(408) : error C2440: 'initializing' : cannot convert from 'int *' to 'int'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(469) : error C2146: syntax error : missing ')' before identifier 'ConditionVariable'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(469) : warning C4229: anachronism used : modifiers on data are ignoredrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(469) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intrn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(469) : error C2440: 'initializing' : cannot convert from 'int *' to 'int'rn1> There is no context in which this conversion is possiblern1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(472) : error C2059: syntax error : ')'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(476) : error C2143: syntax error : missing ';' before '__stdcall'rn1>c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(476) : fatal error C1003: error count exceeds 100; stopping compilationrn1>Build log was saved at "file://c:\DX90SDK\Samples\C++\Direct3D\BasicHLSL\Debug\BuildLog.htm"rn1>BasicHLSL - 178 error(s), 34 warning(s)rn========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========rn中间省略了一部分rn 论坛

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