Why next.js build makes serveral files in the dist directory? - next.js

I'm very new to next.js.
previously, I use webpack, and make config from scratch.
webpack build make the only bundle.js in dist directory (only one bundled js file)
and I make a project with next.js from scratch.
but now I tried npm run build, It makes too many files.
with Webpack, I only need an index.html and one bundled js file,
but, now I have no idea how to use and test with this many files.
Is there any wrong with me?
.
├── build-manifest.json
├── cache
│   └── webpack
│   ├── client-development
│   │   ├── 0.pack
│   │   ├── 1.pack
│   │   ├── 10.pack
│   │   ├── 11.pack
│   │   ├── 12.pack
│   │   ├── 13.pack
│   │   ├── 14.pack
│   │   ├── 15.pack
│   │   ├── 16.pack
│   │   ├── 2.pack
│   │   ├── 3.pack
│   │   ├── 4.pack
│   │   ├── 5.pack
│   │   ├── 6.pack
│   │   ├── 7.pack
│   │   ├── 8.pack
│   │   ├── 9.pack
│   │   ├── index.pack
│   │   └── index.pack.old
│   ├── client-production
│   │   ├── 0.pack
│   │   └── index.pack
│   ├── server-development
│   │   ├── 0.pack
│   │   ├── 1.pack
│   │   ├── 10.pack
│   │   ├── 11.pack
│   │   ├── 2.pack
│   │   ├── 3.pack
│   │   ├── 4.pack
│   │   ├── 5.pack
│   │   ├── 6.pack
│   │   ├── 7.pack
│   │   ├── 8.pack
│   │   ├── 9.pack
│   │   ├── index.pack
│   │   └── index.pack.old
│   └── server-production
│   ├── 0.pack
│   └── index.pack
├── react-loadable-manifest.json
├── server
│   ├── pages
│   │   ├── _app.js
│   │   ├── _document.js
│   │   ├── _error.js
│   │   └── index.js
│   ├── pages-manifest.json
│   └── webpack-runtime.js
└── static
├── chunks
│   ├── amp.js
│   ├── main.js
│   ├── node_modules_next_dist_client_dev_noop_js.js
│   ├── pages
│   │   ├── _app.js
│   │   ├── _error.js
│   │   └── index.js
│   ├── polyfills.js
│   ├── react-refresh.js
│   └── webpack.js
├── development
│   ├── _buildManifest.js
│   └── _ssgManifest.js
└── webpack
├── 496129cd3e9c913aa9ff.webpack.hot-update.json
└── webpack.496129cd3e9c913aa9ff.hot-update.js
13 directories, 58 files
Here is my next.config.js
const path = require('path');
module.exports = {
distDir: 'dist',
webpack: function (config, options) {
config.experiments = {};
return config;
},
sassOptions: {
includePaths: [path.join(__dirname, 'styles')],
},
env: {
API_KEY: process.env.API_KEY,
AUTH_DOMAIN: process.env.AUTH_DOMAIN,
PROJECT_ID: process.env.PROJECT_ID,
STORAGE_BUCKET: process.env.STORAGE_BUCKET,
MESSAGING_SENDER_ID: process.env.MESSAGING_SENDER_ID,
APP_ID: process.env.APP_ID,
}
};
package.json script
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},

Related

Why are my css changes not being reflected in my browser? [duplicate]

