NetBeans和glassFish服务器

时间:2017-03-17 23:35:31

标签: java netbeans glassfish

我在使用glassFish服务器时遇到问题,他们在部署项目时会向我显示此消息:

  

build-impl.xml:1045:尚未部署模块。

我会随时重启netbeans并将debugmode更改为TRUE但问题仍然存在。

这是build-impl.xml的第1045行:

from django.shortcuts import render, redirect
from .models import User
import re
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')

# Create your views here.
def index(request):

    return render(request, "emailvalidation/index.html" )


def create(request):
    if request.method == 'POST':                                    #here down

        if len(request.form['email']) < 1:
            add_message("Invalid Email Address!")                  #if i take out the if else the form does work 
        elif not EMAIL_REGEX.match(request.form['email']):              #the validation.
            add_message("Invalid Email Address!")
        else:
            User.objects.create(email = request.POST['email'] )     #to here


        context ={

            "email": User.objects.all(),
        }

    return render(request, 'emailvalidation/success.html' ,context)




the traceback error

Environment:


Request Method: POST
Request URL: http://localhost:8000/user

Django Version: 1.10.6
Python Version: 2.7.10
Installed Applications:
['apps.emailvalidation',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "C:\Users\dbhol\Desktop\DojoAssignments\Python\myenvirnoments\djangoENv\lib\site-packages\django\core\handlers\exception.py" in inner
  42.             response = get_response(request)

File "C:\Users\dbhol\Desktop\DojoAssignments\Python\myenvirnoments\djangoENv\lib\site-packages\django\core\handlers\base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "C:\Users\dbhol\Desktop\DojoAssignments\Python\myenvirnoments\djangoENv\lib\site-packages\django\core\handlers\base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\dbhol\Desktop\DojoAssignments\Python\myenvirnoments\django2\emailval\emailval\apps\emailvalidation\views.py" in create
  15.       if len(request.form['email']) < 1:

Exception Type: AttributeError at /user
Exception Value: 'WSGIRequest' object has no attribute 'form'

我用:

  • macOS Sierra 10.12
  • NetBeans 8.2
  • GlassFish 4.1.1
  • JDK 8

2 个答案:

答案 0 :(得分:0)

尝试取消部署项目(在NetBeans 8.2中,转到服务,服务器,GlassFish Server,右键单击已部署的项目,然后单击“取消部署”。然后重新启动GlassFish并运行项目(在清理和构建之后)那应该可以解决你的问题。

答案 1 :(得分:0)

我以前经历过这个。我做了以下事情:

  1. 从我的项目中删除了pom.xml和nb.configuration文件。
  2. 确保我添加了正确的项目类型。
  3. 建立并管理我的客户。
  4. 我的服务器已成功构建。