jWebSocket Forum

[Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Deploying a PlugIn - Problems with referenced library  XML
Forum Index » Server side Plug-Ins, Apps, Listeners and Filters
Author Message
Kiwi

jWebSocket Forum User

Joined: 18/01/2011 18:09:32
Messages: 16
Offline

Hi,

first of all sorry for my many questions at the moment but I am quite interested in jWebSocketServer.

I used Purans Tutorial form the jWebSocket Blog to create an Plugin with Eclipse.
In order to see how this would run in a Production environment I decided to pack my PlugIn in a jar an deploy it to the server.
Actually this worked quite well with one exception.

I am using the mysql driver in my plugin for accessing a database.
When running jWebSocketServer0.11 (including my plugin) from Eclipse everything is running great.
If I start the server using the provided "binaries" from the page including my deployed I get a java.lang.ClassNotFoundException for the mysql driver.

What I do not quite understand is that the mysql-connector-java-5.1.13-bin.jar is among all the other libs of jWebSocket - so it should actually be accessible.

Can anyone point me in the right direction to get this also working with my deployed jar?

Cheers,

Kiwi

This message was edited 1 time. Last update was at 02/03/2011 11:03:55

Quentin

jWebSocket Forum User

Joined: 22/07/2010 00:01:01
Messages: 37
Location: Paris, France
Offline

Hi,
Did you try to add it in your manifest ?
[WWW]
Kiwi

jWebSocket Forum User

Joined: 18/01/2011 18:09:32
Messages: 16
Offline

Quentin,

I copied the class-path that was included in the jWebsocketSamples jar.
However, the mysql driver jar cann still not be found.

My Manifest looks like this:





In my specific plugin I don't need all of the jars. For some reason Eclipse would not carry over the class path from a predefined manifest file when I remove some of the jars that I don't need...

Do you have got any more ideas?

Thanks,

Kiwi

This message was edited 1 time. Last update was at 11/03/2011 13:11:16

Quentin

jWebSocket Forum User

Joined: 22/07/2010 00:01:01
Messages: 37
Location: Paris, France
Offline

Hi,
How do you start your app ?
Do you have a mysql-connector-java-5.1.13.jar in the same folder than your jWebsocketSamples.jar when starting the app ?
try using javac -cp [the classpath to your driver], this should work

BTW, eclipse do use another classpath, this error is a very "classic one", but always painfull

This message was edited 3 times. Last update was at 11/03/2011 14:11:38

[WWW]
Kiwi

jWebSocket Forum User

Joined: 18/01/2011 18:09:32
Messages: 16
Offline

Hi Quentin,

yes, I have mysql-connector-java-5.1.13.jar in the same folder as my own Custom Plugin.
I am starting jWebSocket with the script included in the jWebSocket distribution (bin/jWebSocketserver.sh).

So basically with from my jWebSocket directory




I tried to manually compile my Plugin instead of just exporting it with Eclipse in a Jar but that does not work.
I am not using the proper classpath apparently.

My Project structure is as following:

CustomPlugin
-src
- com.CustomPlugin
- com.CustomPlugin.otherPackage

-META-INF (I keep a single configuration file there)
-libs (contains all the referenced libs from jWebSocket)

I am trying to compile it with



I am getting the following error:

libs/commons-codec-1.4.jar: line 1: PK: command not found
libs/commons-codec-1.4.jar: line 2: 4?: command not found
libs/commons-codec-1.4.jar: line 2: META-INF/PK: No such file or directory
libs/commons-codec-1.4.jar: line 3: syntax error near unexpected token `?a7META-INF/MANIFEST.MF?S?o?0~????ԧMje--L{'
libs/commons-codec-1.4.jar: line 3: 3?;ڵ(?a7META-INF/MANIFEST.MF?S?o?0~????ԧMje--L{(??h????6???????]??ЖIˋ????ww?n??????Z'?n?Y\?k?gr?v??Q?2s??A?"?(??*?4????%|f?[?V?c⠧y?9
T?????Q?Dt'?7?0?%???g?T???'

I would prefer if could use the Eclipse jar export. I have tried different possiblities for placing the libs in my Eclipse project but that does not change anything - when my customPlugin needs the mysql driver the class can not be found.

Cheers,

Kiwi




This message was edited 1 time. Last update was at 12/03/2011 00:00:57

Kiwi

jWebSocket Forum User

Joined: 18/01/2011 18:09:32
Messages: 16
Offline

I got a tiny step further as I can now compile my plugin manually.
The problem was the usage of wildcard operator.

I compile the plugin as following:



Now I am also manually creating the jar file with


whereby manifest.mf contains what i have previously posted.
I have also tried to add the libs in my jar

with



and respectively adjusted the path to the libs in the manifest.mf with prepending libs/ .

Though still I have the problem that the mysql driver cannot be found.

In addition I also tried to launch jWebSocket with explicitly including the libs folder of jWebSocket to the classpath as



Still no luck ....

Do you have got any further ideas?



Quentin

jWebSocket Forum User

Joined: 22/07/2010 00:01:01
Messages: 37
Location: Paris, France
Offline

Hum really strange !
It should works since it's on your class path...
And if you can compile you should be able to run using the same cp...
Are you sure it's the same mysql lib ?
Are you using mvn or something to handle your dependencies ?
Quite hard to help further whithout your project...
[WWW]
Kiwi

jWebSocket Forum User

Joined: 18/01/2011 18:09:32
Messages: 16
Offline

Hi Quentin,

I have even now tired to compile and run my Plugin against the very same file of the mysql driver.
However, still no luck - the driver cannot be found.



I have made a minimal eclipse project that basically just tries to establish a database connection on Engine start.
I am not using anything to manage my dependencies. Especially mvn was not working well for me with Eclipse.

Attached you can find the minimal version of my "test" plugin.

Thanks,

Michael
 Filename MinimalPlugin.zip [Disk] Download
 Description Minimal Plugin Eclipse Project
 Filesize 5530 Kbytes
 Downloaded:  2 time(s)

This message was edited 1 time. Last update was at 14/03/2011 00:31:14

andre

jWebSocket Forum User

Joined: 31/08/2011 17:49:41
Messages: 16
Offline

I'm having this same problem with my own custom plugin. I'm trying to use the Jedis library to have a plugin which logs events to redis, but no matter what I do, I can't get jWebSocketServer to load my plugin, it always fails to find the a class in Jedis.
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi andre,

we are about to introduce a more flexible class loader for exactly the purpose you mention.
We are working on a solution here, please meanwhile put the required lib(s) into the lib/ext folder of your JRE and/or JDK folder, so that it can be found and loaded. We will let you know once we are able to proivide a better solution here.

Best Regards
Alex
[WWW]
Kiwi

jWebSocket Forum User

Joined: 18/01/2011 18:09:32
Messages: 16
Offline

Hello Alex,

do you have any news regarding this problem?

Thanks,

Kiwi
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hello Guys,

we have two possible solutions for that:

1) We from now can load additional .jars in the libraries section of the jWebSocket.xml, you should try that first. In our latest nightly build you will find some demo .jar loaded in the jWebSocket.xml.

2) If you still do not succeed you can put the mysql-connector-java-5.1.13.jar into the <JRE_HOME/JDK_HOME>\lib\ext folder.

Please let me know if one of the solutions works for you. We also encourage you to download the latest 1.0b6.

Best Regards
Alex
[WWW]
kpturner

jWebSocket Forum User

Joined: 21/06/2012 19:35:32
Messages: 37
Offline

I have the same problem. My plug-in compiles and loads fine, but when I refer to an external .jar (an IBM jar called jt400Native.jar) I get this:



I don't know what I am supposed to do to fix it. The server is running on an IBMi by the way, not Windows etc.

I tried dropping the jar into JWEBSOCKET_HOME/libs but I got the same error.

I tried changing the jWebSockets.xml file like this:



and I see


but the plug-in still fails to load.

I don't know what to try next. It is really stopping me in my tracks. HELP!

kpturner

jWebSocket Forum User

Joined: 21/06/2012 19:35:32
Messages: 37
Offline

Double post - deleted.

This message was edited 1 time. Last update was at 26/06/2012 22:10:50

kpturner

jWebSocket Forum User

Joined: 21/06/2012 19:35:32
Messages: 37
Offline

I now have it working! The trouble is, I am not sure what I have done to make it work.

All I did was change the <library> reference in the config XML to point to the original IBM jar rather than a copy of it in ${JWEBSOCKET_HOME}libs


So I am happy, but not necessarily enlightened.
 
Forum Index » Server side Plug-Ins, Apps, Listeners and Filters
Go to:   
Powered by JForum 2.1.9 © JForum Team