Creating dynamic webapp in eclipse - eclipse

I have created a dynamic web application project in eclipse. I am able to display hello world. Now when I tried loading owl file I am getting error.
java.lang.NoClassDefFoundError: org/semanticweb/owlapi/apibinding/OWLManager
I just copied the jar to my lib folder. owlapi-api-5.1.0.jar javax-inject.jar owlapi-apibinding-5.1.4.jar. Please tell me what i am missing. Even the pom.xml file is not there in my project. I couldn't able to add maven dependencies. I don't know why? Please tell me how to add the depenency too.

Related

Hibernate configuration with tomcat and eclipse

I'm creating a webApp in eclipse using tomcat & hibernate (for mysql). Ive unit tested by code and I am able to connect to the db and pull data, but I'm running into issues when trying it from the web app.
From the exception it looks like it isnt able to get to the hibernate.cfg.xml, but I've tried placing the file in the src folder, WEB-INF/lib & WEB-INF/classes but I still get the same error.
The line of code that it's failing on is:
Configuration configuration = new Configuration();
I would really really appreciate any help!
ClassPath References:
Project References:
Stacktrace:
java.lang.ExceptionInInitializerError
org.hibernate.cfg.Configuration.reset(Configuration.java:324)
org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
root cause
java.lang.NullPointerException
org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
org.hibernate.cfg.Configuration.reset(Configuration.java:324)
org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
SOLUTION
Thanks to #Engineer, I was able to solve this by removing the jars from WEF-INF/lib & from the class path of the run configuration. Then I added them back using the "Deployment Assembly" menu in eclipse. I also have my project references here.
From Ranga Reddy:
Problem: Because of adding the jars in user library class path.
Solution: Instead of adding the jar files using User Library add the jars using classpath.

Configuring Java build path for External Libraries adding jars into Reference Library

I am using MAC with Eclipse Juno. My problem is When I create Dynamic Web Project in Eclipse and configure Java Build Path, all the external jars are getting added in the Referenced Library, rather than web-inf >> lib. So each time while running the project I have to manually copy-paste the jar to web-inf >> lib. Please let me know if i have to make any change in eclipse for this. Any help or suggestion would be appreciated !!!
You have to also export the libraries.
Project properties -> Java Build path. You'll see something similar to the screen shot.
Just check which library you want to export. It will be copied to lib folder

Eclipse :JPA in Dynamic Web Project

In eclipse, I created a JPA project with my entities and repository's.
Now I want to create a Dynamic web project with my servlets and jsp's.
How do I get both to work with each other?
I would say make a jar from my JPA project and import it in the Dynamic Web Project where I load it on the build path.
I tried this but I get a "The import ...... cannot be resolved" error
Is there a specific location I need to place this Jar?
Dont add it as a jar , add in build path as Reference Project
I got this to work by adding the jar in the WebContent/WEB-INF/lib folder. You don't need to add to the build path, just place your jar's here and your IDE will use them when needed.

How do you import a Java Class Library into a Java Web project (using NetBeans)?

I've already tried the options "Add folder...", "Add Library...", and "Add JAR/Folder...", but it's not working this time -- I've done this several times before without any problems.
I've also tried to add the folder / JAR file (.war-file) manually to the projects properties in every thinkable way, but still no success.
And so far, Google hasn't helped either..
Any help would really be appreciated.
(This is for a Java Web project with JavaServer Faces, using NetBeans 7.1)
Solved: I never found out what caused the problem. I ended up re-installing entire NetBeans, and re-created (a thousand times) the project I was trying to import. And in the end, I got it working.
Put the JAR file in the WEB-INF/lib directory of your web project. All JARs in the WEB-INF/lib and all packages in WEB-INF/classes are automatically in the CLASSPATH.
Can you make "Hello, servlet" work? If not, why bother with JSF? Do a simple web app successfully and build up from there.
I had this problem with netbeans, but it seems like all the answers I found are for Eclipse (I guess am wrong) as I dont see any WEB-INF/lib directoryin NetBeans, though I have a WEB-INF directory.
so here what I did.
I remove the tomcat server on NetBeans, go to C:\apache-tomcat-7.0.30\lib , put the jstl-1.2.jar file their, restart NetBeans and add a new (Tomcat) server, create a new web app, and their, I could find the jstl-1.2.jar file in the Libraries > Apache tomcat.
and for unknown reason, it worked.!

Where to put jar files for struts 2 in eclipse,giving error index.jsp(8,40) File "/struts-tags" not found

Eclipse is only giving me option to include jar files in Java Build Path->Libraries .In some tutorial sites they are showing to add jar files in WEb-INF/lib,but iam not able to add jar here.i tried importing files to WEB-INF/lib,jars were added but they did not had jar icon instead some weird icon ,and when i m trying to run my struts login page its giving me error
/index.jsp(8,40) File "/struts-tags" not found.Where to put jar to make it work,Also while learning struts sometime i get Http 404 error,but when i restart eclipse(I tried restarting server but it didnt help) the error is gone all of a sudden.why this is happening.Eclipse is so confusing.
Go to the your web-project folder outside the eclipse.Cope your jars (which are required for your project).
Than open-up Eclipse, follow these steps
Right Click on project(Project Explorer) choose -->Configure build path.
Go to Library tab and click on add jars, it will open this wizard
Add required jars and i hope this will solve your problem.
Make sure you have required jars in your class-path..
As jars are showing some weird icon, I would suggest you to change the jar files. Also, make sure your added jar contains struts-tags.tld file. This will resolve error on index.jsp.
sorry, system is not allowing me to put comment. So editing the same.
Follow below steps to check the jars are added to build path correctly -
switch to package explorer view.
check whether your jars are added under web app Libraries. If yes your jars are added properly.
Then check struts-tags.tld file is present inside struts2-core.jar. If not present then copy it or add new jar containing the same.