Skip to main content

Disco responses

  20 posts   Feedicon  
Replies: 19 - Last Post: August 08, 2012 12:39
by: renclav
showing 1 - 20 of 20
Posted: March 15, 2012 08:56 by renclav
Hello,

I am in the process of developing an admin group chat bot. basically, the bot handles the creation of groups and the invites. The rest is handled by standard ejabberd modules.

I would like to know if it is possible to hide the disco#info response created from the xep-0114.xml and handle all IQ requests manually. I ask this as currently, my bot sets its identity as 'conference' but when I query the bot, I get back both the one I set and identity as 'component' which gets its details from the xep file.

I am using:
http://oneminutedistraction.wordpress.com/2011/11/24/discoing-with-vorpal/

as a baseline.

PS
How's development going so far?

Thank You,
Dylan
Posted: March 16, 2012 01:52 by oneminutedistraction
Hi

I don't really understand your question so let me explain it and you can correct any misconception

What you want to do is that when you receive a disco#info your component should only return
<identity category='conference'...>

instead of
<identity category='conference'...>
<identity category='component'...>

I believe that if you just construct an IQ packet and populate it with the right identity and feature then you should get what you want. But then you lose the ease of use as you have to deal with the packet.

Let me know if this is not the case and I'll look into that for you. The reason why I'm not certain is because over the past month I've done some changes to the reply system. Currently you can only send 1 packet out. I've made it so that you can send multiple packets out in response to say a query. I'll blog about this hopefully sometime this week or next week.

I've also been working on a client side library very similar to vorpal.

HTH

Regards
Posted: March 16, 2012 08:54 by renclav
Hi,

Basically, your vorpal library inserts the
<identity category='component'...>

identity. Usually this is great, but causes confusion in some cases. For example, say I wanted to make my component appear as a conference of type text, I would add the identity as such:
result.add(new IdentitySpecification("conference", "text", "My Group Chat"));

Use case:
  • User does a disco#info query
  • gets back a response with '<identity category='component'...>' inside it
  • as well as <identity category='conference'...> as I created this above



Is there a manner in which I can either set the default IdentitySpecification or remove it and add my own?

Your new reply system sounds promising! VERY! Grin
I often need to post multiple messages and have to Inject the component manager to do it.

In the same vein, is there an elegant solution to the use case where you do not want a method to always respond? I have gotten around this by setting the return type to void and calling a method from within the called method whenever I want to respond. Once again, this uses the component manager injection which I assume is resource heavy?

Thank You for your feedback, much appreciated!
Dylan
Posted: March 16, 2012 11:37 by oneminutedistraction
1. Have you tried returning an IQ packet? The issue of returning 'component' is one of design; since an JID can have more than one identity, I thought its best to include that. I'm still thinking of a solution to this problem. If you have a solution, do let me know.

2. I've also been toying with the idea of a static declaration of identity and features viz. you should not need to handle disco#info and/or disco#item if those info do not change. I'm thinking should I allow developers to define that as annotations? What do you think?

3. Most IQ methods require you to return some message. Declaring a method to return void is the correct way to do this. For presence and message handlers, if you return null, then no packet is sent back. Eg
@Body("{body}")
public Object handleMessage(@Named("body") String body) {
   //No reply will be send back
   if ((null == body) || (body.trim().length() <= 0))
      return (null);
   return (body.toUpperCase());
}


Keep the comment coming.

Thanks
Posted: March 16, 2012 15:09 by renclav
Hi,

Sorry this is rushed, work's closing the doors.

1. maybe allow the user to set the identification and type in the xep file? not a huge deal though Smile

2. More control the better. Find myself saying that all too often

3. That helped a lot!

Question:

If I declare a method response as void and annotated with Query, there are still situations whereby it will automatically send a response. For instance:

I want to capture an iq:register query
Register the user
perform business logic
and THEN send a success message with the initial packets ID to the user

This allows me to hide the inner works from the user.

So in essence, the bot will send and receive a few packets to the server before it sends a success to the user.

