I need help figuring out why Ant is giving me this error messages(setting up Java Pet Store)?

ⅰ亾dé卋堺 提交于 2019-12-12 04:31:45

问题


I have no idea where ContainerBaCommand is coming from, but here's my error:

I first had to add javax.jar (which has the servlet ) class into the C:\JEE6SDKglassfish3\glassfish\lib\endorsed directory, and it gave me a new error, here:

Buildfile: C:\petstore~svn\trunk\ws\apps\petstore\build.xml

check:

tools:

-pre-deploy:

deploy:
     [exec] Deprecated syntax, instead use:
     [exec] asadmin --user admin --passwordfile c:/JEE6SDKglassfish3/glassfish/samples/bp-project/passwordfile --host localhost --port 4848 deploy [options] ...

     [exec] remote failure: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBaCommand deploy failed.
     [exec] se.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener. Please see server.log for more details.

BUILD FAILED
C:\petstore~svn\trunk\ws\bp-project\app-server-ant.xml:382: exec returned: 1

Total time: 47 seconds

All the files in the setup folder: http://tinyurl.com/3gbb6o4

Edit: Thanks so much Mark!


回答1:


I think the "ContainerBaCommand" is actually ContainerBase.addChild (these guys had a similar problem). I think sometimes Java standard output and standard errors get all mixed up on the console.

I assume you are using something like this app-server-ant.xml. Your Ant error seems to be suggesting that the syntax that "asadmin" now uses to deploy your application has changed. I therefore think you need to re-write your deploy task from what it is currently:

<exec executable="${asadmin}" failonerror="${failonerror}">
  <arg line=" deploy "/>
  <arg line=" --user ${javaee.server.username}" />
  <arg line=" --passwordfile ${javaee.server.passwordfile}" />
  <arg line=" --host ${javaee.adminserver.name}" />
  <arg line=" --port ${javaee.adminserver.port}" />
  <arg line=" --name ${module.name}"/>
  <arg line=" --force=true "/>
  <arg line=" --upload=true "/>
  <arg line=" --precompilejsp "/>
  <arg line=" --dbvendorname ${db.vendorname}"/>
  <arg line="${app.module}" />
</exec>

to:

<exec executable="${asadmin}" failonerror="${failonerror}">
  <arg line=" --user ${javaee.server.username}" />
  <arg line=" --passwordfile ${javaee.server.passwordfile}" />
  <arg line=" --host ${javaee.adminserver.name}" />
  <arg line=" --port ${javaee.adminserver.port}" />
  <arg line=" deploy "/>
  <arg line=" --force=true "/>
  <arg line=" --precompilejsp "/>
  <arg line=" --name ${module.name}"/>
  <arg line=" --upload=true "/>
  <arg line=" --dbvendorname ${db.vendorname}"/>
  <arg line="${app.module}" />
</exec>

I'm surprised that you needed to copy javax.jar (which has the servlet class) into lib endorsed. The Servlet (and ServletContextListener for that matter) are very important classes for an application server. I would expect them to exist in the Glassfish class path already (in Glassfish 3.1 they are in ~glassfish/modules/javax.servlet.jar). I suspect copying your javax.jar into "lib/endorsed" is causing more problems than it would solve.

I hope this helps.



来源:https://stackoverflow.com/questions/7355416/i-need-help-figuring-out-why-ant-is-giving-me-this-error-messagessetting-up-jav

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!