w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
JSF 2 / RichFaces 4 webapp with Apache and Tomcat not finding webapp resources library
I think the problem is that your reverse proxy rule is assuming that the context name (testapp) is not present in the URL, while in the HTML you are assuming it is present (as in the src attribute of your img tag). You should either remove the context name in both the path and the target URL to proxy everything to Tomcat, e.g.: ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ Or keep it in both to only proxy that webapp to Tomcat: ProxyPass /testapp/ http://localhost:8080/testapp/ ProxyPassReverse /testapp/ http://localhost:8080/testapp/ This will make your webapp available at https://testapp.xxx.org/testapp/. If you don't want the context name part in the URL, you can deploy the webapp in the Tomcat root.

Categories : Apache

JSF + REST WebApp running on Apache Tomcat 7
I would advise against this. It would make more sense that your managedbean would add some sort of listener implementation to your service, and be notified that way. In a proper design, your backend service does not know your managed bean exists. If you still want to do this, the trick is to have Spring manage your jsf managedbeans, instead of jsf itself. Then you can just inject the (application scoped!) managed bean into your service. To use spring for your beans, you need to add the Spring resolver to your faces-config. <el-resolver> org.springframework.web.jsf.el.SpringBeanFacesELResolver </el-resolver>

Categories : Java

Tomcat Context-Params ignored in Spring webapp when using PropertyPlaceholder
Spring uses a default property file unless the user-based property file is defined. If you want to control .properties file, please follow the instructions posted here. If you want to take advantage of application.properties there are two ways to do it. <!-- allows for ${} replacement in the spring xml configuration from the system.properties file on the classpath --> <util:properties id="appProperties" location="classpath:application.properties"/> <context:property-placeholder location="classpath:application.properties"/> util tag lets you to use a Property class to read the properties across your application. For example: @Autowired public MyPropertyReader(Properties appProperties) { String prop1 = appProperties.getProperty("my.address"); String pro

Categories : Spring

Spring can not load properties when webapp is deployed on Maven embedded Tomcat
/WEB-INF/conf is not in the CLASSPATH; /WEB-INF/classes is. Try putting your .properties file there and see if you do better. If that doesn't work, I'd wonder if it's a class loader hierarchy problem. Java EE containers have a hierarchy of class loaders: first is the bootstrap, second is the app server, last is the application. It might be that you have the .properties file in the application loader when it's needed at the app server level.

Categories : Maven

How do I load ${catalina.home}/conf/application.properties in a Spring / Tomcat webapp?
The location of a context:property-placeholder is a Resource, which means that if you provide just a file path (as opposed to a full URL with a protocol) then the path will be resolved against the base directory of the webapp - it is trying to load /Users/username/Servers/apache-tomcat-6.0.36/webapps/<appname>/Users/username/Servers/apache-tomcat-6.0.36/conf/application.properties, which does not exist. If you prefix it with file: it'll work as you require: <context:property-placeholder location="file:${catalina.home}/conf/application.properties"/>

Categories : Spring

How configure Apache HTTP so URL will work without context for three Tomcat 7 Java apps
Name your web applications context1, context2, and context3 in each Tomcat instance and change your httpd.conf mappings to these: JkMount /context1|/* worker1 JkMount /context2|/* worker2 JkMount /context3|/* worker3 If you want users to be able to go to / instead of /context1 then you are going to have to use different VirtualHosts on Apache httpd and configure each webapp to be the ROOT webapp on each Tomcat instance.

Categories : Apache

spring mvc - error in server start - apache tomcat
You are missing the jar containing the class org.springframework.web.context.request.async.CallableProcessingInterceptor. This is in spring-web-XXX.jar, where XXX is your version. Go find it online (maven repo) and add it to lib.

Categories : Java

How to configure tomcat web.xml and tomcat-users.xml to secure a tomcat page
As far as access to the tomcat manager GUI is considered, there is no role as "manager" to set in tomcat-users.xml. you have to specify one of these roles. You can find the role names in the web.xml file of the Manager web application. The available roles are: •manager-gui — Access to the HTML interface. •manager-status — Access to the "Server Status" page only. •manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page. •manager-jmx — Access to JMX proxy interface and to the "Server Status" page. have a look into this link for further info, http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html I hope it helps, thanks.

Categories : Xml

Is it possible to run a spring webmvc webapp with spring security in one spring container?
Short answer Remove the /WEB-INF/myapp-servlet.xml from the contextConfigLocation context param. Long Answer The ContextLoaderListener creates a root application context based on the configuration files defined in the contextConfigLocation and loads it into the ServletContext before any Servlet is initialized. The DispatcherServlet at the same time, will create a child application context with the specified configuration. You are not explicitly specifying any bean definition file, so by convention it will take /WEB-INF/appName-servlet.xml (/WEB-INF/myapp-servlet.xml in your case, which by chance exists). It happens that both your root application context and your child application context will have some common beans (duplicates, because they load the same configuration file). You hav

Categories : Java

Tomcat 6 - webapp migration
info is basically was used as your root context in your previous web server. As you have dumped the files in the root webapps folder of your tomcat hence now the root context is "/". In order to have info in your URL, you need to create a directory "info" under tomcat/webapps directory and then dump the files of the same webapp to this directory. Restart your server and check the URLs

Categories : Java

log4j in Tomcat lib and in Each Webapp
From the log4j warning it is very clear that in your application log4j is not initialized, I am not sure earlier how you was doing in your application but for now you can try this. I have used the same approach in my appication where all the logging jars was present in server lib directory. Put the log4j.properties in your project WEB-INF directory and ask your servlet to initialize it during the application startup time. You can write a start up servlet and in the init method you can pass this properties file to the init as params. e.g : in your web.xml something like this. <servlet> <servlet-name>MyLog4JInitServlet</servlet-name> <servlet-class>test.MyLog4JInitServlet</servlet-class> <init-param> <param-name>log4j-pr

Categories : Tomcat

Same webapp on Tomcat with different log4j config for each
You can put the log4j.xml files somewhere in the outside the webapp and use Tomcat's VirtualWebappLoader to load different log4.xml for each webapps. http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation It looks like this. ${CATALINA_BASE}/conf/Catalina/localhost/WebAppDB1.xml: <Context docBase="..." > <Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="/somewhere/WebAppDB1" /> </Context> ${CATALINA_BASE}/conf/Catalina/localhost/WebAppDB2.xml: <Context docBase="..." > <Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="/somewhere/WebAppDB2" /> </Context> And then put log4j.xml files into /somewhere/WebAppDB1 and /somewhere/WebAppDB2. H

Categories : Spring

Tomcat 6 logger not receiving webapp log data
You'll at least need to fix: org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[ABC] to org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ABC] (note the subtle '/' required to adequately identify the context) Once that's done, you should definitely get log messages wherever a servlet does: getServletContext().log("Hi!"); The Tomcat documentation does promise this much. However, it's not clear if the Loggers in the [Catalina].[localhost].[/webapp] hierarchy automatically become the root JUL logger for its respective webapp.

Categories : Tomcat

Tomcat webapp's file path under multiple OS
Have you see the class org.apache.commons.io.FilenameUtils of Apache Commons IO. The method: public static String separatorsToSystem(String path) Converts all separators to the system separator.

Categories : Java

Avoid Tomcat to delete deployed webapp folder
Tomcat never deletes folders from webapp on restart by itself. It will delete if anything special is configured in shut down script/ startup script. Restarting tomcat is just redeploying the files present in the webapp. Please check if your program which is creating database files is actually storing the same, means please check the files after shut down. If they exist , then there is something written in your startup script which might be deleting those files Also storing database files in tomcat webapp is not a good option as any subsequent deployment will remove the war and redeploy it, thus erasing all the prior data. Also depending on the size of the data you can chose to store data directly to DB.

Categories : Tomcat

Use webapp classpath using JavaCompiler in Tomcat within Eclipse with Maven
Put example-library.jar somewhere in your file system and pass that location to the code that runs JavaCompiler (the -classpath option). If you use an exploded WAR file to deploy, you can of course point it to the physical location within the WEB-INF/lib folder. The point is that you only need one configurable parameter in your webapp to do this, which can be a properties file entry, -D system property, database row or something else entirely. Sample code (tested in Tomcat 7 and OpenJDK 1.7 on Fedora 18 x64): private File compile(File javaFile, String classpath) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> comp

Categories : Eclipse

Maven - deploy webapp to tomcat before JUnit test
There are a number of schools of thought as to how to handle this type of integration test with Maven. I should point out that when you are deploying an application to an application server, you are not in the realm of unit testing any more. Because the entire application is being deployed within a container, you are testing the integration of those two components. Now there is nothing wrong with using JUnit for running integration tests (though there are some limitations that you may hit, for example unit tests should not care about the sequencing of individual tests - assuming you are writing them correctly - so JUnit enforces this by not guaranteeing any sequence of execution... prior to Java 1.7 the execution order was accidentally implied by the order of test methods within a class,

Categories : Maven

Tomcat creates excessive output at webapp startup
The solution comes from Mustafa Yuksel, described here. The guy is a hero, we had the exact same issues and we couldn't figure them out in weeks. The first issue was that the war file does not use org.apache.tomcat.util.digester.Digester, it was in fact the org.apache.commons.digester.Digester.level class which used the wrong logger. So that you can mask the FINE logging with the line org.apache.commons.digester.Digester.level = INFO The second issue was that we had a logging.properties in a project, that we had Eclipse include in our war files. That project included an additional logging.properties file which we had no idea about. Included eclipse projects are present as jar files in /WEB-INF/lib/ so you have to dig into those.

Categories : Tomcat

Eclipse + Tomcat - Serve webapp directly from workspace
By default it shares only the apps located in $CATALINA_HOME/webapps. You can change it in the $CATALINA_BASE/conf/server.xml in the <Host />. Check the documentation for attribute appBase. Hope it helped.

Categories : Java

web manager and other webapp programs return 404 error using Tomcat 7
When running Tomcat in Eclipse, Eclipse re-configures Tomcat and various files are read from alternative locations - including web applications. Running Tomcat from the command line will restore the behaviour you expect.

Categories : Jsp

Make my jasperserver webapp the default tomcat application
Here are some suggestions: Default web app in tomcat Since you don't have a WAR file -- one answer suggests renaming your application to ROOT and another suggests adding this code to the server.xml file: <Context path="" docBase="/usr/local/tomcat/mywebapps/myapplication"> <WatchedResource>WEB-INF/web.xml</WatchedResource> </Context>

Categories : Tomcat

How can i connect to Apache Cxf web service hosted on Apache Tomcat(Ws security enabled )?
found it and i hope that it helps someone just replace the localhost with the ip address and evreything will be good have a look at a similar post http://cxf.547215.n5.nabble.com/404-from-web-service-client-td5710925.html

Categories : Apache

Is it webapp-root/META-INF or webapp-root/WEB-INF/classes/META-INF (Tomcat 7)
I guess it is all right. They both might have slightly different purposes. webapp-root/META-INF is directory for metadata of the web application, which you can access via servletContext.getResource("/META-INF/foo"). webapp-root/WEB-INF/classes/META-INF is directory for metadata of java classes, which you can read via getContextClassLoader().getResource("/META-INF/foo").

Categories : Spring

How to change the Java webapp 'WEB-INF path' convention under tomcat or jetty
The specification (Java™ Servlet Specification Version 2.3) only mentions standard folders: The web application classloader must load classes from the WEB-INF/classes directory first, and then from library JARs in the WEB-INF/lib directory. With Tomcat or Jetty you cannot do it with "out-of-box" provided functionality: Tomcat: WebappX — A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones. Jetty: The normal configuration is for each web context (web application or war file

Categories : Java

SHA-256 Message Digest in Tomcat 6.0 in normal webapp form (no realm related)
Ok! Finally I've noticed that GWT's MessageDigest implementation in compiled mode only supports MD5 algorithm, so SHA-256 is not compatible. During DevMode it's using the standard Java MessageDigest which also supports SHA-256. Best regards

Categories : Java

Configuring a Tomcat webapp to serve static content from external directory
You should add in server.xml <Context path="/my-app/static" docBase="/someFolder/my-app/static-web" debug="0" reloadable="true" crossContext="false"/> Experiment with slashes. It wouldn't work if slashes is incorrect. path - is URL where your static files will be accessible. docBase - folder at hard disk with static files I guess you cannot map many contextes on single path. Another trick is to write a servlet/filter which will return static context from folder

Categories : Tomcat

An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.24
From the error its clear that your tomcat native is of older version (1.1.22) and service looks for much newer version at least 1.1.24. The latest and stable version of tomcat native is 1.1.27. You can install that. Use the following link to install and fix your current issue.

Categories : Apache

How to configure Spring BeanPostProcessor to get invoked only for a defined set of spring managed beans
I doubt if you can control purely by xml configuration/annotation. You can however control it within the code of the BeanPostProcessor: public Object postProcessBeforeInitialization(Object bean, String beanName) { if (thisBeanIsOfConcernToMe(bean, beanName){ doPostProcessTasks()... } } If this BeanProcessor is not under your control, then overriding the bean and delegating to the parent for certain custom conditions would be another way to go: public MyBeanProcessor extends NotUnderControlBeanPostProcessor { .... public Object postProcessBeforeInitialization(Object bean, String beanName) { if (thisBeanIsOfConcernToMe(bean, beanName){ return super.postProcessBeforeInitialization(bean, beanName) }else{ return bean; } }

Categories : Java

Secure part of Spring Webapp with SSL
Found this at http://www.mulesoft.com/tomcat-ssl. Going to try it..... Enabling SSL in Tomcat's server.xml file causes all files to be run both as secure and insecure pages, which can cause unnecessary server load. You can choose which applications offer SSL connections on a per-application basis by adding the following element to the application's WEB-INF/web.xml file: <security-constraint> <web-resource-collection> <web-resource-name>YourAppsName</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> This configuration allows y

Categories : Tomcat

Configure eclipse to work with tomcat
Do you want to set docBase to your project's root folder? If this is the case, you can change Default output folder from YourProject/build/classes to YourProject/WebContent/WEB-INF/classes in Java Build Path. And, set docBase to YourProjectRootWebContent in your server.xml. Hope this helps.

Categories : Eclipse

Spring, JPA, Hibernate, Tomcat: Unable to find persistence unit when loading Spring application context
As far I understood from my recent expirience of setting up 2 EntityManagerFactory in the same application - @PersistenceUnit(unitName="myPU") just doesn't work at all. I would suggest to inject EntityManager, not EntityManagerFactory. This is clear since you always know which EMF is used. Same for specifying right TransactionManager. Updated code of the service class: @Service public class CompetenceAreaManager { @PersistenceContext(unitName = "emf1") private EntityManager em; @SuppressWarnings("unchecked") @Transactional(transactionManager="transactionManager1", readOnly=true) public List<CompetenceArea> getCompetenceAreas() { List<CompetenceArea> competenceAreaList = null; Query q = em.createNamedQuery(CompetenceArea.FIND_ALL);

Categories : Java

How to configure maven tomcat port in eclipse?
In pom.xml, where you declared the apache tomcat maven plugin, you would set or change the port number, Ex: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <!-- or if you want to use tomcat 6.x <artifactId>tomcat6-maven-plugin</artifactId> --> <version>2.0</version> <configuration> <!-- http port --> <port>9090</port> <!-- application path always starts with /--> <path>/</path> ... </plugin> See Run an embeded Tomcat

Categories : Eclipse

How to use Apache DS with Apache Camel, Spring Security as embedded LDAP server prepopulated from LDIF?
The root entry in the embedded server is restricted to "domain" so you're limited to DNs which end in "dc=blah,dc=blahblah". you might consider using the LDAP tests from Spring Security as a starting point since they are already up and running.

Categories : Spring

What is the difference between setting up mod-mono virtual hosts via webapp file versus apache site configuration?
Webapp config file approach can also be used with stand-alone XSP4, without the need of apache. For example, you can run: xsp4 --appconfigfile etc/mono-server4/debian.webapp And you'll get XSP4 working with your webapp config file.

Categories : Asp Net Mvc

Redirecting a 404 error page to a custom page of my Sring MVC webapp in Tomcat
Since you are already working in WEB-INF(web.xml) folder,You need not to mention WEB-INF. <error-page> <error-code>404</error-code> <location>/templates/error/error.html</location> </error-page> Check this tutorial also.

Categories : Java

Spring MVC webapp link to excel document and rename it
Perhaps another approach you might consider is that you have a Controller implementation that proxies the request onto the external website. Rather than interacting with the external website directly, your users interact with your Controller. This will give you the opportunity to re-name the file before it is served to your users. It also means that should things change in the future, you only need to change the implementation of your Controller. So a proposed work flow could be: User clicks link to your controller /downloadExcelReport The request is handled by ExcelReportController ExcelReportController makes an HTTP request to the external website and fetches the Excel document Before returning the Excel report to your user, ExcelReportController sets the correct HTTP headers to ensur

Categories : Java

How do I add Freemarker support to a Spring MVC webapp? Dependency issue?
Well I've sorted the compilation issue, added a dependency to my pom... <dependency><!-- needed for freemarker FreeMarkerConfigurer stuff --> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency>

Categories : Spring

What's the easiest/proper way to wire Spring beans outside a webapp?
Spring provides an IoC container in the form of an ApplicationContext. However, you need to implement your own mechanism for creating the container. But that can be pretty simple public class Start { public static void main(String[] args) { ApplicationContext context = ...// whichever flavor you want // maybe start some threads, possibly managed by the IoC container } } The container itself can either use XML configuration or a programatic one. Read the official documentation on how to do either, here.

Categories : Java

Embedded Tomcat: how to configure the number of request threads
If you want embedded tomcat to refuse new connections after 20 connections, you should also set acceptCount attribute. So, below code should work and refuse new connections after 20. tomcat.getConnector().setAttribute("maxThreads", "20"); tomcat.getConnector().setAttribute("acceptCount", "20"); (check the introduction on http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)

Categories : Tomcat

How to configure properly JNDI for tomcat 6 and its deployed webapps?
Each separate application within a single Tomcat application server is considered a separate instance of Derby. So two different applications in the same Tomcat app server cannot access the same copy of Derby, unless you use the Client-Server configuration of Derby and configure a Derby Network Server.

Categories : Spring



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.