WTP deployments without publishing fails - eclipse

I'm currently on Tomcat 7.0.21, JDK1.6.29, and WTP 3.3.1 (running on Eclipse Indigo.) I'm not sure which version of M2E I'm running. My Project builds and deploys fine when I either do a mvn install and run Tomcat outside of Eclipse, or deploy to the server via WTP with the "Serve Modules without publishing" unchecked.
However, when I start the server via WTP with the no-publish box checked, Tomcat won't start successfully, failing with:
Dec 29, 2011 4:09:39 PM org.apache.catalina.startup.ContextConfig processAnnotationsJndi
SEVERE: Unable to process JNDI URL [jndi:/localhost/plutom-ws/WEB-INF/classes] for annotations
java.io.FileNotFoundException: jndi:/localhost/plutom-ws/WEB-INF/classes
at
org.apache.naming.resources.DirContextURLConnection.list(DirContextURLConnection.java:463)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1901)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1905)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1828)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1295)
If I manually create the classes directory, it then complains about classes/com It seems like there's a conflict between a classloader and a file path resolve somewhere?

This is unfortunately a known bug between Eclipse WTP and Tomcat 7. Here are the relevant Bugzilla entries:
Tomcat 7 + Serve Modules without publishing fails to find classpath resources
Really fix "Serve modules without publishing" with tomcat 7 by using the new VirtualDirContext of tomcat >=7.0.24
Apparently the fix is known, it just hasn't been applied yet. I guess it isn't a common use-case, because otherwise more people would be requesting it to be fixed. Its too bad, its a very useful feature.

Related

Tomcat server not being recognized

I'm currently using Eclipse Mars on OS X to build a PHP based application which requires a web server for a form submission. However, upon attempting to add Tomcat 7.0 as a server, the server list is empty (shown below).
I've been following several tutorials for setting up and configuring a Tomcat server and each one says to place the extracted Tomcat folder in the Eclipse workspace directory so they'll be detected when adding them in Eclipse. The Apache Tomcat folder is in the workspace directory but it still isn't being detected. I've tried reinstalling Eclipse and deleting any duplicate files but I keep getting the same result. How can I properly set up and configure an Apache Tomcat server in Eclipse Mars?
You can tell it about the Tomcat installation using the Server Runtime Environments preference page.
If Tomcat isn't already a known server type, you might need to install a few more. The WTP FAQ has instructions.
All of those tutorials are wrong. You do want to download a copy of Tomcat from Apache so it has the expected layout when Eclipse looks for the jars needed to launch it, but there's no reason to actually put it in the workspace.
I am also using Eclipse neon and I faced the same problem and the answer was available in a question Apache Tomcat Not Showing in Eclipse Server Runtime Environments in the same site already posted
Of the Available Answers the below steps Worked for me:
1.Help-->Eclipse Marketplace
2.Type Tomcat in search box and choose the Option JST Server Adapters(Apache Tomcat,...) and click on Install
3.Then complete the Simple installation steps and after installation Eclipse prompts for a restart accept and then you can see the Target Run time updated with Tomcat server
Note:I am using Windows

Setting up Eclipse and Maven to build a simple Jersey Webapp

