I created an ext-plugin for extending Liferay LDAP DefaultPortalToLDAPConverter. I created an ext plugin in eclipse. In the ext-impl/src/main/java/com/liferay/portal/security/ldap/CustomPortalToLDAPConverter i extended DefaultPortalToLDAPConverter and kept only the changed methods in my class. Also I added in ext-spring.xml
<bean id="portalToLDAPConverter" class="com.liferay.portal.security.ldap.CustomPortalToLDAPConverter" />
and then deployed the ext. The deployment went well without any errors. But the changes did not take place. Is there anything wrong in what I am doing? I use jboss7.1.1-final bundled Liferay6.1.2. I build using maven and then deploy by placing the war file in liferay-home/deploy. Then I tried restarting the server. Now I could see that my ext-spring.xml is missing in the jar file. Is there any specific reason for this? Please help.
Most of the tutorials say that the META-INF should be placed in the ext-impl/src or ext-impl/src/main folder. Doing so was not placing my ext-spring.xml in the jar build. Shifting the jar to ext-impl/src/main/resources helped and the META-INF was detected. Upon restarting, the changes took effect.
Not compiled files that are meant to be put inside of class-path of resulting artifact should be placed in main/resources path: http://maven.apache.org/guides/getting-started/index.html#How_do_I_add_resources_to_my_JAR
Related
The structure is as follows:
Actually deployed module is EAR.
EAR contains WAR module, and WAR module contains another JAR module.
In this last JAR, there are some generated classes and their parent folder is also used as source folder. Its path is "target/generated-sources/java".
The problem that is killing me, is that the deployed application throws ClassNotFoundException on server start, and the classes in question are the generated ones.
Now the trick:
if I explicitly change the Deployment Assembly in WAR project in Eclipse not to contain JAR project as "project", but as an archive from the JAR's project "target" folder, JBoss sees the generated classes and starts.
This solution however works only until next eclipse maven project update, so manual edit of deployment assembly is not really a solution.
Any ideas how to deploy or reorganise packages correctly?
OK, seems I have found the solution.
I looked through the build-path of the mentioned JAR file and saw that the entry Output folder pointed to target/test-classes.
After changing this entry to target/classes the application deploys and starts without any missing generated classes.
This is what worked for me:
Expand the 'target' folder of your maven project inside Eclipse (Project Explorer View);
Refresh it (F5);
Right click on your project on 'Servers' tab, then select "Full Publish";
Start your JBoss.
I had to enforce the JBoss Tool "Full Publish" to get an updated version of my target folder by Refreshing it manually on eclipse.
I don't know why but sometimes the Publishing from maven projects (even Full Publishes) do not copy classes from the target Project as it is in the file system. Maybe it's using some outdated memory info or some cache...
Anyway, this is what works for me.
After an update to Eclipse 4.15 and JBoss tools I got this problem too.
My solution: project -> properties -> Java Build Path --> Source
There my Output folder from my source was linked to project/target/classes, I changed this to project/target/project-projectversion/WEB-INF/classes
When I looked into the standalone JBoss folder I saw the folder structure of my source, but the classes where missing, when I changed the output folder the classes pop up and everything worked like before.
I am pretty sure the update made the problems.
I am working on a dynamic web project in Eclipse Kepler. I am trying to write a simple JSP using JSTL <c:forEach>. For that I have included the required JAR jstl-1.2.jar under libraries and added the following statement to JSP:
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
However, when I run it using Run as --> Run on Server, it shows the following error.
org.apache.jasper.JasperException: /test.jsp(4,61) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
I have already consulted a lot of links, but I don't understand how this is caused and how I can solve it.
For that I have included the required JAR jstl-1.2.jar under libraries
This makes it only available during compile time, not run time.
You need to undo everything which you did in project's Build Path and Deployment Assembly properties. If you're not sure anymore what changes you've all done over there, then throw away the current project and recreate the project from scratch and remember to never touch the project's Build Path and Deployment Assembly properties until you really really understand what it is doing under the covers (in other words, when you're able to create, build and deploy a WAR from top of head in command prompt without using any IDE).
The proper procedure is:
Open the project's WebContent/WEB-INF/lib folder.
Drop the jstl-1.2.jar file in there.
That's it. Nothing more needs to be done. No need to fiddle anywhere in project's properties. Eclipse will automatically do the necessary magic there.
See also:
Our JSTL wiki page
Update: as per the comments,
web.xml is declared to version 2.4 and I am using Basic Server: J2EE Preview at localhost
There's the cause of your problem. JSTL 1.2 requires a minimum of Servlet 2.5 and "J2EE Preview" is completely outdated. Grab Tomcat 7 (pick the core ZIP file), extract it, integrate it in Eclipse, add the project to Tomcat, fix your web.xml to be Servlet 3.0 compatible, then start Tomcat and enter the desired URL in your favourite webbrowser.
Make sure that jstl-1.2.jar is included in your WEB-INF/lib directory and the deployment assembly.
Right Click Project > Project Properties
Deployment Assembly
Click Add, then Folder
Select the WEB-INF/lib folder.
Just had this problem and nothing straght forward about it online.
SOLUTION:
Add JSTL library to the project libraries
Ok. I am using eclipse kepler.
Ihave an eclipse project called 'afd-core'. It has some classes, and a directory etc/hibernate containing hibernate config - lookup.hbm.xml.
I have another project afd-public. It is a webapp, and needs the stuff in afd-core on it's classpath.
And I think I have tried everything.
afd-public->project referencers: added add-core as a referenced project
afd-public->java build path->projects: added afd-core
afd-public->java build path->order and export: marked afd-core as exported
afd-core->java build path->added etc/hibernate as a classpath entry
afd-core->order and export->marked etc/hibernate as exported
Didn't work. When I run add-public as a web app, complains that it cant find the hibernate config.
So I made etc/hibernate a source rather than a class direcrory. Still didn't work.
Explicitly added add-core/etc/hibernate as a class directory in the add-public project. Still didnt work. Marked those class drectories as 'exported'. Still didn't work.
Manually copied the hibernate config into afd-public/webapp/WEB-INF/classes . Ok, it finds the hibernate config, but it does not find the core class files.
In other words, the afd-public webapp is not including dependencies from afd-core AT ALL, not in any way, shape, or form into the webapp that it deploys locally to tomcat. Whether or not I mark them as exported from afd-core. Whether or not I include the project or the directories explicitly. Whether or not I do or dont export them from the afd-public webapp.
Nothing. nada. Won't go.
Help?
Found it. Goddamnit - I needed to fiddle with Deployment Assembly in afd-public. It seems that there are a couple of ways to do it.
I can include afd-public/build/classes and afd-public/etc/hibernate and have them deployed to WEBINF/classes, or I can deploy the add-core jarfile to lib.
To get the afd-core jarfile correct, I create afd-core as a j2ee "utility project" and check that the Deployment Assembly there is correct. Which it is.
I have an Eclipse Indigo installation with a JBoss 6 server managed by it. I have a Maven project with a few modules. These modules all build just fine from the command line.
One of the modules is an EAR. This is dependent on two JAR modules and a couple of WAR modules. When I package the EAR from the command line (mvn clean package), the EAR contains all the necessary JAR and WAR files. However, when I deploy it from Eclipse, the two module JAR files are missing from JBoss. The WAR files are just fine. Inside the "Add and Remove..." dialog the JAR files are also present, but not when deployed. I've checked JBoss' deployments folder and there they are indeed missing. The strange thing is, with the exact same POMs and code, all of my colleagues with the same(?) setup don't have this problem.
The two JAR modules are listed in the dependency management part of the parent POM. They are also listed as dependencies in the EAR POM. Still, Eclipse refuses to deploy them with the EAR.
Does anybody have any idea how I can solve this issue? I can manually package and deploy the EAR, but 1) that takes longer, and 2) I can't use Eclipse's debugging functionality this way.
Note: previously asked at http://www.coderanch.com/t/580959/vc/Eclipse-JBoss-some-JAR-files
Right mouse button on project -> Maven -> Update project
I experienced the exact same issue, different eclipse (Eclipse Mars, WildFly 8.1 ).
The unsettling part was that I didn't change anything in the code or in the IDE (that I am aware of) and it started malfunctioning.
I suspect it has something to do with the cached memory of eclipse for it's plugins, anyway, after many hours of trying different things we fixed it by deleting the folder .eclipse under your user in windows.
Seems silly, but we tried everything except that, and that thing did the trick
I'm encountering a similar issue, however my environment is much, much simpler - being a web project, with a utility project. Not using maven at all and deploying to tomcat7.
The class file is not being deployed to the web-inf as expected, although the utility project is referenced, and marked as to be exported.
However with your issue, I came across this post:
http://blog.frankel.ch/better-maven-integration-leads-to-unforeseen-consequences-bugs#comments
which might provide a clue. Hope this helps.
I had the same issue. I didn't modify my code at all, I deleted all the projects from the work space, closed eclipse and reopened it. Then I did a clean and build of the project (which took much longer than before). This time when I went to add the EAR project, it had all the dependencies listed and actually worked.
I am currently working on a GWT project. I have used the GWT webapplicationcreator shell script to create it with the -maven option since I use maven for building it.
So the problem is that when I package the project, using "mvn package", and deploy it to tomcat, it tells me that it can not find out META-INF/persistence.xml even though in my project I have it at the correct location src/main/webapp/META-INF/persistence.xml. I have even extracted the war file to check that it's out there.
246 [Thread-38] INFO org.hibernate.ejb.Ejb3Configuration - Could not find any META-INF/persistence.xml file in the classpath
Have you ever experienced this weird behaviour ? Can you help me figure it out ?
thanks a lot guys
Check persistence.xml is correctly deployed.
See this very useful link:
http://javahowto.blogspot.com/2007/06/where-to-put-persistencexml-in-web-app.html