glassfish v3 vs tomcat 7 [closed]

I don’t recommend any particular one. If you want just JSP/Servlet support, both suffices. If you want more than that (e.g. anything provided by the Java EE API which is much more than alone JSP/Servlet), then Tomcat simply don’t suffice without manually adding a bunch of components on top of that to comply the complete … Read more

JPA and Table Views. Can it be done? [duplicate]

For more info on JPA and database views see, http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Views In JPA you can map to a VIEW the same as a table, using the @Table annotation. You can then map each column in the view to your object’s attributes. Views are normally read-only, so object’s mapping to views are normally also read-only. In most … Read more

CLASSPATH, Java Buld Path (eclipse), and WEB-INF\LIB : what to use, when, and why?

The CLASSPATH you set in your environment affects only standalone Java applications, i.e. ones you run from a command prompt or an icon. As you’ve noticed, Eclipse ignores this. It sets up its own per-project classpaths. javac and java, if called from the command prompt, should/may honor this path, but it’s no longer considered great … Read more

How can I store Java EE configuration parameters outside of an EAR or WAR?

See this question for reading properties file outside of the WAR file. See this question for reading variable values from JNDI. I believe that this is the best solution. You can read a String variable with this code: Context initialContext = new InitialContext(); String myvar = (String) initialContext.lookup(“java:comp/env/myvar”); The above code will work on all … Read more

JaxbRepresentation gives error “doesnt contain ObjectFactory.class or jaxb.index”

In my case I was able to resolve this by adding a file called “jaxb.index” in the same package folder as the JAXB annotated class. In that file list the simple, non-qualified names of the annotated classes. For example, my file /MyProject/src/main/java/com/example/services/types/jaxb.index is simply one line (since I have only one JAXB typed class): ServerDiagContent … Read more

Why is PostConstruct not called?

The Java EE bean annotations such as @PostConstruct only apply to container-managed beans. If you are simply calling new BlogEntryDao yourself, the container isn’t going to intercept the creation and call the @PostConstruct method. (Furthermore, you’d be better off using @PersistenceContext or @PersistenceUnit instead of manually fetching the EntityManagerFactory in your initialize() method, and you … Read more

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

A heads up, the graceful degradation to single thread is not available. I also thought it was because of Shorn’s answer and that mailing list discussion, but I found out it wasn’t while researching for this question. The mechanism is not in the Java EE 7 spec and it’s not in glassfish 4.1. Even if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)