Thank You
Dylan
Posted: March 16, 2012 22:42 by oneminutedistraction
Hi

1. I can do this but maybe not within the next few weeks Wink

Reply enforcement is only apply to get http://jabber.org/protocol/disco#info and http://jabber.org/protocol/disco#items namespaces; by default rely enforcement is not enabled for all other namespace so you can actually do this
@Query("iq:register") @IQType(IQ.Type.get)
public Object handleRegister() {
   if (hasReply)
      return (reply);
   return (null);
}

Of course when you batch up your reply then you are loosing the reply context and will have to construct your own packet; you loose the ability to just return IdentitySpecification, etc. You can use the new ResponseContext API to help. Here is how you use it
   ResponseContext ctx = new ResponseContext();
   ctx.type(ResponseContext.Type.IQ)
         .to("fred@sorewa")
         .from("me@korewa")
         .add(new IQChildElement("query", "iq:register")) //set your iq child element
         .add(new PacketID(previousPacketID)) //Prevent id generation
         .add(new IdentitySpecification(..."), new FeatureSpecification(...), ...); // all these will go into child element
   return (ctx);

You can enforce reply for all IQ query by setting the property enforceIQResult to true in the xep-0114.xml file
<subdomain ...>
   <properties>
      <property name="enforceIQResult" value="true"/>
   </properties>
</subdomain>

I've just added the PacketID class and i've not tested the code but it should work; let me know if there is a problem with it. Unfortunately you'll have to get the new bundle and install it in NetBeans.

This is regarding your other post on dataform. I told you to use @Fields. Well I've renamed @Fields to @FieldList to make the naming consistent.

Hope this helps
Regards
Posted: March 19, 2012 08:45 by renclav
Hello,

I pray you are online! Smile

Before I get to your reply, could you please tell me why I can not capture presence's of no type?

For instance, my bot creates rooms, example:
<presence from="makeme@groups.ptxtest.im" to="dfdf@conference.ptxtest.im/adminbot"><x xmlns="http://jabber.org/protocol/muc"/></presence>

Yet can not capture the response:

<presence from="dfdf@conference.ptxtest.im/adminbot" to="makeme@groups.ptxtest.im" id="1332146044738"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="makeme@groups.ptxtest.im" affiliation="owner" role="moderator"/><status code="201"/></x></presence>

I have a method to capture the error response, which works fine, but , it seems if there is no type, it can not capture it Frown


Question 2:

Setting the response to null still leads to an automatic reply. I have tried setting the property to false without any luck.
Example,

@Order(1)
@Query("jabber:iq:register")
@com.kenai.jabberwocky.framework.DataForm
@IQType(type = org.xmpp.packet.IQ.Type.set)
public Object setRegister(@Bind(PredefinedBindings.PACKET) org.xmpp.packet.IQ myIQ, @Bind(PredefinedBindings.SUBDOMAIN) String subdomain, @Bind(PredefinedBindings.DOMAIN) String domain) {
FormField gname = customerForm.getField("name");
FormField nickname = customerForm.getField("nick");
if (gname != null && nickname != null) {
String sname = gname.getFirstValue();
String snick = nickname.getFirstValue();
if (sname != null && !sname.trim().isEmpty() && snick != null && !snick.trim().isEmpty()) {
org.xmpp.packet.IQ response = org.xmpp.packet.IQ.createResultIQ(myIQ);
boolean work = true;
JoinRoom newroom = new JoinRoom("makeme@" + subdomain, sname + "@conference." + domain + "/adminbot");
newroom.setID(String.valueOf(System.currentTimeMillis()));


/// I SEND A PACKET TO THE SERVER HERE, IT STILL RESPONDS TO USER EVEN WITH RETURN NULL
fakit(newroom);
return (null);



} else {
org.xmpp.packet.IQ response = org.xmpp.packet.IQ.createResultIQ(myIQ);
response.setError(PacketError.Condition.not_acceptable);
return response;
}
} else {
org.xmpp.packet.IQ response = org.xmpp.packet.IQ.createResultIQ(myIQ);
response.setError(PacketError.Condition.not_acceptable);
return response;
}

}

where fakeit sends the message via:

public void fakit(org.xmpp.packet.Packet myPack) {
try {
mgr.sendPacket(comp, myPack);
} catch (ComponentException ex) {
System.out.println("Failed");

}

PS

Using the Fieldlist annotation instead of the above failed. I used:

@FieldList(fields={@Field(name="name", parameter="{aname}"), @Field(name="nick", parameter="{anick}")})


Maybe because the class was not of type Dataform?

I will try get the exact error later today if you wish.

Thank You,
Dylan
Posted: March 20, 2012 00:52 by oneminutedistraction
I'm on GMT+8 timezone

Q1
If you specify a type in your method then Vorpal will only match the packet with the type. In your case then you need a simple catch all for example
@Presence
public class PresenceHander {
	…
	//Everything else
	@From(“{anyone}”)
	public ...
}

or if the presence you want to handle always has a <x xmlns=”http://jabber.org/protocol/muc#user> then you can do the following
@Presence
public class PresenceHandler {
	@XmlElement(namespace=“http://jabber.org/protocol/muc#user”
			, parameter=”{muc}”)
	public Object handle(@Named(“muc”) Element elem) {
	}
}

In place of Element above, you can also use a JAXB object or a String.

Q2
Okay this is a bug.

Q3.
Also another bug. If you do not put a parameter if FieldList then the values are not capture. I've fixed that so that you can do the following
@FieldList(fields={@Field(name="name"), @Field(name="address")}, parameter="{fields}")

or
@FieldList(fields={@Field(name="name", parameter="{name}"), @Field(name="address", parameter="{address}"))

The former will give you a list of fields and the latter you will get access to individual fields. Of course you can use a combination of both.

If you use a @Field or @FieldList and the packet does not contain a DataForm then that is consider a failed match. If you have any more problems please give me a sample packet.

Please install the latest bundle for the bug fixes.

Thanks
Posted: March 20, 2012 07:17 by renclav
I guessed as much, but developers never sleep Wink

Q1:

Works Smile

Q2:

Fixed Smile

Q3:

Have not had a chance to test.

Thank you so much, you have made my day. If you need a job in Cape Town - South Africa, let me know Smile

My Group chat bot is on its way Grin

Dylan

Posted: March 20, 2012 12:47 by oneminutedistraction
I will have a fix (feature) for the component identity very soon. I looked at it and its quite simple to do.

Regards
Posted: March 20, 2012 14:17 by renclav
Great!

I'll start on the 'game' components then Smile

Could you please look at this bug for me?

Basically, an IQ packet is being captured by a Presence class. Once it gets in there, it fails as it's not casting to a presence packet as such:
@Bind(PredefinedBindings.PACKET)
org.xmpp.packet.Presence mypres;


The presence class is annotated with @Presence

with method:
@Order(2)
@XmlElement(namespace = "http://jabber.org/protocol/muc#user", parameter = "{muc}")
public Object handlePresence(@Named("muc") Element elem) {

and the IQ class
@IQ
@Query

with methods (no completed)
@Order(1)
@Query("jabber:iq:register")
@com.kenai.jabberwocky.framework.DataForm
@IQType(type = org.xmpp.packet.IQ.Type.set)

@Order(2)
@Query("jabber:iq:register")
@IQType(type = org.xmpp.packet.IQ.Type.get)


@Order(3)
@Query("http://jabber.org/protocol/muc#admin")
@IQType(type = org.xmpp.packet.IQ.Type.result)



This glassfish output below might look a mess so I'll explain. Basically, the component,
  • Receives the iq request and responds with the dataform
  • user submits the form and the single-text input is used to send a presence message to the muc(group chat) module
  • this responds with success and a iq query of type http://jabber.org/protocol/muc#admin is sent to remove the bot from the owners list
  • when this iq packet is received(problem here), an iq response is sent to the user in regards to the dataform above
  • and a room invite is send to the user (a message)



Glassfish output from receiving the user input from dataform mentioned above(the last bits are the important ones):

OFF: handle IQ set: <iq from="72bb22g@ptxtest.im/Vacuum-IM" to="groups.ptxtest.im" type="set" id="sid_436">
<query xmlns="jabber:iq:register">
<x xmlns="jabber:x:data" type="submit">
<field var="name">
<value>happiness</value>
</field>
</x>
</query>
</iq>
OFF: Handling IQ with CDI
INFO: Resolving instance: class com.indaba.XMPP.IQQueryHandler
INFO: Resolved instance type = com.indaba.XMPP.IQQueryHandler
OFF: Performing injection with CDI
INFO: messageInvoke:
object class:com.indaba.XMPP.IQQueryHandler, method setRegister
OFF: Instantiating com.indaba.XMPP.IQQueryHandler
OFF: Instantiating com.indaba.XMPP.IQQueryHandler
INFO: ROOM CREATION:<presence from="makeme@groups.ptxtest.im" to="happiness@conference.ptxtest.im/adminbot"><x xmlns="http://jabber.org/protocol/muc"/></presence>
OFF: handle IQ time: 338ms
OFF: handle Presence: <presence from="happiness@conference.ptxtest.im/adminbot" to="makeme@groups.ptxtest.im" id="1332251944617"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="makeme@groups.ptxtest.im" affiliation="owner" role="moderator"/><status code="201"/></x></presence>
OFF: Handling Presence with CDI
INFO: Resolving instance: class com.indaba.XMPP.PresenceHandler
INFO: Resolved instance typ = com.indaba.XMPP.PresenceHandler
OFF: Performing injection with CDI
INFO: messageInvoke:
object class:com.indaba.XMPP.PresenceHandler, method handlePresence
OFF: Instantiating com.indaba.XMPP.PresenceHandler
OFF: Instantiating com.indaba.XMPP.PresenceHandler
INFO: PRESENCE HANDLE RECEIVED
INFO: XML:<x xmlns="http://jabber.org/protocol/muc#user"><item jid="makeme@groups.ptxtest.im" affiliation="owner" role="moderator"/><status code="201"/></x>
INFO: ID:1332251944617
INFO: PRESENCE RECEIVED4
INFO: PACKET LOOKS:<iq type="set" id="1332251947665" to="happiness@conference.ptxtest.im" from="groups.ptxtest.im"><query xmlns="http://jabber.org/protocol/muc#admin"><item affiliation="none" jid="makeme@groups.ptxtest.im"/></query></iq>
INFO: PRESENCE RECEIVED
OFF: handle Presence time: 63ms
OFF: handle Presence: <presence from="happiness@conference.ptxtest.im/adminbot" to="makeme@groups.ptxtest.im" type="unavailable"><x xmlns="http://jabber.org/protocol/muc#user"><item affiliation="owner" role="none"/><status code="321"/></x></presence>
OFF: Handling Presence with CDI
INFO: Resolving instance: class com.indaba.XMPP.PresenceHandler
INFO: Resolved instance typ = com.indaba.XMPP.PresenceHandler
OFF: Performing injection with CDI
INFO: messageInvoke:
object class:com.indaba.XMPP.PresenceHandler, method handlePresence
OFF: Instantiating com.indaba.XMPP.PresenceHandler
OFF: Instantiating com.indaba.XMPP.PresenceHandler
OFF: (serving component Group chat Bot) Processing IQ (packetId 1332251947665): <iq from="happiness@conference.ptxtest.im" to="groups.ptxtest.im" id="1332251947665" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>
INFO: PRESENCE HANDLE RECEIVED
INFO: XML:<x xmlns="http://jabber.org/protocol/muc#user"><item affiliation="owner" role="none"/><status code="321"/></x>
OFF: handle IQ result: <iq from="happiness@conference.ptxtest.im" to="groups.ptxtest.im" id="1332251947665" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>
INFO: ID:null
INFO: PRESENCE RECEIVED2
OFF: handle Presence time: 21ms


Sorry if this is ugly, please ask if I've left anything out.


Thank You,
Dylan

Posted: March 21, 2012 00:27 by oneminutedistraction
"Basically, an IQ packet is being captured by a Presence class. Once it gets in there, it fails as it's not "

This looks like a serious bug because a handler is only suppose to handle 1 packet type.

1. Can you send me the stack trace

2. the first few lines of the class that was fired. I need all the annotations that you've declared at the class

3. The message that caused this

Thanks
Posted: March 22, 2012 07:12 by renclav
Sorry oneminutedistraction,

The bug was not that the packets were being captured by incorrect classes.
I have emailed you the code if you wish to look, but this is the true error:

Receiving an IQ packet of type 'result' is not being handled. Only this is displayed in the output:

(serving component Group chat Bot) Processing IQ (packetId 1332400088028): <iq from="sdfsdfsdfsf@conference.ptxtest.im" to="groups.ptxtest.im" id="1332400088028" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>

OFF: handle IQ result: <iq from="sdfsdfsdfsf@conference.ptxtest.im" to="groups.ptxtest.im" id="1332400088028" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>


My IQ class is annoted thusly:

@RequestScoped
@IQ
@Query


with a method to capture the above packet:
@Order(3)
@Query("http://jabber.org/protocol/muc#admin")
@IQType(type = org.xmpp.packet.IQ.Type.result)

which is never called.

I tried just annotating it with
@Order(3)

and it still does not get captured.

Is this perhaps a bug with packets of type result?

Thank You,
Dylan
Posted: March 22, 2012 10:03 by oneminutedistraction
This problem is entirely mine. I did not implement IQ result and error. Initially Vorpal was suppose to only receive IQ packets so I concentrated on IQ set, get, disco#info and disco#item and have totally forgotten about result and error. I've just implemented them and have uploaded. You can choose to return no packets (either return a null or void) with these result and error or any packet types.

Please download the latest Mar 23 and read my latest blog on how to use the response context, static registration of identity, feature and item, handling error packets and lifecycle. I tweet about it once I've pushed out the blog. Should be today or latest tomorrow.

Thanks
Posted: March 22, 2012 14:42 by renclav

Hi,

The latest release will not let me deploy my bots.

Error message:
Error occurred during deployment: Exception while loading the app : WELD-001408 Unsatisfied dependencies for type [Component] with qualifiers [@Named] at injection point [[field] @Named @Inject com.indaba.XMPP.PresenceHandler.compr]. Please see server.log for more details.

And the log for this message:


Exception while loading the app : WELD-001408 Unsatisfied dependencies for type [Component] with qualifiers [@Named] at injection point [[field] @Named @Inject com.indaba.XMPP.PresenceHandler.compr] org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Component] with qualifiers [@Named] at injection point [[field] @Named @Inject com.indaba.XMPP.PresenceHandler.compr] at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:270) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:129) at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:351) at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:336) at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:396) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:190) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:306) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 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:722)