I had this working previously but had to reinstall everything because my hard drive died. I'm trying to build a simple jersey application via the archetype jersey-quickstart-webapp. The code is unchanged from the archetype so it's unlikely an issue with that as I had it working before the PC issue.
I'm fairly certain it's an install issue with Eclipse or Java or something else. My timeline of events goes as follows. I created the archetype project and got this error:
Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:pom:2.2 from/to central (http://repo.maven.apache.org/maven2): connect timed out -> [Help 1]
From this I searched for solutions which included deleting the repository folder and everything in .m2, forcing the project to update dependencies etc.
While doing this I noted that the option to Run As-> Run On Server was not available as an option.
I went to manually add Project Facets > Dynamic Web Module, it said this requires Java 1.6 or newer. So I tried to lower the version all the way down to 2.2 which needs Java 1.3, none allowed me to check the box. I have Java 1.7 JDK installed.
This is where I stand. Can anyone please help!!?
Plugins installed into eclipse are: M2E, Collabnet Merge Client, Eclipse WTP

Eclipse Luna with JBoss Tools does not export libraries

I'm attempting to upgrade our environment to Eclipse Luna w/ JBoss Tools from our current Indigo instance. Most things are sorted well enough, but I'm running into a wall when deploying our application to a JBoss server within Eclipse.
As far as I can see, the lib/ directory of the .ear file generated contains none of the transitive dependencies from maven that we would normally expect to see, and as a result the application does not deploy or run correctly on the server. For clarity, we use the 'use workspace metadata' deployment option on the JBoss server within Eclipse.
By contrast, if I right click on the relevant project within Eclipse and say Export... .ear file, the resulting .ear contains all the .jars that I'd expect inside the lib/ folder (there's over 50 of these things, so it's pretty easy to spot the difference). Subsequently dropping the .ear into the deploy directory of JBoss and starting a server manually has the application working fine.
Has anyone ever encountered this sort of issue within JBoss Tools / Luna, and if so what steps were taken to try and remediate it?
Cheers for any help.
Dave.
EDIT: For what it's worth, this is a JBoss Enterprise Application Platform 5.x server instance, and we're using JBoss EAP 5.2

Spring Petclinic (2013 version) doesn't work in JBoss AS 7

I'm trying to run the Spring Petclinic example on JBoss AS 7.1.1. I've imported the maven project from https://github.com/SpringSource/spring-petclinic/ to Eclipse Juno and successfully deployed it, but http://localhost:8080/petclinic/ gives me HTTP Status 404 error.
The only problem I can see from the log is
JBAS011006: Not installing optional component
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
but according to Spring3.2 and jboss as 7 it's normal behavior.
I've found some advices about modifying the Petclinic sample for JBoss, but all of them are for the old version of the sample, not the updated 2013 version (http://blog.springsource.org/2013/03/21/spring-petclinic-is-on-github/).
The sample works fine with Tomcat 7.0.39.
Update:
The problem only occurs when I run the sample from Eclipse using JBoss. As Andrzej said, building the app with standalone maven and deploying the resulting war works fine.
The problem is JBoss/JBoss Tools use incorrect war name and context root when deploying from Eclipse.
In pom.xml the war name is specified as <warName>petclinic</warName>, but JBoss uses "spring-petclinic" instead. Tomcat, Glassfish, and Weblogic don't have this problem and work correctly with deployment from Eclipse.
The workaround is either to use http://localhost:8080/spring-petclinic/ instead of http://localhost:8080/petclinic/ or configure the context root via WEB-INF/jboss-web.xml:
<jboss-web>
<context-root>petclinic</context-root>
</jboss-web>
The Spring Petclinic (2013 version) works well with Jboss AS7. Tried it with two Jboss versions. What you need is to build app with maven and deploy it to standalone/deployments folder.
Problem is running it from Eclipse Juno.

What steps are necessary to get Eclipse and a Java servlet container integrated on Ubuntu 9.10?

What's the easiest way for me to get Eclipse running with a Java servlet container on Ubuntu 9.10?
I've tried a number of things, hitting dead ends each time. The best setup would use Ubuntu packages as much as possible, not require running Eclipse as root, and be able to debug running servlets.
Dead ends so far include run-jetty-run, the Sysdeo Tomcat plugin, and Eclipse WTP with tomcat6.
A big part of the problem is that the Ubuntu tomcat6 installation is non-standard, splitting directories such that they're not all in TOMCAT_HOME. Eclipse is also non-standard, and the usual plugin installation methods don't work. I got close by installing the WTP through a PPA, but I stumbled when trying to get it to recognize tomcat.
Ubuntu recently includes a pretty full Eclipse package that you can install via Synaptic or such. But I prefer to download my own.
I download from the Eclipse download site. If I choose Eclipse IDE for Java EE Developers then I have server environments for all Web app containers already built in. If I set up one for Tomcat (in Eclipse), Eclipse will download and install Tomcat for me. It's quite convenient, although I sometimes have trouble finding Tomcat or its files. Eclipse squirrels them away somewhere.
The server setup menus become accessible to you once you create a Web project (not plain Java project).
You should "apt-get install sun-java6-jdk", download and use the Java EE version of Eclipse, and then create a dynamic web project. In the web project create a jsp page, and right click -> "Run -> Run on server" where you may then install a server connector.
Some connectors are included in Java EE, some must be downloaded. Choose the one corresponding to the server you have downloaded and unpacked, and point Eclipse to the directory.
If all succeedes, the JSP page should then show up in a browser served from the started server.