java-ee

ServletDispatcher cannot be cast to Javax.servlet.Servlet exception in my spring project

落爺英雄遲暮 提交于 2019-12-17 16:27:41
问题 While starting tomcat server I am getting an exception SEVERE: Servlet /MavenWeb threw load() exception java.lang.ClassCastException: org.springframework.web.servlet.DispatcherServlet cannot be cast to javax.servlet.Servlet I am using spring3 but there is jar spring2-5-6 in my lib folder, I removed it from pom.xml but still appears in lib folder - though I am not sure if that is an issue. I am using Eclipse IDE. Thanks!! <dependencies> <dependency> <groupId>org.hibernate.javax.persistence<

How do you build a multi-language web site?

独自空忆成欢 提交于 2019-12-17 16:23:24
问题 A friend of mine is now building a web application with J2EE and Struts, and it's going to be prepared to display pages in several languages. I was told that the best way to support a multi-language site is to use a properties file where you store all the strings of your pages, something like: welcome.english = "Welcome!" welcome.spanish = "¡Bienvenido!" ... This solution is ok, but what happens if your site displays news or something like that (a blog)? I mean, content that is not static,

What is different about the Java EE packages? (SDK/normal vs Web Profile) [duplicate]

*爱你&永不变心* 提交于 2019-12-17 16:18:25
问题 This question already has answers here : Java EE Web Profile vs Java EE Full Platform (3 answers) Closed 7 months ago . In the Oracle java site http://www.oracle.com/technetwork/java/javaee/downloads/index-jsp-140710.html, There are Java EE SDK download and the Java EE Web Profile download. Which one should I install? 回答1: The package of the oracle java site just a GlassFish Open Source Application Server, API Documentation and some sample codes . The differences between web profile edition

Spring Data JPA: How can Query return Non- Entities Objects or List of Objects?

泪湿孤枕 提交于 2019-12-17 15:56:07
问题 I am using spring data JPA in my project. I am playing with millions of records. I have a requirement where I have to fetch data for various tables and build a object and then paint it on a UI. Now how to achieve this my Spring data Repositories. I have read that it can be achieved by Named native queries. If the named native query does not return an entity or a list of entities, we can map the query result to a correct return type by using the @SqlResultSetMapping annotation. But when I am

Separating war application name from war file name

柔情痞子 提交于 2019-12-17 15:54:31
问题 Currently if i deploy a war file on tomcat named say myapp.war , I can access its url by http://localhost/myapp/MyServlet. However what I want is to deploy a war with a version number in the war file name and still have the same url. For eg, I want to deploy myapp-1.1.0.war and still have the url be http://localhost/myapp/MyServlet Of course I need to keep updating the war and the version number will keep changing, so I cant hardcode the war filename anywhere. Is there any setting in web.xml

Hibernate auto create database

假装没事ソ 提交于 2019-12-17 15:54:30
问题 I have a Java EE Hibernate project, and I'm using MySQL as a database. I want that when I first time run the project, it will create the database automatically. This is my hibernate.cnf.xml : <?xml version='1.0' encoding='utf-8' ?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" > <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc

Can I dynamically unload and reload (other versions of the same) JAR?

拥有回忆 提交于 2019-12-17 15:44:59
问题 I am writing a server program which is used to run unit tests of an API (displaying lots of information and providing web access to control / monitor the whole thing)... This API is known to the server during compile time and is provided as a JAR. To be able to compare between unit test results of different versions of the API (without restarting the server), I want to be able to unload the 'current' version of the API, and to reload a newer one (or an older one). I don't want to use

Is it discouraged using Java 8 parallel streams inside a Java EE container?

让人想犯罪 __ 提交于 2019-12-17 15:42:16
问题 Given that spawning threads in Java EE containers are discouraged. Would using the Java 8 parallel streams, which may spawn threads, inside Java EE be discouraged too? 回答1: EDIT See alternate answer from andrepnh . The below may have been the plan, but it doesn't appear to have played out that way in practice. The way I read it from the lambda-dev mailing list discussion mentioned in the comments: it's not discouraged the way spawning threads is - but won't do anything much for you in a Java

java.util.List is an interface, and JAXB can't handle interfaces

一曲冷凌霜 提交于 2019-12-17 15:37:32
问题 I seemed to get the following exception when trying to deploy my application: Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions java.util.List is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at java.util.List at private java.util.List foobar.alkohol.register.webservice.jaxws.GetRelationsFromPersonResponse._return at foobar.alkohol.register.webservice.jaxws

EAR vs separate EJB + WAR

吃可爱长大的小学妹 提交于 2019-12-17 15:28:11
问题 What's the difference in deploying application as EAR (with 1 EJB and 1 WAR module) vs separate modules? I want to use GlassFish 3 web profile but it does not support EAR archive. Can I simply use EJB and WAR as separate modules? Any other options? 回答1: There seems to be some confusion between 3 variants of deployment: An EAR that includes an EJB and WEB module Deploying a separate EJB module and a separate WEB module Deploying a WEB module that includes EJB classes or an EJB jar. In the