This question already has an answer here:
Why is my specific css code changes not being reflected on my browser?
(1 answer)
Closed 2 years ago.
So I am noticing that my css changes are not being reflected. They were originally working when I first created the files but I'm not sure what I did because it's not reflecting changes anymore. I did a hard-reload and cleared the cache but still nothing. Like I can literally delete the css file and my badge which I'm trying to edit is still there... it only goes away once I take it off of base.html directly. So what is going on here? I have a static folder in my app, with a css folder and then my css/notification file. I tried doing collectstatic through terminal but that doesn't do anything. Also, I already have my load static tag in my html. And, my css file is indeed loading when I go to inspect element and the changes are showing up within that file but they are not showing up within my browser. Any idea what's going on here? Nothing I do seems to be working!
ps: Changing STATICFILES_DIR to STATICFILES_DIRS doesn't do anything.
base.html/header
<link rel="stylesheet" href="{% static 'css/notification.css' %}" type="text/css" class = "notification"/>
base.html/body
<a class= text-danger href="{% url 'dating_app:conversations' user.id %}" type="text/css" class="notification">
<span>Inbox</span>
<span class="badge">{% unread_messages request.user %}</span>
</a>
notification.css
.notification {
text-decoration: none;
padding:50;
position: relative;
display: inline-block;
}
.notification .badge {
position: absolute;
top: 50px;
right: -25px;
padding: 20px 20px;
border-radius: 100%;
background: white !important;
color: white;
}
settings.py
STATIC_URL = '/static/'
STATICFILES_DIR = [
"/DatingAppCustom/dating_app/static",
]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'dating_app/media')
settings.py/installed_apps
'django.contrib.staticfiles'
urls project
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('dating_app.urls', namespace= 'dating_app')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
**edit/ directory **
.
├── 11_env
│   ├── bin
│   │   ├── __pycache__
│   │   ├── activate
│   │   ├── activate.csh
│   │   ├── activate.fish
│   │   ├── django-admin
│   │   ├── django-admin.py
│   │   ├── easy_install
│   │   ├── easy_install-3.7
│   │   ├── pip
│   │   ├── pip3
│   │   ├── pip3.7
│   │   ├── python -> python3
│   │   ├── python3 -> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
│   │   └── sqlformat
│   ├── include
│   ├── lib
│   │   └── python3.7
│   └── pyvenv.cfg
├── dating_app
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-37.pyc
│   │   ├── admin.cpython-37.pyc
│   │   ├── forms.cpython-37.pyc
│   │   ├── models.cpython-37.pyc
│   │   ├── tests.cpython-37.pyc
│   │   ├── urls.cpython-37.pyc
│   │   └── views.cpython-37.pyc
│   ├── admin.py
│   ├── apps.py
│   ├── chat.html
│   ├── forms.py
│   ├── media
│   │   └── profile_photo
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── 0002_auto_20200410_2231.py
│   │   ├── 0003_auto_20200411_2011.py
│   │   ├── 0004_auto_20200413_1930.py
│   │   ├── 0005_auto_20200413_1946.py
│   │   ├── 0006_auto_20200413_2222.py
│   │   ├── 0007_auto_20200422_1947.py
│   │   ├── 0008_auto_20200425_0039.py
│   │   ├── 0009_auto_20200426_1957.py
│   │   ├── 0010_auto_20200426_2005.py
│   │   ├── 0011_auto_20200426_2005.py
│   │   ├── 0012_auto_20200426_2007.py
│   │   ├── 0013_auto_20200427_1846.py
│   │   ├── 0014_auto_20200503_1947.py
│   │   ├── 0015_auto_20200503_2011.py
│   │   ├── 0016_auto_20200511_0104.py
│   │   ├── __init__.py
│   │   └── __pycache__
│   ├── models.py
│   ├── static
│   │   ├── css
│   │   ├── fonts
│   │   ├── images
│   │   └── js
│   ├── tag.py
│   ├── templates
│   │   └── dating_app
│   ├── templatetags
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   └── unread_messages_counter.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── dating_project
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-37.pyc
│   │   ├── settings.cpython-37.pyc
│   │   ├── urls.cpython-37.pyc
│   │   └── wsgi.cpython-37.pyc
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── db.sqlite3
├── manage.py
├── requirements.txt
└── static
├── admin
│   ├── css
│   ├── fonts
│   ├── img
│   └── js
├── css
│   ├── notification.css
│   └── style.css
└── images
├── cupids_corner_logo.jpg
└── matching_cupid.png
Can you try changing this
STATIC_URL = '/static/'
STATICFILES_DIR = [
"/DatingAppCustom/dating_app/static",
]
to:
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "dating_app/static"),
]
as recommended in the docs

How to find django static files in production

