• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem deploying Simple EJB to Glassfish  RSS feed

 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read several of the other entries with the same topic, but different characteristics in their scenarios.

Instead of NetBeans which I have used in the past at another place of business I am using Eclipse JUNO as my IDE. I am using Glassfish 3.1.2.2 (Build 5) and Java 1.6.0_45.

I am following the basic tutorial for writing an EJB. http://edwin.baculsoft.com/2010/09/a-simple-java-client-server-application-using-ejb3-and-glassfish3/ All I have done is write the basic CompressedEJBServer as in the tutorial. I have followed as I could with Eclipse creating the EJB module and Export it as an EJB Jar. When I attempt to deploy to Glassfish I receive the following stacktrace:

[#|2013-11-01T16:43:33.588-0400|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=19;_ThreadName=Thread-3;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-11-01T16:43:33.675-0400|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=19;_ThreadName=Thread-3;|GUI deployment: uploadToTempfile|#]

[#|2013-11-01T16:43:33.675-0400|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=19;_ThreadName=Thread-3;|uploadFileName=CompressedEJBServer.jar|#]

[#|2013-11-01T16:43:33.684-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=34;_ThreadName=Thread-3;|The log message is empty or null. Please log an issue against the component in the logger field.|#]

[#|2013-11-01T16:43:33.734-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=34;_ThreadName=Thread-3;|The log message is empty or null. Please log an issue against the component in the logger field.|#]

[#|2013-11-01T16:43:33.769-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=34;_ThreadName=Thread-3;|Exception while deploying the app [CompressedEJBServer]|#]

[#|2013-11-01T16:43:33.769-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=34;_ThreadName=Thread-3;|Invalid ejb jar [CompressedEJBServer]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
java.lang.IllegalArgumentException: Invalid ejb jar [CompressedEJBServer]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:76)
at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:128)
at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:730)
[#|2013-11-01T16:43:33.801-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=34;_ThreadName=Thread-3;|Exception while deploying the app [CompressedEJBServer] : Invalid ejb jar [CompressedEJBServer]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.|#]

As I first stated I have read several of the similar topic issues, but most of their solutions were not applicable (as best I could tell) to this basic tutorial. I changed the generated ejb-jar.xml:

with


which only added the <ejb-client-jar> entry.

Again, any useful help is appreciated.




 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2966
210
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,

Please use the Code buttons so that it easier for everybody to read.

The stacktrace is telling you that the CompressedEJBServer is not a valid ejb-jar file because it doesn't contain any EJB.

My question to you is: what is in your CompressedEJBServer jar file?

Regards,
Frits
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response Fritz. The link to the tutorial covers the CompressedEJBServer which I wrote in the Eclipse IDE. I will post the tutorial information here to answer your question.

ConnectionFacadeRemote.java


and ConnectionFacade.java (this was actually created as the main class when I created the EJB Project using the Eclipse (JUNO) IDE. Whatever Eclipse built into the jar with these two files is what is in it. I will breakdown the jar if you like.)


Eclipse compiled these and the Export command built the jar file.

Extracted jar file:
META-INF
- ejb-jar.xml
- glassfish-ejb-jar.xml
- MANIFEST.MF

com.company.ejb.test
- ConnectionFacade.class
- ConnectionFacadeRemote.class

ejb-jar.xml


glassfish-ejb-jar.xml


MANIFEST.MF
- Manifest-Version: 1.0


 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard

Two obvious differences between your project and the tutorial are:

- ejb-client-jar entry in ejb-jar.xml
- LocalBean annotation for ConnectionFacade class

Why did you add these? Have you tried deploying to GF without these changes?
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the jar the package is the one in the code pieces, not the one I typed out preceding the class files.
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the ejb-client-jar entry because without it I was receiving the same results and was a test to see if that was missing. I had compared to another project someone else had produced and noticed it was missing. The LocalBean was what Eclipse added in when I used its Wizard to create the file.

I just tested excluding these two noticeable differences and I get the same result.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2966
210
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,

Just remove the ejb-client-jar if you don't use one. I don't see any other obvious error, but the server clearly states that the .jar file does not contain an EJB.

Can you do a "clean" on your server to make sure that it is deployed freshly and tell us what you see in the console.
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found a previously deployed test in the domain1/applications directory and deleted it. It was not present in the Applications section of the Admin Console. Since this fails when it attempts to deploy it never actually is found in Applications.

Admin Console

Error occurred during deployment: Exception while deploying the app [CompressedEJBServer] : Invalid ejb jar [CompressedEJBServer]: it contains zero ejb. Note: 1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean. 2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar. 3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.. Please see server.log for more details.

What exactly is Glassfish looking for to determining whether an EJB is present or not? If I built this project using the Netbeans IDE what would it put in different than Eclipse. The tutorial is centered around Netbeans (which I do not have at the place of business). That is why I ask.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2966
210
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly is Glassfish looking for to determining whether an EJB is present or not?

EJB annotations like @Stateless, @Stateful, @MessageDriven or @Singleton

This behaviour looks weird, do you have compilation errors in your EJB-project?
Did you create an EJB-project in eclipse?
Did you download the Eclipse for Java EE developers or the Standard Eclipse?
How did you create the server?
How did you deploy the project?
Did you try creating a new EJB-project and start from scratch?
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glassfish 3.1.2.2 (Build 5)
Java jdk1.6.0_45
Eclipse Juno 4.2


This behaviour looks weird, do you have compilation errors in your EJB-project?
No

Did you create an EJB-project in eclipse?
EJB-project

Did you download the Eclipse for Java EE developers or the Standard Eclipse?
eclipse-jee-juno-SR2-win32.zip

How did you create the server?
New Session Bean -> name ConnectionFacade checked Remote interface; Glassfish 3.1.2.2 server
After shells (ConnectionFacade.java and ConnectionFacadeRemote.java) were created I copied information from tutorial into appropriate shell.


How did you deploy the project?
In Eclipse I selected Project >> Clean to clean and build the project. Then I used Export to Export EJB Jar. In the Admin Console I clicked on Applications >> Deploy. I then used the built-in file browser to select the jar file I just Exported. In deploying I used the File as is and I also tried using Run Verifier and Force Redepoy (since Force Redeploy also seems to do a clean of its own of sorts).

Did you try creating a new EJB-project and start from scratch?
Outside of the Eclipse IDE, No.


 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2966
210
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I can't see where it goes wrong.

Try to use the following Setting up Eclipse with Glassfish server document (I made some time ago) in combination with the example in my EJB notes (check the ScbcdLinks)

Regards,
Frits
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard

I'm not sure the ejb-jar root node for the ejb-jar.xml file is correct. I think it should be as follows:
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits & James... Thank you. I will come back to this, but I have some other assignments now. I appreciate your help and will be back soon (I hope).
 
Richard Blaha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well gentlemen, I was able to follow and write using the example Frits mentioned

Try to use the following Setting up Eclipse with Glassfish server document (I made some time ago) in combination with the example in my EJB notes (check the ScbcdLinks)


with some very interesting results. In Eclipse for the EchoEar projects I had Glassfish 3.1.2.2 set as the runtime server to build all the Echo* projects and build the EAR file. When I attempted to deploy in Glassfish 3.1.2.2 from the Admin Console as previously described I had the following stacktrace result.



[#|2013-11-12T15:52:42.346-0500|WARNING|glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=21;_ThreadName=Thread-3;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2013-11-12T15:52:42.421-0500|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=21;_ThreadName=Thread-3;|GUI deployment: uploadToTempfile|#]

[#|2013-11-12T15:52:42.449-0500|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=21;_ThreadName=Thread-3;|uploadFileName=EchoEar.ear|#]

[#|2013-11-12T15:52:42.496-0500|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=22;_ThreadName=Thread-3;|The log message is empty or null. Please log an issue against the component in the logger field.|#]

[#|2013-11-12T15:52:42.497-0500|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=22;_ThreadName=Thread-3;|Exception while deploying the app [EchoEar]|#]

[#|2013-11-12T15:52:42.497-0500|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=22;_ThreadName=Thread-3;|java.lang.NullPointerException
at org.glassfish.javaee.full.deployment.EarHandler.getClassLoader(EarHandler.java:418)
at org.glassfish.deployment.common.DeploymentContextImpl.createClassLoader(DeploymentContextImpl.java:218)
at org.glassfish.deployment.common.DeploymentContextImpl.createDeploymentClassLoader(DeploymentContextImpl.java:199)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:346)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
|#]

[#|2013-11-12T15:52:42.501-0500|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=22;_ThreadName=Thread-3;|Exception while deploying the app [EchoEar]|#]

[#|2013-11-12T15:52:42.517-0500|INFO|glassfish3.1.2|org.glassfish.admingui|_ThreadID=21;_ThreadName=Thread-3;|Exception Occurred :Error occurred during deployment: Exception while deploying the app [EchoEar]. Please see server.log for more details. |#]


However, I just installed JBoss 6.1.0 today and thought I would attempt to deploy through the JBoss Administration Console. It deployed perfectly fine and I was able to run the URL: http://localhost:8080/EchoWeb/EchoServlet
The output was not complete as described in the 'Enterprise Java Beans 3' Word Document, but that is beside the point. I built the EAR in Eclipse with the Glassfish set as the Runtime Server. I wasn't able to deploy in Glassfish, but I was able to deploy the exact same EAR file to JBoss and run it. It seems that this is not an EJB and other Java EE Technologies issue, but rather a Glassfish issue. Not good.

I was also able to deploy my original EJB file to JBoss also. Again, I appreciate your time.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!