net core how to have dependency into web site's root folder - .net-6.0

I'm working on the existing net core 6 website. on the root is a plugin folder, and inside the plugin folder is one folder for each plugin, a plugin is just a class library.
all the plugins reference shared.dll, but shared.dll is only on the root of the web site, but the site compile and the plugins know, for some reason i don't understand, to find shared.dll in the root.
I added to shared.dll a dependecy to htmlagilitypack.dll, I thought I could only copy to root folder shared.dll and htmlagilitypack.dll in the production server, but each plugin throws the exception could not load file htmlagilitypack.dll .... the only way to make the site to compile well is to copy htmlagilitypack.dll into each plugin folder.
i'm looking for some configuration to explain why each plugin finds correctly shared.dll even if is present only in the root but no other dll i add to shared.dll as dependency.
thanks

Related

Spring cannot find file in classpath, but it's right there at the root of the war file

I have a project using the standard Maven web app layout, deployed within Tomcat 8.5 in Eclipse Photon (with latest updates).
Inside of src\main\webapp\WEB-INF\applicationContext.xml, there is an <import resource="classpath:/other-spring-stuff.xml" />
I verified the other-spring-stuff.xml which is normally sitting in src/main/resources, appears in the root of the WAR generated by mvn install.
But when trying to run the app in Tomcat within Eclipse, I get:
20:37:17 SEVERE: Servlet [servletSpringDispatcher] in web application [/myapp] threw load() exception - 2018-08-27 #{org.apache.catalina.core.StandardContext loadOnStartup}
java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:330)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:227)
I don't really know whether this is a problem with Maven, Eclipse, or Spring.
What can cause this? This is actually in a project that was working fine until yesterday, and nothing changed on the project configuration.
The original problem (spring.xml not found) and secondary problem (false report of missing web.xml) were both resolved by taking the following steps:
Delete the project from the workspace, but keep it on the file system
Go to the project's filesystem location and delete .project, .classpath, and .settings/
Re-Import the project into Eclipse, select Existing Maven Project as project type
To prevent reocurrence: remove .project, .classpath, and .settings/* from git and then add them to .gitignore
I believe the root cause is that one of these Eclipse-specific config files that was checked into the repo had become corrupted and/or incompatible with my version of Eclipse. Also: these files seem to contain absolute-path references to things in the workspace, so they break when the project is checked out unmodified to a different location.

Deploy a embedded Jetty&Jersey war to jetty9,only can see static file?

I cteate a jetty&jersey embedded project with IDEA and Maven,I put it in Github https://github.com/Mengqi777/JettyProject. Run JettyServerStart.java start the server, in the browser address bar enter localhost:8080/dynamic, show OK, enter localhost:8080/static, show static resource file
Now I package it to a war file,and put it in jetty webapps directory. But only can see static file in brower with enter localhost:8080/static.404 Not Found Error when in brower with enter localhost:8080/dynamic
What happend?
What should I do to package this project into a war file or jar file and run it in jetty successfully?
You are doing things in your embedded-jetty usage in JettyServerStart.java that you do not declare/configure in your webapp or war file.
It's a maven project, but not declared as a webapp or war project (in the pom.xml)
Its doesn't have its WEB-INF in the right place (maven directory structure wise), which means your built war file is invalid.
The dependencies are not declared correctly for a webapp or war project (you cannot include jetty-server in a war file)
Your badly located WEB-INF/web.xml does not perform the same configuration steps as your JettyServerStart.java
You don't specify how you created your ${jetty.base} directory to support this war file?
You didn't specify what version of jetty-distribution or jetty-home you downloaded, or are attempting to work with.
The statement "and put it in jetty webapps directory" is unclear, which one? (using jetty-distribution/webapps is invalid and will cause many errors and warnings if you attempt to use it for your own webapps, there's no jetty-home/webapps, and you didn't identify your jetty-base configuration)
The way your project is declared right now, even if manually assembled, skipping maven entirely, you have no servlets, no filters, no listeners, no intializers, only a servlet spec mandated DefaultServlet on url-pattern / giving you static content. That's why accessing http://localhost:8080/static/ works, but nothing else.

Eclipse is not loading plugins placed into the "plugins" folder

I'm currently in a desperate situation right now, I already tried dropping the JAR file into both the "plugins" folder I created inside the "dropins" directory and also into the other "plugins" folder that was already created. I add the "-clean" option into the target of the eclipse shortcut and then I start eclipse. I go to the "plug-ins" section and try searching my plugin, but it does not appear.
I am using Eclipse Jee Neon and this is the JAR plugin I am attempting to use. Can anyone help me resolve this?
https://mvnrepository.com/artifact/org.codehaus.mojo/exec-maven-plugin/1.5.0

How to load Web project in NetBean

I have a web source code includes two folders: META-INF and WEB-INF directory is structured as:
WhatJobs
|META-INF
|WEB-INF
|application
|classes
|framework
|lib
|resources
|web.xml
how I can load project in NetBean. Please help me.
Netbeans will need project property file by reading which, netbeans will be able to understand what type of project is. So either netbeans will check for the nbproject folder where in project.properties file will reside or it should be eclipse project where in netbeans can read eclipse project property file.
Your provided structure will not work.
If you want your project in netbeans, then you can create new project and copy paste files according to your requirement in that new project.

How to enable jsp-tags autocompletion in NetBeans within NetBeans Maven projects?

Using NetBeans 7.1.2.
When editing pages with NetBeans as per the procedure explained below, the IDE offers only autocompletion for <jsp:...> tags:
This is how I have created the NetBeans project and the jsp (though it isn't archetype specific, nor the issue has anything to do with opencms): I have created a maven project with the OpenCms-Module archetype
mvn archetype:generate -DarchetypeCatalog=http://bp-cms-commons.sourceforge.net/m2repo
The archetype creates a maven project with jar packaging.
After that, I have added a jsp under src/main/opencms/modules/blahblah/templates.
And then I have added the taglibs.standard dependency to the project, to try to provide NetBeans with the corresponding tlds.
After several hours trying to get this working, I found this reported and closed bug that hinted me into the right direction:
Added src/main/webapp directory Edit 1: There is autocompletion only for jstl tags if the files are inside src/main/webapp. Workaround in linux (not sure if windows links will work): Create a symlink:
ln -s opencms/ src/main/webapp from the project root folder
Change maven project packaging to war (Project properties -> General -> Packaging)
(Notice that neither the #taglib directive nor the taglibs.standard dependency are necessary.)
If the Web Pages entry does not appear under your project (in the projects view), you may need to restart NetBeans. Now you'll have full autocompletion (only) under src/main/webapp! :-)
Edit 2
Unfortunately, if under version control, NetBeans sees the symlink as a new directory, and all files under it, as new files :-( This is very inconvenient, because to access the IDE integrated version control functionality, you still need to open the original resource.

Resources