草庐IT

exception_type

全部标签

java - “Type mismatch: cannot convert int to byte”

我看到有人问关于错误“类型不匹配:无法将int转换为字节”的问题。但它们大多是由涉及的算术运算引起的。这是我的案例:(当我想在EclipseKepler中玩位时会发生这种情况)//java7binaryliteralsbytea=0b01111111;//8-bititcompilesbyteb=0b10000000;//8-biterror:Typemismatch:cannotconvertinttobyte.bytec=(byte)0b10000000;//8-bititworksfineifcasted.问题是,如果它是8位并且最高位是1,那么编译器会给出错误。我想知道为什么。

java - 组织.postgresql.util.PSQLException : ERROR: value too long for type character varying(255)

当我执行我的项目时,出现以下错误:目标是使用hibernate将json文本保存到数据库中。Users.java&UsersBooks.java同样,Books.java:@Entity@Table(name="tblbooks")publicclassBooks{@Id@Column(name="bookshareId")privateintbookshareId;@Column(name="author")privateStringauthor;@Column(name="availableToDownload")privateintavailableToDownload;@Col

java - 如何在 Java 中创建 Type 5 UUID?

在python中,要生成Type5UUID,我们可以简单地执行以下操作:importuuidprintuuid.uuid5(uuid.NAMESPACE_URL,'mystring')浏览javadocumentationforjava.util.UUID,我不知道该怎么做。首先,没有提到类型5。他们确实有Type3,但签名是:nameUUIDFromBytes(byte[]name)Staticfactorytoretrieveatype3(namebased)UUIDbasedonthespecifiedbytearray.我们如何在Java中创建Type5UUID?

java - SpringBoot 不处理 org.hibernate.exception.ConstraintViolationException

我已经在我的实体类中定义了一个验证电子邮件的模式。在我的验证异常处理程序类中,我添加了ConstraintViolationException的处理程序。我的应用程序使用SpringBoot1.4.5。配置文件.java@Entity@EntityListeners(AuditingEntityListener.class)@Table(name="profile")publicclassProfileextendsAuditableEntity{privatestaticfinallongserialVersionUID=8744243251433626827L;@Column(na

java - 克服 java.net.MalformedURLException : no protocol Exception

我有一个属性文件,其中包含一个属性,该属性指定包含温度数据集的NOAA网站的URL。该属性包含一个[DATE_REPLACE]token,因为当NOAA生成新的预报时,URL每天都会更改。在我的属性文件中,我指定:WEATHER_DATA_URL="http://weather.noaa.gov/pub/SL.us008001/DF.anf/DC.mos/DS.mex/RD.[DATE_REPLACE]/cy.00.txt"我已经使用PropertyHelper类(java.util.Properties的包装器)声明了一个方法,使用WEATHER_DATA_URL作为名称生成当天的U

java - Java 的 Exception 类是检查类型吗?

这是一个显示Java“异常”类的相反行为的示例。try{}catch(Exceptionex){}在检查类型的异常的情况下,如果我们在tryblock中保留一个catchblock而没有任何错误引发语句到该特定的检查异常,那么编译器将引发错误,如“Thisexceptionisneverthrownfromthetrystatementbody”.但在上述情况下,编译器不会给出任何错误。另一方面,如果我们使用throw关键字引发“Exception”类类型的异常,异常将不会自动回避给调用者,如下所示:thrownewException();在上述情况下,编译器给出类似“Unhandle

java - Ant 中的 "Failed to create task or type antlib:org.apache.maven.artifact.ant:mvn"错误

在build.xml中运行Ant任务时,Ant构建无法运行。我在控制台中收到以下错误:Buildfile:F:\EclipseProjects\my_project\build.xml[typedef]Couldnotloaddefinitionsfromresourceorg/apache/maven/artifact/ant/antlib.xml.Itcouldnotbefound.BUILDFAILEDF:\my_project\build.xml:32:Problem:failedtocreatetaskortypeantlib:org.apache.maven.artifac

java - Protobuf 错误 :Protocol message tag had invalid wire type

我在尝试用java读取消息时遇到以下错误Exceptioninthread"main"com.google.protobuf.InvalidProtocolBufferException:Protocolmessagetaghadinvalidwiretype.atcom.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:78)atcom.google.protobuf.UnknownFieldSet$Builder.mergeFieldF

Postgres类型“ {field type}”只是一个外壳

我使用django&Postgres。我的迁移包含这样的东西:db.create_table('location_locationlevel',(('id',self.gf('django.db.models.fields.AutoField')(primary_key=True)),('name_0',self.gf('django.db.models.fields.CharField')(max_length=75,null=True,blank=True)),('name_1',self.gf('django.db.models.fields.CharField')(max_le

java - 小服务程序 : SEVERE: Allocate exception for servlet

以下堆栈跟踪是我尝试访问一个servlet时得到的,它似乎在Tomcat管理器中运行良好。11Sep,201211:50:12AMorg.apache.catalina.core.ApplicationContextlogINFO:MarkingservletLoginServletasunavailable11Sep,201211:50:12AMorg.apache.catalina.core.StandardWrapperValveinvokeSEVERE:AllocateexceptionforservletLoginServletjava.lang.Error:Unresolv