Davor Matijasevic

Greenhorn
+ Follow
since Jan 15, 2019
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Davor Matijasevic

Hi Jorge,

so, the trick is to use Shade to bind the JAR in such a way that all extensions are available. As Rob explained, if you don't do this, only one of them will be linked. I will post you the part of POM that solved it for me. The solution is between ---> and <---- - you need to use the appending transformer to "append" all the extensions of certain classes into the final products, so that the one used in your code will be executed during runtime.

I hope this helps.

2 years ago
Hi Jorge!

Yes, I did. I'm a bit swamped right now but I'll get back to you tomorrow at the latest.
2 years ago
Thank you Rob! This helped, finally. I understand now what you were referring to in your first post. If I had more experience with this, I probably would've figure it right away.

I got one step further now and am receiving a "java.lang.NoClassDefFoundError: javax/jws/WebService" error, but this seems to be related to some missing dependencies. I hope to fix this soon but if not, I know where to come asking for assistance!
2 years ago
Hi Rob,

I sorry to bother you again but I am getting desperate. I tried using shade but I'm getting the same error. Could you elaborate a bit better what I should be looking at?

I can't believe a flat JAR can't be built for a 5-line web service client. I get that there's a bunch of classes in the background but these are all the dependencies I have in my POM:



I don't see what could be clashing with what? I get it that Maven pulls in a ton of other dependencies but if something there clashes, then what's the point?
2 years ago

Rob Spoor wrote:You're welcome.

I know that there is also the shade plugin that can create fat JARs. I know it supports transformers, but I haven't used these yet so I don't really know how they work.



Yeah, I came across it but assembly plugin seemed simpler. I guess I'll have to learn Shade now Or, if you have any other recommendations, I'm open for anything!
2 years ago

Rob Spoor wrote:

Davor Matijasevic wrote:I used maven-assembly-plugin to create a single JAR


Is that a so-called fat JAR, that contains the contents of your application and all of its dependencies all flattened into one JAR file?



Thanks Rob! Yes, that's exactly what it is - I need the final product to be a single JAR. I will look into what can be done here, perhaps I could use another variant to create the JAR instead of this plugin. Maybe that will help. At least you pointed me in the direction that seems likely to be the right one.
2 years ago
Hello, masters of Java!

I am developing a WS client that will need to use MTOM for some data transfer. However, I have a different problem and it's driving me nuts. It involves, of course, running the JAR file from the command line.

I used cxf-codegen-plugin to generate the classes from WSDL and built a simple client. I created a MockService in SoapUI with that same WSDL and tested the client against it. Needless to say, everything works perfectly from Eclipse. I used maven-assembly-plugin to create a single JAR and when I run it from the command line, I get an exception as follows:

Caught Exception - Cannot invoke "org.apache.cxf.wsdl.WSDLManager.getDefinition(String)" because the return value of "org.apache.cxf.Bus.getExtension(java.lang.Class)" is null
java.lang.NullPointerException: Cannot invoke "org.apache.cxf.wsdl.WSDLManager.getDefinition(String)" because the return value of "org.apache.cxf.Bus.getExtension(java.lang.Class)" is null
       at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)
       at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:217)
       at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:160)
       at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
       at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
       at javax.xml.ws.Service.<init>(Service.java:112)
       at com.xxx.xmldefs.sup.enterpriseservices.documentmanagementservice.v1.DocumentManagementService.<init>(DocumentManagementService.java:43)
       at XXX.MTOMClient.MTOMClient.main(MTOMClient.java:53)

Obviously, something is missing in my dependencies, build path, libraries, whatnot, since from Eclipse, client connects, executes the call and gets the result back. I have Maven dependencies and Java system libraries checked in the "Order and Export" section of the project build path.

What am I missing? I admit not to be an expert, I develop things in Java occassionally so maybe this is something simple I just haven't come across yet.

Thank you all in advance for your help!

2 years ago
Hi Rob!

Thank you for your reply. In using MySQL but I'm positive that DB is not the issue. The very first line of code in every Component thread is a log entry to mark the start. Those never appear. It is as if they are never started. Is there some additional Spring tracing I could turn on to see if they get created or not?
5 years ago
Hello!

I'm a newbie in developing with SpringBoot, so maybe this question will sound silly, but I hope someone will be able to show me the error of my ways.

I have a SpringBoot application with 4 Components. One of them processes input files and writes records into database, while the other three read the records, process them according to component configuration and send the result to a Web Service.

My problem is that sometimes there's a lot of files to be processed, so the "reader" Component takes a bit longer to finish. What I've noticed is that, while it's running, none of the other Components are starting. Since the data is relatively time sensitive, it is important for me that the processing Components run periodically and asynchronously.

I have used @EnableAsync in the main Application and I've marked all Components as @Async, yet the blocking problem still occurs. I was under the impression that the scheduled Components will be executed independent of each other. There are no shared resources between Components and even if they were, I would understand that a Component starts and blocks, but the Components (threads) are not started at all (I have a trace entry as a first line of each Component).

What should I look at? Is this how it is supposed to work? If yes, I will then start async threads from the Components or find another way, but I thought I can get by without all of that by using SpringBoot.

Any and all answers will be very much appreciated!
5 years ago