kandi background
Explore Kits

user-agent-utils | processing user-agent strings

 by   HaraldWalker Java Version: 1.21 License: BSD-3-Clause

 by   HaraldWalker Java Version: 1.21 License: BSD-3-Clause

Download this library from

kandi X-RAY | user-agent-utils Summary

user-agent-utils is a Java library typically used in Logging, Nodejs applications. user-agent-utils has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.
Utilities for processing user-agent strings. Can be used to handle http requests in real-time or to analyze log files. For the latest release, go to https://github.com/HaraldWalker/user-agent-utils/tree/master.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • user-agent-utils has a medium active ecosystem.
  • It has 836 star(s) with 378 fork(s). There are 131 watchers for this library.
  • It had no major release in the last 12 months.
  • user-agent-utils has no issues reported. There are 3 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of user-agent-utils is 1.21
user-agent-utils Support
Best in #Java
Average in #Java
user-agent-utils Support
Best in #Java
Average in #Java

quality kandi Quality

  • user-agent-utils has 0 bugs and 0 code smells.
user-agent-utils Quality
Best in #Java
Average in #Java
user-agent-utils Quality
Best in #Java
Average in #Java

securitySecurity

  • user-agent-utils has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • user-agent-utils code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
user-agent-utils Security
Best in #Java
Average in #Java
user-agent-utils Security
Best in #Java
Average in #Java

license License

  • user-agent-utils is licensed under the BSD-3-Clause License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
user-agent-utils License
Best in #Java
Average in #Java
user-agent-utils License
Best in #Java
Average in #Java

buildReuse

  • user-agent-utils releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
user-agent-utils Reuse
Best in #Java
Average in #Java
user-agent-utils Reuse
Best in #Java
Average in #Java
Top functions reviewed by kandi - BETA