I am trying to get a django web site into production. The dev version works fine, but in production the application does not seem to find my css files.
I know that there are a lot of queries similar to mine and I have perused many and tried the suggested solutions.
The production version seems to work perfectly apart from the static files issue
In settings.py I have
DEBUG=False
and
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
I have run
python manage.py collectstatic
and the css and js directories are copied correctly into my_app/static_files
I have restarted the server but it still does not function correctly.
My tree on the production server is:
.
├── my_app
│   ├── __init__.py
│   ├── settings.py
│   ├── static
│   │   ├── css
│   │   │   ├── main.css
│   │   └── js
│   ├── templates
│   │   ├── base.html
│   ├── urls.py
│   └── wsgi.py
├── boards
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── templates
│   │   └── boards
│   │   ├── about.html
│   │   ├── contact.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── manage.py
├── passenger_wsgi.py
├── static_files
│   ├── css
│   │   ├── main.css
│   └── js
├── _templates
Web servers handle this. What are you using as a server? For example, on Nginx we have paths for both static/media files.
server {
set $app_name 'APP_NAME';
set $root 'ROOT/$app_name';
listen 8000;
server_name 127.0.0.1;
location /static/ {
root $root/;
}
location /media/ {
root $root/attachments/;
}
location / {
include proxy_params;
proxy_pass http://unix:$root/$app_name.sock;
}
}
After hours of going through code line by line and inspired by an answer to this question I spotted this in wsgi.py (which didn't look right):
if settings.DEBUG:
application = StaticFilesHandler(get_wsgi_application())
else:
application = get_wsgi_application()
I have changed it to:
if settings.DEBUG:
application = get_wsgi_application()
else:
application = StaticFilesHandler(get_wsgi_application())
and now it finds the static files and works perfectly.

Sinatra with Slim template--cannot link to css file: What is the path from a template file to a css file in the public directory?

~/sinatra_projects/slim_app$ tree .
Here's the relevant part of the tree output:
.
├── models
├── public
│   ├── cool_stuff.html
│   ├── css
│   │   └── css.css
Here's the mostly irrelevant part:
│   ├── imgs
│   ├── js_ready.js
│   ├── mycss.css
│   └── tablesorter-master
│   ├── LICENSE
│   ├── README.md
│   ├── addons
│   │   └── pager
│   │   ├── jquery.tablesorter.pager.css
│   │   └── jquery.tablesorter.pager.js
│   ├── bower.json
│   ├── build
│   │   ├── ParseMaster.js
│   │   ├── js.jar
│   │   ├── jsmin.js
│   │   ├── min.js
│   │   ├── pack.js
│   │   ├── packer.js
│   │   └── writeFile.js
│   ├── build.xml
│   ├── changelog
│   ├── docs
│   │   ├── assets
│   │   │   └── ajax-content.html
│   │   ├── css
│   │   │   └── jq.css
│   │   ├── example-ajax.html
│   │   ├── example-attribute-sort.html
│   │   ├── example-empty-table.html
│   │   ├── example-extending-defaults.html
│   │   ├── example-meta-headers.html
│   │   ├── example-meta-parsers.html
│   │   ├── example-meta-sort-list.html
│   │   ├── example-option-debug.html
│   │   ├── example-option-digits.html
│   │   ├── example-option-sort-force.html
│   │   ├── example-option-sort-key.html
│   │   ├── example-option-sort-list.html
│   │   ├── example-option-sort-order.html
│   │   ├── example-option-text-extraction.html
│   │   ├── example-options-headers.html
│   │   ├── example-pager.html
│   │   ├── example-parsers.html
│   │   ├── example-trigger-sort.html
│   │   ├── example-triggers.html
│   │   ├── example-update-cell.html
│   │   ├── example-widgets.html
│   │   ├── img
│   │   │   └── external.png
│   │   ├── index.html
│   │   └── js
│   │   ├── docs.js
│   │   └── examples.js
│   ├── jquery-latest.js
│   ├── jquery.metadata.js
│   ├── jquery.tablesorter.js
│   ├── jquery.tablesorter.min.js
│   ├── package.json
│   └── themes
│   ├── blue
│   │   ├── asc.gif
│   │   ├── bg.gif
│   │   ├── blue.zip
│   │   ├── desc.gif
│   │   └── style.css
│   └── green
│   ├── asc.png
│   ├── bg.png
│   ├── desc.png
│   ├── green.zip
│   └── style.css
├── routes.rb
├── themes
│   ├── blue
│   │   ├── asc.gif
│   │   ├── bg.gif
│   │   ├── blue.zip
│   │   ├── desc.gif
│   │   └── style.css
│   └── green
│   ├── asc.png
│   ├── bg.png
│   ├── desc.png
│   ├── green.zip
│   └── style.css
└── views
├── components
│   └── _date.slim
├── index.slim
├── index_with_partials.slim
├── layout.slim
├── xindex.slim
├── xlayout.erb
├── xlayout.slim
└── yindex.erb
21 directories, 79 files
Here's slim_app/routes.rb:
require 'sinatra'
require 'slim'
get '/' do
slim :index
end
Here's slim_app/views/layout.slim:
doctype html
html
head
meta charset="utf-8"
title Test
link rel="stylesheet" type='text/css' src="/css/css.css")
body
h1 This is the Layout. Find me in your_app/views/layout.slim
== yield
Here's slim_app/public/css/css.css:
div {
background-color: red;
font-weight: 900;
}
h1 {
background-color: blue;
}
Here's slim_app/views/index.slim:
div Hello
div Goodbye
No matter what path I use for the css file, this is always the result:
You need href for link, not src, so you want something like this:
link rel="stylesheet" type='text/css' href="/css/css.css"
(script uses src – a confusing difference we seem to be stuck with.)