These are the lines of code that cause the error:
@Inject
@Named(PredefinedBindings.COMPONENT)
Component compr;

(They have worked in the past)

Otherwise, thank you for your efforts of late, I really appreciate it.

Dylan
Posted: March 23, 2012 05:09 by oneminutedistraction
My mistake. I was cleaning up the code for @Bind and @Named. Its fixed now. BTW, if you are using CDI, please use named injection for the predefined binding names consistently across your application. By that I mean if you use
   @Bind(PredefinedBindings.COMPONENT] Component component;

in one part of your code/application, do not use @Named
   @Inject @Named(PredefinedBindings.COMPONENT] Component component2;

either in the same class or in a different class. This will confuse CDI because it'll see 2 beans for Component. So just use one. Better still, if you are going to @Inject on any of the predefined binding names, you can omit the name. Just do this
   @Inject Component component2;

HTH. Download the latest.

BTW are you open to migrating to GF 3.1.2? I'm looking into the possibility of adding validation for methods that are to be fired. For example you can use Beans validation on a method like so
@Body("{body}")
public String handleMessage(@NotNull @Named("{body}") int custId) {

This is only supported in hibernation validation in GF 3.1.2.

Regards
Posted: March 23, 2012 07:41 by renclav
I have made the suggested changes and everything is working perfectly.

There was a slight whereby I could not return an IQ type result packet from method capturing the very same, but the injected component worked around that. Finally have my group chat admin bot up and running! It's a day for milestones Smile

In regards to the upgrade to 3.1.2, our production servers are linux so an update for my bots should not be a problem (previous bots will be left alone and a new glassfish server made... I should be able to convince them). On that note, my netbeans test glassfish is running off of 3.1.2

Regards
Posted: March 23, 2012 08:50 by oneminutedistraction
"There was a slight whereby I could not return an IQ type result packet from method capturing the very same, but the injected component worked around that. “

Can you give me detail on this because I want to capture real use cases.

I'm finishing my blog and I'll send you back your code showing you how you can better use Vorpal API.

Regards
Posted: March 23, 2012 09:01 by renclav
Sure,

Here is the error:

(serving component Group chat Bot) Processing IQ (packetId 1332493048296): <iq from="faf@conference.ptxtest.im" to="admin@groups.ptxtest.im" id="1332493048296" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>
OFF: handle IQ result: <iq from="faf@conference.ptxtest.im" to="admin@groups.ptxtest.im" id="1332493048296" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>
OFF: Handling IQ with CDI
INFO: Resolving instance: class com.indaba.XMPP.IQQueryHandler
INFO: Resolved instance type = com.indaba.XMPP.IQQueryHandler
OFF: handle Presence time: 11ms
OFF: Performing injection with CDI
INFO: messageInvoke:
object class:com.indaba.XMPP.IQQueryHandler, method handAdmin
OFF: Instantiating com.indaba.XMPP.IQQueryHandler
OFF: Instantiating com.indaba.XMPP.IQQueryHandler
OFF: Instantiating com.indaba.XMPP.IQQueryHandler
OFF: Instantiating com.indaba.XMPP.IQQueryHandler
INFO: outgoing message: name=web, from=admin@groups.ptxtest.im, to=faf@conference.ptxtest.im
OFF: handle IQ time: 8ms
OFF: handleIQResult
java.lang.IllegalArgumentException: IQ must be of type 'set' or 'get'. Original IQ: <iq from="faf@conference.ptxtest.im" to="admin@groups.ptxtest.im" id="1332493048296" type="result"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq>
at org.xmpp.packet.IQ.createResultIQ(IQ.java:384)
at com.kenai.jabberwocky.framework.core.PacketUtility.createReply(PacketUtility.java:80)
at com.kenai.jabberwocky.framework.core.ResponseProcessor.process(ResponseProcessor.java:140)
at com.kenai.jabberwocky.framework.core.ResponseProcessor.process(ResponseProcessor.java:90)
at com.kenai.jabberwocky.framework.core.JabberwockyComponent.processIQForGetSet(JabberwockyComponent.java:834)
at com.kenai.jabberwocky.framework.core.JabberwockyComponent.handleIQResult(JabberwockyComponent.java:808)
at com.kenai.jabberwocky.xmppcontainer.AbstractComponent.processIQ(AbstractComponent.java:235)
at com.kenai.jabberwocky.xmppcontainer.AbstractComponent.processQueuedPacket(AbstractComponent.java:140)
at com.kenai.jabberwocky.xmppcontainer.AbstractComponent.processPacket(AbstractComponent.java:121)
at com.kenai.jabberwocky.xmppcontainer.XEP0114ApplicationContainer$2.run(XEP0114ApplicationContainer.java:653)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

The situation that causes this is the component receiving an IQ packet of type result from the ejabberd conference module. This translates to a success for me and hence I want to relay a similar IQ packet also of type result to the user which informs him/her of a successful room creation.

Looking forward to it!

Regards
Posted: August 08, 2012 12:39 by renclav
Hi,

I have recently returned to the XMPP world, to discover a few changes/issues:

1. If source is set to 6, netbeans complains
2. A class such as

@RequestScoped
public class LifeCycle {

private void presStart(@Observes ComponentPreStart preStartEvent) {

ComponentContext componentContext = preStartEvent.getComponentContext();
componentContext.identity(new IdentitySpecification("directory", "group", "Groups"));
componentContext.add(new FeatureSpecification("http://jabber.org/protocol/disco#items"));
System.out.println("\n\nPRESTART\n\n");
}
}

does not set the identity or anything defined in the above method, the default is still used. Glassfish log:
OFF: Firing component lifecycle event: ComponentPreStart
OFF: Instantiating com.indaba.XMPP.LifeCycle
OFF: Instantiating com.indaba.XMPP.LifeCycle
SEVERE: No valid EE environment for injection of com.indaba.XMPP.LifeCycle
INFO: PRESTART

3. Every packet sent to the component initiated the new conversation login. Does this mean that every user, for example, who performs a disco query, will start a conversion stored in glassfish?

4. All machines used for component testing phases are windows 64 bit, Netbeans 7.1 and Netbeans 7.2 with glassfish 3.1.2.
Yet some boxes just not run new components. The error logs:

OFF: XXXX container: com.kenai.jabberwocky.xmppcontainer.XEP0114Container@2c48a6
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
SEVERE: Class [ Lorg/springframework/core/io/Resource; ] not found. Error while loading [ class org.apache.activemq.spring.SpringSslContext ]
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/beans/factory/BeanNameAware
SEVERE: Class [ Lorg/springframework/core/io/Resource; ] not found. Error while loading [ class org.apache.activemq.spring.SpringSslContext ]
INFO: XXXX prepare: C:\Users\Dylan\Documents\NetBeansProjects\XMPP_Groups\build\web
INFO: Initializing Mojarra 2.1.6 (SNAPSHOT 20111206) for context ''
INFO: WELD-000900 1.1.4 (Final)
INFO: XXXX load: C:\Users\Dylan\Documents\NetBeansProjects\XMPP_Groups\build\web
INFO: XXXX source dir - name: web
INFO: XXXX source dir - absolute path: C:\Users\Dylan\Documents\NetBeansProjects\XMPP_Groups\build\web
INFO: XXXX class = index.jsp
INFO: XXXX class = META-INF
INFO: XXXX class = WEB-INF
INFO: XXXX class = WEB-INF/beans.xml
INFO: XXXX class = WEB-INF/classes
INFO: XXXX class = WEB-INF/classes/.netbeans_automatic_build
INFO: XXXX class = WEB-INF/classes/.netbeans_update_resources
INFO: XXXX class = WEB-INF/classes/com
INFO: XXXX class = WEB-INF/classes/com/indaba
INFO: XXXX class = WEB-INF/classes/com/indaba/manage
INFO: XXXX class = WEB-INF/classes/com/indaba/manage/IQHandler.class
INFO: XXXX class = WEB-INF/classes/com/indaba/manage/LifeCycle.class
INFO: XXXX class = WEB-INF/glassfish-web.xml
INFO: XXXX class = WEB-INF/lib
INFO: XXXX class = WEB-INF/lib/activemq-core-5.5.0.jar
INFO: XXXX class = WEB-INF/lib/mysql-connector-java-5.1.11-bin.jar
INFO: XXXX class = WEB-INF/web.xml
INFO: XXXX class = WEB-INF/xep-0114.xml
INFO: key = location, value = fileHmmmCHmmmUsers/Dylan/Documents/NetBeansProjects/XMPP_Groups/build/web/
INFO: key = directory-deployed, value = true
INFO: key = context-root, value = /XMPP_Groups
INFO: key = defaultAppName, value = web
INFO: key = object-type, value = user
INFO: WELD-000119 Not generating any bean definitions from com.indaba.manage.LifeCycle because of underlying class loading error
INFO: catching
org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class com.indaba.manage.LifeCycle
at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:152)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:86)
at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:115)
at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:171)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:336)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:179)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:277)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
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 com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
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:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
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)
Caused by: java.lang.NoClassDefFoundError: com/kenai/jabberwocky/framework/event/ComponentPreStart
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.jboss.weld.util.reflection.SecureReflections$8.work(SecureReflections.java:172)
at org.jboss.weld.util.reflection.SecureReflections$8.work(SecureReflections.java:169)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:63)
at org.jboss.weld.util.reflection.SecureReflections.getDeclaredMethods(SecureReflections.java:169)
at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:233)
at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:118)
at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:49)
at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:40)
at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:149)
... 36 more
Caused by: java.lang.ClassNotFoundException: com.kenai.jabberwocky.framework.event.ComponentPreStart
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1509)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
... 52 more

