I created a template project named sample and started it with spring tc server. The application gets deployed but then when I go to http://localhost:8080/sample/ I get the following error
INFO: Server startup in 12669 ms
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/sample/] in DispatcherServlet with name 'appServlet'
I followed the same steps as shown in http://www.youtube.com/watch?v=Y0V4oEnCcyA to create a spring web App.
I asked my friend to follow the same steps and test it on his Ubuntu 10.04 machine and it worked fine out of the box. I came up with the conclusion that it must be something with my machine. I'm facing this problem on Mac osx 10.4 and
SpringSource Tool Suite
Version: 2.6.0.RELEASE
My host file contains the following entry
127.0.0.1 localhost
Can anyone guide me as to how to rectify this problem?
Thanks.
That warning means that you didn't set something up right in your project, plain and simple. Without code we can only guess.
Speaking of guessing, check your web.xml and make sure it actually says "sample".
Template project does not work for me either.
I changed the servlet mapping onto
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
Follow up the request mapping in the controller
#RequestMapping(value = "/home.do", method = RequestMethod.GET)
Now you can open http://localhost:8080/sample/home.do
Check the log in your eclipse server console window (bottom screen). If you're like me, there's a bug when resolving the path for the home.jsp file. It comes from the servlet-context.xml file :
<beans:property name="suffix" value="/" />
should be
<beans:property name="suffix" value=".jsp" />
Make sure you clean and restart the server after doing that change, because it seems like this servlet-context.xml file is heavily cached.
Related
I have a file_B.jsp that is quite happily referenced to in the web.xml file
<action name="File_B" helper-class="name.of.helper.fileHelper">
<result name="default" web-page="/path/to/jsp/directory/file_B.jsp" screen-name="File B" screen-id="file_b" />
</action>
And it is safely within C:\Users\myDirectory\workspace\webusr\WebContent\WEB-INF\conf\sub\directory
[Trust me - there are several dozens of other jsp files mapped out this way :-) ]
But come runtime the browser throws up a 404.
I checked in the directories under Catalina and there is no file_B_jsp.java nor file_B_jsp.class.
Now, I know the mistake I made. I did a copy/pasta from file_A.jsp (80% of the code and structure is the same).
I did a simple test and had eclipse make a NewFile.jsp and changed web.xml to
<action name="File_B" helper-class="name.of.helper.fileHelper">
<result name="default" web-page="/path/to/jsp/directory/NewFile.jsp" screen-name="File B" screen-id="file_b" />
and sure enough the browser could find it. And there were a NewFile_jsp.java and NewFile_jsp.class inside Catalina
So I copied the code from the file_B.jsp. Deleted the file_B.jsp, had eclipse make a new file_B.jsp and pasted the code back in. Put web.xml back to pointing to the file_B.jsp. Stopped the server. Cleaned it and started it again.
But still the browser says 404, as there is still no file_B_jsp.java nor file_B_jsp.class.
I absolutely need to have file_B.jsp named "file_B.jsp". The whole system is based on this naming convention (decades old legacy at an electrical power company)
What file inside of eclipse needs to be manually edited? Or can I just make a new Tomcat server on the development machine?
It seems some inside eclipse was misaligned. Either building a new server or running yet another clean or switching out of the workspace and switching back into the workspace got eclipse to start compiling the file_B_jsp.java and file_B_jsp.class inside of Catalina.
I am building an Eclipse RCP-based product, and I am running into an issue where when I try to use the built-in p2 UI to install updates to the product, I get an error message in the dialog that "Insufficient access privileges to apply this update."
I have debugged into Eclipse and found that the 'root cause' is that there is a p2 .profile file that has xml that includes this snippet:
<iuProperties id='com.datical.db.ui.product' version='1.33.0.201412032223'>
<properties size='4'>
<property name='org.eclipse.equinox.p2.internal.inclusion.rules' value='STRICT'/>
<property name='org.eclipse.equinox.p2.type.root' value='true'/>
<property name='org.eclipse.equinox.p2.type.lock' value='3'/>
<property name='org.eclipse.equinox.p2.base' value='true'/>
</properties>
</iuProperties>
The relevant line is the one that says <property name='org.eclipse.equinox.p2.type.lock' value='3'/>
I'm not sure what I am doing wrong - I think I must have something awry in my product definition or my feature definition or in my install process that is causing this line to be there.
When I step through the Eclipse code (our target environment is 3.7/Indigo) I see that the profile is being written inside org.eclipse.equinox.internal.p2.engine:SurrogateProfileHandler:addSharedProfileBaseIUs (which is private static.) That is called from SurrogateProfileHandler:createProfile
The product's p2 repository is being built using the tycho plugins, version 0.15.
We finally discovered another piece of information that may be relevant. We were using a custom OSGI directory name. When we removed that, everything started working as expected.
It seems that you have a shared install where the product you would like to update is (potentially) used by many installations as a base - and therefore cannot be updated.
This kind of problem goes beyond what can be answered well on stackoverflow because you'd really need to provide an example project and exact steps to reproduce the problem.
The most plausible cause for the symptoms you are seeing is some kind of file system permission problem. This documentation mentions that you need write permission to the installation directory for running Eclipse with -initialize. Maybe you are lacking some permissions making some of the -initialize procedure fail and leave the installation in an inconsistent state.
I've inherited a C#/NHibernate/MS SQL Server project and am new to NHibernate. One of the first tasks given to me was to migrate the database from MS SQL Server (2008 R2) to Postgresql 9.2. I'm using the Npgsql 2.0.12 (.net 2.0 version). The Mono.Security.dll and Npgsql.dll are included in my project References and they exist in my bin directory. When the code executes the following line:
SessionFactory.OpenSession();
an exception is thrown with the message
"Could not create the driver from NHibernate.Driver.NpgsqlDriver."
Searching the web, gave me a few ideas but none have worked. This code I've inherited is in production at several clients with no issues using MS SQL Server. Here is my hibernate.cfg.xml file:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="connection.connection_string">server=localhost;Port=5432;Database=vehicletracker;User Id=postgres;Password=********;</property>
</session-factory>
</hibernate-configuration>
I did not forget to include "using Npgsql;", it is there. Any suggestions?
Regards,
B
I found the answer to my own question. There were several issues specific to my work environment but ultimately the Mono.Security.dll and Npgsql.dll were not available in my final output directory. The two files were present in the bin directory of my Data Access Layer (a class library) but not in the bin directory of my Test Project that called the class library. Everything is working fine now.
If you're using NuGet for the nhibernate libraries try uninstalling the packages and reinstall them. I'm sure there is a more efficient way someone knows of to fix this kind of issue but for me it solved this exact issue.
I m trying to deploy two struts2 projects(ear files) in jboss 4.2.2GA.When i deploy them seperately they work fine, but if i deploy them together i get the following error
Unable to load configuration. - action -file:/C:/jboss.........struts.xml:60:109
however one of the project works fine.For the other one, welcome page is loaded but none of the actions are performed.It shows this error
HTTP Status 404 - There is no Action mapped for namespace / and action name loginAction
I tried changing package name defined in struts.xml, but no luck
what could be th reason?Do i need to change any configuration in jboss or struts.xml
Ok,finally i made it to work. This post helped me.I added jboss-app.xml file in both of my applications with following content
<jboss-app>
<loader-repository>
com.adc.advertiser:loader=application1.ear
</loader-repository>
</jboss-app>
same for application2.ear
Also in jboss-servie.xml present in deploy directory i changed Java2ClassLoadingCompliance and UseJBossWebLoader to false
I built a Play app and tried to deploy on weblogic using the following commands:
play war -o myApp myApp
Later I just deployed the exploded war directory to weblogic, everything worked fine but everytime I try to access a route. I get the following error:
Not found
GET /myApp/params
This is a rest service not an application with UI's. I tried to deploy on tomcat and everything worked fine but I had to make the application context root to be /. I tried the same thing with weblogic but it did not work.
Here is my route file:
GET / Application.index
GET /sectorinformer/{telephone} Application.show
GET /sectorinformer/public/ staticDir:public
* /{controller}/{action} {controller}.{action}
And here is my controller code:
package controllers;
import models.InstalAddress;
import models.SectorInfo;
import play.Logger;
import play.mvc.Controller;
public class Application extends Controller {
public static void index() {
render();
}
public static void show(String telephone) {
Logger.debug("Starting request");
Logger.debug("domain: '%s'", request.domain);
String instalAddressId = InstalAddress.getInstalAddressId(telephone);
SectorInfo si = new SectorInfo();
si.initializeSectorInfo(instalAddressId);
renderXml(si.generateXmlResponse());
}
}
Thanks in advance for any help.
Weblogic 10 is a fully compliant J2EE 5 application server, as a consequence it is bundled with JPA 1.0.
There are two little issues to get Play running on weblogic.
Applying an Oracle patch to have weblogic support JPA 2.0
Adding a deployment descriptor property to prioritize class resolution from web-inf
Both are trivial and the Play documentation should probably mark weblogic 10 as a working deployment target.
To fix #1, open to following oracle link.
For the lazy readers, add this declaration at the top of wlserver/common/bin/commEnv.sh
export PRE_CLASSPATH=$MW_HOME/modules/javax.persistence_1.0.0.0_2-0-0.jar:$MW_HOME/modules/com.oracle.jpa2support_1.0.0.0_2-0.jar
for windows, the file is wlserver/common/bin/commEnv.bat
set PRE_CLASSPATH=%MW_HOME%/modules/javax.persistence_1.0.0.0_2-0-0.jar;%MW_HOME%/modules/com.oracle.jpa2support_1.0.0.0_2-0.jar
To fix #2, create the file weblogic.xml at the following location myplayapp/war/WEB-INF/weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
The war folder is automatically picked up by play war when the web archive is built.
That's it!
I personally believe Play should create weblogic.xml itself, but that's not how it works as of 1.2.1
Unfortunately I don't have either weblogic know nor time to investigate in you interesting problem. I can only can give you some hints what I would do:
Try to connect the app with a debugger or if this doesn't work checkout the Code and build your own version, with a lot of log-statements.
As far as I know every request will handled by ActionInvoker. invoke. Look how the argument comes in. The other point is the Router, which has still a lot of trace-logs. So perhaps you start first and let the whole stuff run on trace-level. Perhaps that give you some hint's where to look in more detail.
To do this start with a clean app and make no configuration tricks, specially don't run it in ROOT-Context. Just create play war myapp -o myapp.war --zip and deploy it (Don't forget --zip). Then analyze the log.
Good look.
Niels
I deployed my Play app (play 1.1.1) to Websphere 6.1 and I encountered some issues. Not sure you have the same issues but here there are (hope it can help you):
1- JDK version: My "play war xxxx --zip" use a JDK 1.6, and Websphere 6.1 uses a JDK 1.5. When I tried to launch my webapp an UnsupportedClassVersionException was thrown. I regenerated my war file using the correct JDK et voilĂ !
2- When you deploy a war aplication to Websphere, you can specify the context's name. I don't know how to do it with Weblogic, but did you set the correct value ?
As Niels said, analyze logs files: you should find what happens !
Unfortunately, Play! doesn't support Weblogic.
See: http://www.playframework.org/documentation/1.2/deployment