java-ee-6

What happens behind the scenes of deploying a Spring MVC application to tomcat outside of eclipse?

寵の児 提交于 2019-12-06 12:26:56
问题 I guess a drawback of using such an awesome IDE like eclipse is that you miss the point for what happens behind the scenes of an application. I'm a ruby developer so not a java veteran. So I've been coding a project in java and using the spring framework for IOC and MVC. Can someone explain to me what is going on when I select run on server in eclipse? Because eventually I will be deploying this masterpiece of an application to a Linux server. Here is my setup. I am using Spring MVC 3 and the

@Observes in sessionscoped bean?

一笑奈何 提交于 2019-12-06 12:04:10
问题 is following scenario possible? "SessionService" which is a stateless EJB fires an event "LoggedInEvent". A SessionScoped (Weld) bean "SessionBean" having a non static method observing the LoggedInEvent is called and initializes some things for that specific user. Is the correct instance of "SessionBean" called? Are all instances called? I can not find anything in the documentation. 回答1: "The correct instance" is a slightly misleading wording. What happens is this: The SessionService is

How do I upgrade an existing NetBeans Java EE 6 Web project to Java EE 7?

可紊 提交于 2019-12-06 11:15:43
问题 The project uses JavaServer Faces and JPA. NetBeans 7.3.1 IDE does not allow to change the Java EE version. I already found this question: How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9) tries to apply the changes as described. I have updated project.properties. endorsed.classpath=\ ${libs.javaee-endorsed-api-7.0.classpath} ... j2ee.platform=1.7-web ... javac.source=1.7 javac.target=1.7 回答1: I just had to do the same thing, I had an Java EE 6

How to layout Java EE projects using common JPA entities?

风流意气都作罢 提交于 2019-12-06 08:53:51
问题 I have two eclipse Java EE 6 projects packaged in a WAR-file using maven 3. Now they should share JPA entities in a 3rd project among them, since they both use the same database. When doing the research for my question, I found some hints mentioning for example a reference in a persistence.xml to a common jar, but I wasn't successful to make it work. So specifically asked: 1) Does the project, containing the common entities, has a persistence.xml file? If so, how does it differ from the one

CDI params in @PostConstruct

送分小仙女□ 提交于 2019-12-06 08:52:09
I think my question is similar to this but haven't found it to work <f:metadata> <f:viewParam id="id" name="id" value="#{detailsBean.id}"/> </f:metadata> Why can't I do this with @Named and utilize CDI: @Named @RequestScoped public class DetailsBean { private Contacts detailsContact; @EJB ContactsFacade contactsEJB; private int id; public DetailsBean() { System.out.println("details bean called"); } @PostConstruct public void onLoad() { detailsContact = contactsEJB.find(id); } I'm not able to log the id. Of course, @ManagedProperty is incompatible with CDI. *****UPDATE***** some xhtml: <?xml

Log back not able to find the configuration file (logback.xml)

自古美人都是妖i 提交于 2019-12-06 08:41:12
I'm trying to use logback as the logging framework for my new project. I placed the logback.xml in main\resources\logback.xml . These are the contents of logback.xml file <configuration debug="true"> <appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>D:/logbacklog.log</file> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> </layout> </appender> <logger name="com.myproject" level="ALL"/> <root level="debug"> <appender-ref ref="FILE" /> </root> </configuration> However, logs I enter do get printed

CDI producer method for data model

*爱你&永不变心* 提交于 2019-12-06 08:23:47
问题 I'd like to be able to @Inject a data model backing a RichFaces 4 ExtendedDataTable, but it requires an EntityManager to do its work. The EntityManager's queries need to know the Class, of course, and I'd rather not pass that into method calls (in this case the methods are not called by my code); ideally it would be in the constructor. Something like this: public class DataModel<T> { @Inject private EntityManager em; private Class<T> entityClass; public DataModel(Class<T> entityClass) { this

Does ProGuard work with JavaEE 6 applications?

谁说我不能喝 提交于 2019-12-06 07:32:21
问题 I'm trying to get Proguard to obfuscate a simple .war file. According to the docs Proguard handles .war files, but when I try I get this: Warning: class [WEB-INF/classes/com/corp/gr/t2b/T2BChannel.class] unexpectedly contains class [com.corp.gr.t2b.T2BChannel] The docs mention something about Proguard not liking .war files with classes in the WEB-INF/classes directory. So I put all the .class files in their own .jar file in WEB-INF/lib. Then Proguard complains that it cannot find any of the

Weld and Java SE

别说谁变了你拦得住时间么 提交于 2019-12-06 06:07:49
I'm new to Weld and have been trying to get my head around it's concepts. I have a little experience with Spring and nothing with Guice, so I'm pretty much a novice with the DI frameworks. Here's a tutorial that introduce CDI, but in the context of web apps. I'm interested to see how this works in Java SE alone. I have created the following classes, but have no idea how to test the ItemProcessor's execute method with the DefaultItemDao class (or any other alternative) in a Java SE app. Here're the classes: public class Item { private int value; private int limit; public Item(int v, int l) {

what is meant by context in CDI?

▼魔方 西西 提交于 2019-12-06 05:54:24
问题 I am new to CDI. While reading, I am always encountering contextual objects, non contextual objects. What does they mean? For example the below link http://docs.jboss.org/weld/reference/latest/en-US/html/beanscdi.html#d0e881 Message-driven and entity beans are by nature non-contextual objects and may not be injected into other objects 回答1: The context of a CDI framework is basically a big map of objects*. You can add objects to the context or make the CDI framework create objects from your