INFO: WEB0671: Loading application [XMPP_Groups] at [/XMPP_Groups]
OFF: Using classloader: org.glassfish.web.loader.WebappClassLoader
INFO: >XXXX appProps key = appConfig, value = null
INFO: >XXXX appProps key = location, value = fileHmmmCHmmmUsers/Dylan/Documents/NetBeansProjects/XMPP_Groups/build/web/
INFO: >XXXX appProps key = directory-deployed, value = true
INFO: >XXXX appProps key = context-root, value = /XMPP_Groups
INFO: >XXXX appProps key = defaultAppName, value = web
INFO: >XXXX appProps key = object-type, value = user
SEVERE: Exception while invoking class com.kenai.jabberwocky.xmppcontainer.XEP0114ApplicationContainer start method
java.lang.ClassNotFoundException: com.kenai.jabberwocky.framework.core.JabberwockyComponent
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1509)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
at com.kenai.jabberwocky.xmppcontainer.XEP0114ApplicationContainer.start(XEP0114ApplicationContainer.java:268)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
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 com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
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:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
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)

SEVERE: Exception while loading the app
INFO: XXXX unload: C:\Users\Dylan\Documents\NetBeansProjects\XMPP_Groups\build\web
INFO: XXXX clean: C:\Users\Dylan\Documents\NetBeansProjects\XMPP_Groups\build\web
WARNING: Exception while cleaning module 'org.glassfish.internal.data.EngineRef@167e563'java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [META-INF/services/javax.xml.parsers.SAXParserFactory], because it has not yet been started, or was already stopped
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [META-INF/services/javax.xml.parsers.SAXParserFactory], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2074)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1036)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1020)
at org.glassfish.web.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1254)
at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:89)
at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:250)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:223)
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:128)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.getXMLReader(AbstractUnmarshallerImpl.java:115)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:172)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:177)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:186)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:204)
at com.kenai.jabberwocky.xmppcontainer.XARDeployer.clean(XARDeployer.java:75)
at org.glassfish.internal.data.EngineInfo.clean(EngineInfo.java:129)
at org.glassfish.internal.data.EngineRef.clean(EngineRef.java:175)
at com.sun.enterprise.v3.server.ApplicationLifecycle$1.actOn(ApplicationLifecycle.java:303)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:465)
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 com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
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:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
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)

SEVERE: Exception while loading the app : com.kenai.jabberwocky.framework.core.JabberwockyComponent
INFO: WEB0671: Loading application [__admingui] at [/]
INFO: CORE10010: Loading application __admingui done in 4,652 ms
INFO: The Admin Console application is loaded.
INFO: logging.properties file removed, updating log levels disabled


Any idea why this occurs?

Regards,
Dylan



showing 1 - 20 of 20
Replies: 19 - Last Post: August 08, 2012 12:39
by: renclav
 
 
Close
loading
Please Confirm
Close