tomcat:deploy: “Cannot invoke Tomcat manager: Connection refused”

When using the tomcat 7 plugin, do the following: pom.xml <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>tomcatserver</server> <path>/mycontext</path> <username>admin</username> <password>admin</password> </configuration> </plugin> settings.xml <server> <id>tomcatserver</id> <username>admin</username> <password>admin</password> </server> tomcat-users.xml <user username=”admin” password=”admin” roles=”manager-script”/> run mvn tomcat7:deploy

how to set header no cache in spring mvc 3 by annotation

There is no such option. You can use an interceptor: <mvc:annotation-driven/> <mvc:interceptors> <bean id=”webContentInterceptor” class=”org.springframework.web.servlet.mvc.WebContentInterceptor”> <property name=”cacheSeconds” value=”0″/> <property name=”useExpiresHeader” value=”true”/> <property name=”useCacheControlHeader” value=”true”/> <property name=”useCacheControlNoStore” value=”true”/> </bean> </mvc:interceptors> (taken from here) On one hand it is logical not to have such annotation. Annotations on spring-mvc methods are primarily to let the container decide which … Read more

Atomikos vs JOTM vs Bitronix vs? [closed]

I am new to JTA and it’s underlying transaction managers. Can anyone explain the pros/cons of each of these? Feel free to add others I didn’t list in title. Standalone transaction managers I’m aware of include Bitronix, SimpleJTA, Tyrex (dead?), JOTM (used in Jonas), GeronimoTM/Jencks (used in Geronimo), JBossTS (used in JBoss) and Atomikos. I’ve … Read more

Root URl of the servlet

You do realize that the URL client sees (and/or types into his browser) and the URL served by the container your servlet is deployed on can be very different? In order to get the latter, though, you have a few methods available on HttpServletRequest: You can either call getScheme(), getServerName(), getServerPort() and getContextPath() and combine … Read more

Running daemon with exec-maven-plugin avoiding `IllegalThreadStateException`

Posting the answer that is discussed in the comments section of the question. This solution worked for me! Thanks Andrew Logvinov cleanupDaemonThreads = false Something like this in the configuration tag <configuration> <mainClass>com.test.Startup</mainClass> <cleanupDaemonThreads>false</cleanupDaemonThreads> </configuration>

Are @ManagedBeans obsolete in JavaEE6 because of @Named in CDI/Weld?

In short, @ManagedBean makes sense for applications that use JSF but do not use JSR 299 (whatever the reason is). Below a longer explanation from Gavin King: Re: Comparisons to @ManagedBean annotations in JSF2?: While looking through the Weld examples, and the older WebBeans documentation, it looks like a competitor to the new @ManagedBean JSF … Read more

JSF Controller, Service and DAO

Is this the correct way of doing things? Apart from performing business logic the inefficient way in a managed bean getter method, and using a too broad managed bean scope, it looks okay. If you move the service call from the getter method to a @PostConstruct method and use either @RequestScoped or @ViewScoped instead of … Read more

Sharing one encoder/pattern among multiple Appenders in Logback

Patterns are reusable with variable substitution. <configuration> <property name=”defaultPattern” value=”%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} – %msg%n” /> <appender name=”STDOUT” class=”ch.qos.logback.core.ConsoleAppender”> <encoder> <pattern>${defaultPattern}</pattern> </encoder> </appender> <root level=”debug”> <appender-ref ref=”STDOUT” /> </root> </configuration>

What does the @EJBs annotation do?

The @EJB annotation (and @Resource, @WebServiceRef, etc.) serves two purposes: It declares a reference in the component namespace. For example, @EJB(name=”myEJB”) creates a reference java:comp/env/myEJB. If you annotate a field and do not specify a name, then it creates a reference java:comp/env/com.example.MyClass/myField. If the annotation is declared on a field or setter method, then the … Read more

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