I have been working on a Java web application using wicket framework on Netbeans 7.2 and out of a sudden I encountered this problem. I tried cleaning the build-impl.xml then restarting the IDE and I should say I have fairly low knowledge on this. Can someone please tell me why it is giving an error and how I can fix that?
The lines 1024, 1025 and 1026 are :
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
The error message says :
nbproject/build-impl.xml:1025: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 4 seconds)
I came up with a solution by myself, I cloned the project and changed the project's directory name back to original, that worked fine for me. But it seems to have a better and proper solution, though.
/* START BY RESTARTING YOUR GLASSFISH SERVER */
1-add DBMS(ex:oracle,MySQL,MsSQL..) jdbc connector jar to domain
"glassfish directory/domain/{yourDomain}/lib"
2-add connection pool in glassfish server "JDBC-->ConnectionPool"
3-add your JNDI "JDBC-->jdbc ressource"
4-Test connection
5-add additional properties
IF YOU HAVE NO PASSWORD ON YOUR DATABASE ACCOUNT YOU CAN EASILY
6- glassfish/config/domain.xml change password value to "" in your jdbc-connection-pool
may its so late but the response useful for others so : Sometimes, when you don't specify a server or servlet container at the creation of the project, NetBeans fails to create a context.xml file.
In your project under Web Pages, create a folder called META-INF.
Do this by right mouse button clicking on Web pages, and select:
New->Other->Other->File Folder
Name the folder META-INF. Case is important, even on Windows.
Create a file called context.xml in the META-INF folder.
Do this by right mouse button clicking on the new META-INF folder, and select:
New->Other->XML->XML Document
Name it context (NetBeans adds the .xml) Select Well-formed Document Press Finish
Edit the new document (context.xml), and add the following:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/app-name"/>
Replace app-name with the name of your application.
Now your in-place deployment should work. If not, make sure that the file can be read by everyone.
The context.xml file is specific to Tomcat. For more information about that file, see the Tomcat documentation at tomcat.apache.org.
Related
I am currently using intellij for my java code. When i try to run the Project, it throws the below error.
2016-06-21 09:19:46.691::INFO: jetty-6.1.14
2016-06-21 09:19:46.843::WARN: Web application not found src/main/webapp
2016-06-21 09:19:46.843::WARN: Failed startup of context org.mortbay.jetty.webapp.WebAppContext#359d136a{/admin,src/main/webapp}
java.io.FileNotFoundException: src/main/webapp
In RUN >> Edit Configurations, Working directory $MODULE_WORKING_DIR$
Example
Did you add the folder "webapp" to your classpath/resources-folder?
I guess you have something like:
applicationContext.setBaseResource(Resource.newClassPathResource("webapp", true, true));
In your WebAppContext-configuration - so, just add a folder named "webapp" under "src/main/resources/." and I guess it should be working as intended.
I know this question has answered many a time with most useful answer as below,
Where to place and how to read configuration resource files in servlet based application?
However, We have some special requirement as below,
Webapp will be deployed to tomcat.
Normal java app in form of .jar will be placed under folder /myapp
myappConfig.property file will be placed under /myapp
Directory Structure on client machine
/myapp
/myapp.jar
/assests/myappConfig.property
/tomcat/webapps/myapp.war
Basically myapp.jar and myapp.war will access sql db connection values for MySql database connection and db operations.
Accessing myappConfig.property from myapp.jar --> Working fine
File jarPath = new File(Myapp.class.getProtectionDomain().getCodeSource().getLocation().getPath());
String propertiesPath = jarPath.getParent();
System.out.println(" propertiesPath-" + propertiesPath);
mainProperties.load(new FileInputStream(propertiesPath + "\\assets\\myapp.property"));
Can anyone help/suggest how to implement,
Accessing myappConfig.property file from mywebapp,
provided run time change in myappConfig.property file does not required myapp.war to be redeployed
Thanks for your help in advance.
edit
Below is the steps in which we want to deliver the project to client.
Below is my app directory
/myapp
/myapp.jar
/assests/myappConfig.property
/tomcat/webapps/myapp.war
pack everything in one package with some packaging tool.
Run this package in client machine at any location and it will have same directory structure as above
Here, I do not want to hard code any location in webapp or tomcat for "/assests/myappConfig.property"
Normal Java app I can read property file but for wepapp I am not getting clear idea for how to do that?
You can add a <context> to tomcat/conf/server.xml (in this example, linux path):
<Context docBase="/home/yourusername/tomcat/assests" path="/assets" />
If you are using Windows:
<Context docBase="C:\path\to\myapp\assets" path="/assets" />
And then you can access it like any other resource within your webapp (e.g.: /assets/myappConfig.property).
If you are using JDBC for example, you could store the connection properties in a Singleton and request it from there, and that class could take care of change checks on that file.
I am currently working on a weblogic 10 application server that has several installed ears. I got a request to change the application name of some aps as they appear in
Home >Summary of Deployments
I went to the appropiate Plan.xml and changed the with the appropriate name, restarted the domain but the name did not change.
Any ideas?
You can do that easily by modifying config.xml file in
DOMAIN_NAME/config
You can just modify the name and restart the server.
<app-deployment>
<name>jms-rename</name>
<target>DefaultServer</target>
<module-type>ear</module-type>
<source-path>C:\JMSTest\application\jms\target\jms-0.0.1-SNAPSHOT.ear</source-path>
<security-dd-model>DDOnly</security-dd-model>
</app-deployment>
The answer was very simple in the end. I added inside the EAR's manifest file the following entry
Weblogic-Application-Version: x.y.z
In this way I didn't have to mess up with any of the Weblogics configuration files.
I have created sample web application, packaged it into WAR, then put it into webapps folder into jetty. And it does not work.
Proof, windows from top to bottom:
1) The content of GreetingController.java
2) The compiled file is present inside WAR file in appropriate place
3) The web application is working, it's name is recognized (folder content displayed)
4) Controller is not working and it's name is not recognized
What else to check?
UPDATE
My WAR file: https://www.sendspace.com/file/mb94jt
I think you are missing something in your app. The page you are referring is just a guide to help understand how the framework works. For complete simple examples, please refer to:
https://github.com/javalite/activeweb-bootstrap - this is a simple app with Bootstrap and no database support
https://github.com/javalite/activeweb-lessc - simple app without database, but with Less instead of CSS
https://github.com/javalite/activeweb-simple - simple ActiveWeb + ActiveJDBC webapp (CRUD)
Here is the Getting Started page: http://javalite.io/getting_started_activeweb
hope it helps
I m new in Struts2. Creating a hello world program using struts. When I run it got first screen where i put my input but when click on submit button giving following error.
Source of this helloworld example: http://www.tutorialspoint.com/struts_2/index.htm
HTTP Status 404 - /HelloWorldStruts2/hello
type Status report
message /HelloWorldStruts2/hello
description The requested resource (/HelloWorldStruts2/hello) is not available.
Apache Tomcat/6.0.29
Suggest what is the issue?
Got the solution.
In index.jsp there was <form> tag. When I changed it to <s:form> its working fine.
Or change from
<form action="hello">
to
<form action="hello.action">
This is what worked for me, specific to the question. Tomcat 8 was used:
Make sure you have created the classes folder under WebContent\WEB-INF.
In that create the logging.properties file and add the following content to it. (It doesn't matter if the file jumps on its own to Java Resources > Libraries) :-
org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = \ java.util.logging.ConsoleHandler
Then in the location of Tomcat's webapps folder delete your HelloWorldStruts2.war file.
Now follow the site's instructions to Export your project to a new HelloWorldStruts2.war file (remember to overwrite the existing .war file with the same name if it's there).
Again, deploy this file by copying it to your Tomcat directory's webapps folder.
In the browser, go to http://localhost:8080/HelloWorldStruts2/index.jsp again, though I'm not sure it will work for sure this time.
But this time, watch the Tomcat server application's verbose output. You will get some kind of exception like this (leave out Warnings for now):
30-Mar-2014 17:39:29.273 SEVERE [localhost-startStop-7] org.apache.catalina.core.StandardContext.filterStart Exception starting filter struts2 java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:213)
at org.apache.struts2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:102)
...
Seeing this, what I did immediately was copy the commons-lang3-x.y.z.jar to the WebContent\WEB-INF\lib folder, and then exported and deployed the project again.
This time, again the page wasn't showing, so I watched the logs and found out that Tomcat did not explicitly clear the contents of the webapps\HelloWorldStruts2 folder.
After deleting both HelloWorldStruts2 and HelloWorldStruts2.war and refreshing the index.jsp page in the browser, my project did work fine!