kandi has reviewed user-agent-utils and discovered the below as its top functions. This is intended to give you an instant insight into user-agent-utils implemented functionality, and help decide if they suit your requirements.

  • Compares two version numbers
    • Compares this object with the specified object .
      • Creates a unique hash code .
        • Returns the version with the given string .
          • Determines whether the given string contains the given string
            • cast a string array to lower case
              • Create a version object from a match pattern .
                • Gets the version .
                  • Returns a map of the browsers to Safari version .

                    Get all kandi verified functions for this library.

                    Get all kandi verified functions for this library.

                    user-agent-utils Key Features

                    Utilities for processing user-agent strings. Can be used to handle http requests in real-time or to analyze log files.

                    Maven

                    copy iconCopydownload iconDownload
                    <dependency>
                       <groupId>eu.bitwalker</groupId>
                       <artifactId>UserAgentUtils</artifactId>
                       <version>1.21</version>
                    </dependency>

                    Hive UDF Throws Class Not Found Exception in select

                    copy iconCopydownload iconDownload
                               <plugin>
                                    <artifactId>maven-assembly-plugin</artifactId>
                                    <configuration>
                                        <archive>
                                            <manifest>
                                                <mainClass>{pathToMainClass}</mainClass>
                                            </manifest>
                                        </archive>
                                        <descriptorRefs>
                                            <descriptorRef>jar-with-dependencies</descriptorRef>
                                        </descriptorRefs>
                                    </configuration>
                                </plugin>
                    

                    Community Discussions

                    Trending Discussions on user-agent-utils
                    • Hive UDF Throws Class Not Found Exception in select
                    Trending Discussions on user-agent-utils

                    QUESTION

                    Hive UDF Throws Class Not Found Exception in select

                    Asked 2017-Aug-06 at 17:26

                    I'm stuck in using UDF jar. I need to parse simple UserAgent in my UDF. I found a popular UserAgent parser http://www.bitwalker.eu/software/user-agent-utils which I include in my project. In project I use maven. I added all dependencies, implemented eveyrthing and test it. It works fine in my local machine. Next I make clean install in maven for building jar. This jar I use in Hive via add jar {MyJarName} and then create a function: create temporary function {functionName} as {pathToUDFClass} and got exception like this.

                    Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"bidid":"8326c0ec49e5746f1af03400f37e5797","tstamp":20131022185001163,"logtype":1
                    ,"ipinyouid":"D89E8S5bwWz","useragent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; InfoPath.2)","ip":"61.138.253.*","regionid":374,"cityid":375,"adexchange":1
                    ,"domain":"449a7568331085d43d5867de26ce1ee1","url":"5ecba5b62bafd3428cdc1398b40cf88f","anonymousurl":"null","adslotid":null,"adslotwidth":300,"adslotheight":250,"adslotvisibility":"Na","adslotformat":"Na","adslo
                    tfloorprice":0,"creativeid":"10722","biddingprice":294,"payingprice":135,"landingpageurl":"null","advertiserid":2821,"userprofileids":[10006,10110,10063]}                                                         
                            at org.apache.hadoop.hive.ql.exec.tez.MapRecordSource.processRow(MapRecordSource.java:91)                                                                                                                  
                            at org.apache.hadoop.hive.ql.exec.tez.MapRecordSource.pushRecord(MapRecordSource.java:68)                                                                                                                  
                            at org.apache.hadoop.hive.ql.exec.tez.MapRecordProcessor.run(MapRecordProcessor.java:325)                                                                                                                  
                            at org.apache.hadoop.hive.ql.exec.tez.TezProcessor.initializeAndRunProcessor(TezProcessor.java:150)                                                                                                        
                            ... 14 more                                                                                                                                                                                                
                    Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"bidid":"8326c0ec49e5746f1af03400f37e5797","tstamp":20131022185001163,"logtype":1,"ipinyouid":"D89E8S5bwWz","
                    useragent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; InfoPath.2)","ip":"61.138.253.*","regionid":374,"cityid":375,"adexchange":1,"domain":"449a7568331085d43
                    d5867de26ce1ee1","url":"5ecba5b62bafd3428cdc1398b40cf88f","anonymousurl":"null","adslotid":null,"adslotwidth":300,"adslotheight":250,"adslotvisibility":"Na","adslotformat":"Na","adslotfloorprice":0,"creativeid":
                    "10722","biddingprice":294,"payingprice":135,"landingpageurl":"null","advertiserid":2821,"userprofileids":[10006,10110,10063]}                                                                                     
                            at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:565)                                                                                                                                
                            at org.apache.hadoop.hive.ql.exec.tez.MapRecordSource.processRow(MapRecordSource.java:83)                                                                                                                  
                            ... 17 more                                                                                                                                                                                                
                    Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method public org.apache.hadoop.io.Text hive.homework3.UserAgentDetector.evaluate(org.apache.hadoop.io.Text)  on object hive.homewor
                    k3.UserAgentDetector@1b340ab of class hive.homework3.UserAgentDetector with arguments {Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; InfoPath.2):org.apache.hadoo
                    p.io.Text} of size 1                                                                                                                                                                                               
                            at org.apache.hadoop.hive.ql.exec.FunctionRegistry.invoke(FunctionRegistry.java:1019)                                                                                                                      
                            at org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge.evaluate(GenericUDFBridge.java:182)                                                                                                              
                            at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator._evaluate(ExprNodeGenericFuncEvaluator.java:186)                                                                                            
                            at org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:77)                                                                                                                    
                            at org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:65)                                                                                                                    
                            at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:81)                                                                                                                           
                            at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:841)                                                                                                                                      
                            at org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:133)                                                                                                                    
                            at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.forward(MapOperator.java:170)                                                                                                                       
                            at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:555)                                                                                                                                
                            ... 18 more                                                                                                                                                                                                
                    Caused by: java.lang.reflect.InvocationTargetException                                                                                                                                                             
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                             
                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                                                                           
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                                                   
                            at java.lang.reflect.Method.invoke(Method.java:498)                                                                                                                                                        
                            at org.apache.hadoop.hive.ql.exec.FunctionRegistry.invoke(FunctionRegistry.java:995)                                                                                                                       
                            ... 27 more                                                                                                                                                                                                
                    Caused by: java.lang.NoClassDefFoundError: eu/bitwalker/useragentutils/UserAgent                                                                                                                                   
                            at hive.homework3.UserAgentDetector.formatter(UserAgentDetector.java:30)                                                                                                                                   
                            at hive.homework3.UserAgentDetector.evaluate(UserAgentDetector.java:22)                                                                                                                                    
                            ... 32 more                                                                                                                                                                                                
                    Caused by: java.lang.ClassNotFoundException: eu.bitwalker.useragentutils.UserAgent                                                                                                                                 
                            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)                                                                                                                                              
                            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)                                                                                                                                                   
                            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)                                                                                                                                           
                            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)                                                                                                                                                   
                            ... 34 more                                                                                                                                                                                                
                    ]], Vertex did not succeed due to OWN_TASK_FAILURE, failedTasks:1 killedTasks:21, Vertex vertex_1501829365845_0009_1_00 [Map 1] killed/failed due to:OWN_TASK_FAILURE]DAG did not succeed due to VERTEX_FAILURE. fa
                    iledVertices:1 killedVertices:0  
                    

                    from these as I understand that most important thing is:

                    Caused by: java.lang.ClassNotFoundException: eu.bitwalker.useragentutils.UserAgent                                                                                                                                 
                            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)                                                                                                                                              
                            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)                                                                                                                                                   
                            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)                                                                                                                                           
                            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)                                                                                                                                                   
                            ... 34 more      
                    

                    this external lib I use in my maven project.

                    This is UDF creation and by the way in local works everything fine and test are passed. But in the Hive it doesnt work. I suppose that this lib which I use has problems but is it possible if I in local works fine?

                    import eu.bitwalker.useragentutils.UserAgent;
                    import org.apache.hadoop.hive.ql.exec.Description;
                    import org.apache.hadoop.hive.ql.exec.UDF;
                    import org.apache.hadoop.io.Text;
                    
                    
                    @Description(
                            name = "agentdetector",
                            value = "_FUNC_(str) - detects a user-agent of user",
                            extended = "Example:\n" +
                                    " > SELECT agent(line) FROM test ipy; \n"
                    )
                    public class UserAgentDetector extends UDF {
                    
                        public Text evaluate(Text text) {
                            Text value = new Text("");
                            if (text != null) {
                                value.set(formatter(text));
                                return value;
                            } else {
                                return null;
                            }
                        }
                    
                        private Text formatter(Text text) {
                            UserAgent userAgent = UserAgent.parseUserAgentString(text.toString());
                            StringBuilder builder = new StringBuilder();
                            builder.append("Browser : ").append(userAgent.getBrowser().getName()).append("\n");
                            text.set(builder.toString());
                            return text;
                        }
                    

                    And the dependency for maven is:

                     <dependency>
                                <groupId>eu.bitwalker</groupId>
                                <artifactId>UserAgentUtils</artifactId>
                                <version>1.20</version>
                      </dependency>
                    

                    ANSWER

                    Answered 2017-Aug-06 at 17:26

                    To solve the problem just add plugin in you pom.xml

                               <plugin>
                                    <artifactId>maven-assembly-plugin</artifactId>
                                    <configuration>
                                        <archive>
                                            <manifest>
                                                <mainClass>{pathToMainClass}</mainClass>
                                            </manifest>
                                        </archive>
                                        <descriptorRefs>
                                            <descriptorRef>jar-with-dependencies</descriptorRef>
                                        </descriptorRefs>
                                    </configuration>
                                </plugin>
                    

                    and run assembly:assembly in plugins of maven.

                    Source https://stackoverflow.com/questions/45532559

                    Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                    Vulnerabilities

                    No vulnerabilities reported

                    Install user-agent-utils

                    You can download it from GitHub, Maven.
                    You can use user-agent-utils like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the user-agent-utils component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

                    Support

                    If you used this library for a commercial product, a donation would have been great during the past years. <a href="http://flattr.com/thing/1968218/HaraldWalkeruser-agent-utils-on-GitHub" target="_blank"><img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a>.

                    DOWNLOAD this Library from

                    Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                    over 430 million Knowledge Items
                    Find more libraries
                    Reuse Solution Kits and Libraries Curated by Popular Use Cases
                    Explore Kits

                    Save this library and start creating your kit

                    Explore Related Topics

                    Share this Page

                    share link
                    Consider Popular Java Libraries
                    Try Top Libraries by HaraldWalker
                    Compare Java Libraries with Highest Support
                    Compare Java Libraries with Highest Quality
                    Compare Java Libraries with Highest Security
                    Compare Java Libraries with Permissive License
                    Compare Java Libraries with Highest Reuse
                    Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                    over 430 million Knowledge Items
                    Find more libraries
                    Reuse Solution Kits and Libraries Curated by Popular Use Cases
                    Explore Kits

                    Save this library and start creating your kit

                    • © 2022 Open Weaver Inc.