rsync copy only specific files from specific subfolders, without creating empty folders

Imagine a file structure like this:
test
├── a
│   ├── 0
│   │   ├── file0.rtf
│   │   ├── file0.txt
│   │   ├── file1.rtf
│   │   ├── file1.txt
│   │   ├── file2.rtf
│   │   └── file2.txt
│   ├── 1
│   │   ├── file0.rtf
│   │   ├── file0.txt
│   │   ├── file1.rtf
│   │   ├── file1.txt
│   │   ├── file2.rtf
│   │   └── file2.txt
│   ├── 2
│   │   ├── file0.rtf
│   │   ├── file0.txt
│   │   ├── file1.rtf
│   │   ├── file1.txt
│   │   ├── file2.rtf
│   │   └── file2.txt
│   └── 3
│   ├── file0.rtf
│   ├── file0.txt
│   ├── file1.rtf
│   ├── file1.txt
│   ├── file2.rtf
│   └── file2.txt
└── b
├── 0
│   ├── file0.rtf
│   ├── file0.txt
│   ├── file1.rtf
│   ├── file1.txt
│   ├── file2.rtf
│   └── file2.txt
├── 1
│   ├── file0.rtf
│   ├── file0.txt
│   ├── file1.rtf
│   ├── file1.txt
│   ├── file2.rtf
│   └── file2.txt
├── 2
│   ├── file0.rtf
│   ├── file0.txt
│   ├── file1.rtf
│   ├── file1.txt
│   ├── file2.rtf
│   └── file2.txt
└── 3
├── file0.rtf
├── file0.txt
├── file1.rtf
├── file1.txt
├── file2.rtf
└── file2.txt
Where I do not know the real names of a and b. Nevertheless, I want to copy all *.txt files from subfolders of a and b (however they are named) if they are in the subfolder 0.
It kind of works if I am using
rsync -avz --include=*/ --include='*/0/*.txt' --exclude=* test/ test2/
However, rsync creates empty folders 1, 2, 3, which I would like to avoid. How do I do this?
Output from the rsync command above:
sending incremental file list
a/
a/0/
a/0/file0.txt
a/0/file1.txt
a/0/file2.txt
a/1/
a/2/
a/3/
b/
b/0/
b/0/file0.txt
b/0/file1.txt
b/0/file2.txt
b/1/
b/2/
b/3/
I want
sending incremental file list
a/
a/0/
a/0/file0.txt
a/0/file1.txt
a/0/file2.txt
b/
b/0/
b/0/file0.txt
b/0/file1.txt
b/0/file2.txt
It turns out the answer is simple. Just adding the --prune-empty-dirs flag does the trick.
rsync -avz --include=*/ --include='*/0/*.txt' --exclude=* --prune-empty-dirs test1/ test2/
That is what I wanted.

netbeans glassfish servlet error: NoClassDefFoundError

Is there some particular approach to ensure that an EJB module gets deployed to a web app correctly in Netbeans?
I'm coming at the EJB cookbook example, to invoke the Session Bean from the servlet. I cleared the glassfish output in Netbeans, did a clean-compile and run:
INFO: visiting unvisited references
INFO: visiting unvisited references
SEVERE: Class [ Lpakt/Salutation; ] not found. Error while loading [ class pakt.SalutationServlet ]
INFO: visiting unvisited references
INFO: Loading application [SalutationApplication-war] at [/SalutationApplication-war]
INFO: SalutationApplication-war was successfully deployed in 382 milliseconds.
INFO: processRequest..
WARNING: StandardWrapperValve[SalutationServlet]: Servlet.service() for servlet SalutationServlet threw exception
java.lang.NoClassDefFoundError: pakt/Salutation
at pakt.SalutationServlet.processRequest(SalutationServlet.java:30)
at pakt.SalutationServlet.doGet(SalutationServlet.java:45)
Why isn't the servlet loading pakt.Salutation?
the clean structure (uncompiled):
SalutationApplication/
├── build.xml
├── nbproject
│   ├── ant-deploy.xml
│   ├── build-impl.xml
│   ├── genfiles.properties
│   ├── private
│   │   └── private.properties
│   ├── project.properties
│   └── project.xml
├── SalutationApplication-ejb
│   ├── build.xml
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   └── private.properties
│   │   ├── project.properties
│   │   └── project.xml
│   └── src
│   ├── conf
│   │   └── MANIFEST.MF
│   └── java
│   └── pakt
│   ├── LocalBean.java
│   ├── RemoteBean.java
│   └── Salutation.java
├── SalutationApplication-war
│   ├── build.xml
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   └── private.properties
│   │   ├── project.properties
│   │   └── project.xml
│   ├── src
│   │   ├── conf
│   │   │   └── MANIFEST.MF
│   │   └── java
│   │   └── pakt
│   │   └── SalutationServlet.java
│   └── web
│   ├── index.html
│   └── WEB-INF
│   └── web.xml
└── src
└── conf
└── MANIFEST.MF
20 directories, 30 files
servlet:
package pakt;
import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
#WebServlet(urlPatterns = {"/SalutationServlet"})
public class SalutationServlet extends HttpServlet {
#EJB
private Salutation salutation;
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
System.out.println("processRequest..");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SalutationServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>"
+ salutation.getFormalSalutation("Sherlock Holmes")
+ "</h1>");
out.println("</body>");
out.println("</html>");
} finally {
out.flush();
out.close();
}
}
#Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
#Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
}
package pakt;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
#LocalBean
#Stateless(mappedName = "salutationBean")
public class Salutation implements RemoteBean {
public String getFormalSalutation(String name) {
return "Dear " + name;
}
public String getInformalSalutation(String name) {
return "Hi " + name;
}
#Override
public void myRemote() {
System.out.println("myRemote..");
}
}
the web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<servlet>
<servlet-name>SalutationServlet</servlet-name>
<servlet-class>pakt.SalutationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SalutationServlet</servlet-name>
<url-pattern>/SalutationServlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
-------------------------------------------edit-----------------------------------
additional structure of the app:
thufir#dur:~$
thufir#dur:~$ tree NetBeansProjects/SalutationApplication
NetBeansProjects/SalutationApplication
├── build
│   ├── META-INF
│   │   └── MANIFEST.MF
│   ├── SalutationApplication-ejb.jar
│   └── SalutationApplication-war.war
├── build.xml
├── dist
│   └── SalutationApplication.ear
├── nbproject
│   ├── ant-deploy.xml
│   ├── build-impl.xml
│   ├── genfiles.properties
│   ├── private
│   │   └── private.properties
│   ├── project.properties
│   └── project.xml
├── SalutationApplication-ejb
│   ├── build
│   │   ├── classes
│   │   │   ├── META-INF
│   │   │   │   └── MANIFEST.MF
│   │   │   └── pakt
│   │   │   ├── Salutation.class
│   │   │   └── SalutationLocal.class
│   │   ├── empty
│   │   └── generated-sources
│   │   └── ap-source-output
│   ├── build.xml
│   ├── dist
│   │   └── SalutationApplication-ejb.jar
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   └── private.properties
│   │   ├── project.properties
│   │   └── project.xml
│   └── src
│   ├── conf
│   │   └── MANIFEST.MF
│   └── java
│   └── pakt
│   ├── Salutation.java
│   └── SalutationLocal.java
├── SalutationApplication-war
│   ├── build
│   │   ├── empty
│   │   ├── generated-sources
│   │   │   └── ap-source-output
│   │   └── web
│   │   ├── index.html
│   │   ├── META-INF
│   │   │   └── MANIFEST.MF
│   │   └── WEB-INF
│   │   ├── classes
│   │   │   ├── pakt
│   │   │   └── servlet
│   │   │   └── SalutationServlet.class
│   │   └── web.xml
│   ├── build.xml
│   ├── dist
│   │   └── SalutationApplication-war.war
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   └── private.properties
│   │   ├── project.properties
│   │   └── project.xml
│   ├── src
│   │   ├── conf
│   │   │   └── MANIFEST.MF
│   │   └── java
│   │   ├── pakt
│   │   └── servlet
│   │   └── SalutationServlet.java
│   └── web
│   ├── index.html
│   └── WEB-INF
│   └── web.xml
└── src
└── conf
└── MANIFEST.MF
43 directories, 42 files
thufir#dur:~$
thufir#dur:~$ jar -tf NetBeansProjects/SalutationApplication/SalutationApplication-war/dist/SalutationApplication-war.war
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/pakt/
WEB-INF/classes/servlet/
WEB-INF/classes/servlet/SalutationServlet.class
WEB-INF/web.xml
index.html
thufir#dur:~$
thufir#dur:~$ jar -tf NetBeansProjects/SalutationApplication/SalutationApplication-ejb/dist/SalutationApplication-ejb.jar
META-INF/
META-INF/MANIFEST.MF
pakt/
pakt/Salutation.class
pakt/SalutationLocal.class
thufir#dur:~$
thufir#dur:~$
this is how the application builds.
I started from scrach as so:
NetBeansProjects/SalutationApp
├── build
│   ├── META-INF
│   │   └── MANIFEST.MF
│   ├── SalutationApp-ejb.jar
│   └── SalutationApp-war.war
├── build.xml
├── dist
│   └── gfdeploy
│   └── SalutationApp
│   ├── META-INF
│   │   └── MANIFEST.MF
│   ├── SalutationApp-ejb_jar
│   │   ├── ejb
│   │   │   └── Hello.class
│   │   └── META-INF
│   │   └── MANIFEST.MF
│   └── SalutationApp-war_war
│   ├── index.html
│   ├── META-INF
│   │   └── MANIFEST.MF
│   └── WEB-INF
│   ├── classes
│   │   └── srv
│   │   └── HelloServlet.class
│   └── web.xml
├── nbproject
│   ├── ant-deploy.xml
│   ├── build-impl.xml
│   ├── genfiles.properties
│   ├── private
│   │   └── private.properties
│   ├── project.properties
│   └── project.xml
├── SalutationApp-ejb
│   ├── build
│   │   ├── classes
│   │   │   ├── ejb
│   │   │   │   └── Hello.class
│   │   │   └── META-INF
│   │   │   └── MANIFEST.MF
│   │   ├── empty
│   │   └── generated-sources
│   │   └── ap-source-output
│   ├── build.xml
│   ├── dist
│   │   └── SalutationApp-ejb.jar
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   └── private.properties
│   │   ├── project.properties
│   │   └── project.xml
│   └── src
│   ├── conf
│   │   └── MANIFEST.MF
│   └── java
│   └── ejb
│   └── Hello.java
├── SalutationApp-war
│   ├── build
│   │   ├── empty
│   │   ├── generated-sources
│   │   │   └── ap-source-output
│   │   └── web
│   │   ├── index.html
│   │   ├── META-INF
│   │   │   └── MANIFEST.MF
│   │   └── WEB-INF
│   │   ├── classes
│   │   │   └── srv
│   │   │   └── HelloServlet.class
│   │   └── web.xml
│   ├── build.xml
│   ├── dist
│   │   └── SalutationApp-war.war
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   └── private.properties
│   │   ├── project.properties
│   │   └── project.xml
│   ├── src
│   │   ├── conf
│   │   │   └── MANIFEST.MF
│   │   └── java
│   │   └── srv
│   │   └── HelloServlet.java
│   └── web
│   ├── index.html
│   └── WEB-INF
│   └── web.xml
└── src
└── conf
└── MANIFEST.MF
52 directories, 46 files
I think that the only difference was in the sequence of clicking. I right clicked "clean" on the ejb and war projects, then the main application, and then hit "run" on the overall project.
I think that this then fixed the packaging...?
although the .war file seems quite similar, aside from some naming changes:
thufir#dur:~$
thufir#dur:~$ jar -tf NetBeansProjects/SalutationApp/SalutationApp-war/dist/SalutationApp-war.war
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/srv/
WEB-INF/classes/srv/HelloServlet.class
WEB-INF/web.xml
index.html
thufir#dur:~$
I'm not quite sure why this example runs where the other didn't aside, from, perhaps, clicking "clean" and "run" on different sub-projects in error.

Resources